Bytecode VM for your game

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
a_bertrand
Posts: 1537
Joined: Mon Feb 25, 2013 1:46 pm

Bytecode VM for your game

Post by a_bertrand »

A couple of weeks ago I changed my script execution from an AST direct execution to a bytecode execution allowing me to interrupt the script execution basically anywhere and restoring the flow later on. This is mandatory in my case as Javascript handle some calls (ajax or websockets) in async mode, and my script is instead synchronous. My bytecode is not super efficient and could certainly be optimized, but it is also currently clearly slower than the AST execution. Not a big deal for most cases.

However as I always like to read around how others implements their things, I fell on this nice article, which I strongly suggest any developer to read:

http://gameprogrammingpatterns.com/bytecode.html

Don't be scared by the "bytecode" or "vm" keywords, and don't be scared by the fact the guy wrote it in C++, it's pretty easy to follow and could be implemented in any language nearly the same way.

In my case I started from a text scripting language and a compiler to end up to the bytecode, while he started from the bytecode and went to a scripting language to make it easier to work with.

As the author of the article I'm also thinking about the option to deliver a graphical language and allow non-dev to code in an easy to approach way. Maybe some features will not go through but it should at least cover most.
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Bytecode VM for your game

Post by hallsofvallhalla »

Sweet I love good articles like this. Thanks for the share.
Post Reply

Return to “General Development”