38 ms·
Why did they write their own VM? Was it sort of a write-once, run everywhere thing? So they can reuse the game code on various platforms?
by Peaker 10y ago
Why did they write their own VM?
Was it sort of a write-once, run everywhere thing? So they can reuse the game code on various platforms?
- groby_b 10y agoHaving written games back in that time, I can at least tell you why I wrote my own VM: You get a custom language/compiler, which makes iteration time significantly faster than recompiling your game yet again, for yet another tiny tweak. Or, worse, writing every bit of your game in assembly. (Worse in the sense of time consumed. In the sense of fun had, the VM approach takes some of that away ;)
- ryiron 10y agoThis is the impression I get from reversing it: the virtual machine mostly assists quickly porting to other platforms. I previously reversed another game engine called Comprehend (for 1980s text/graphical adventure games) which also had a VM. I ended up talking with one of the original developers, who said that portability was a major reason. Their company wrote the original Apple 2 implementation, and then contracted development for the other platforms out, so they just provided specs for the VM. The Lost Vikings development may have been similar. In the Lost Vikings the VM implementation was almost certainly written in assembler. There are various tricks used in the binary which I don't think compilers of the day were capable of. The other parts of the game also appear to have probably been written in assembler, which I think is interesting since it was developed quite late in the DOS era.
- ekianjo 10y agoanother world used a similar technique.
- corysama 10y agohttp://fabiensanglard.net/anotherWorld_code_review/ http://fabiensanglard.net/anotherWorld_code_review/
- CJefferson 10y agoIn these kinds of games, the programs tend to be very small and you only need a very small set of functions which can be made opcodes rather than explicit function calls. You can often write the VM in 2k or so and have programs of only a few dozen bytes, while a standard vm would be ten or a hundred times the size.
- deleted 10y ago[deleted]
- jmedefind 10y agoFor Lost Vikings it was most likely for easy porting. Wikipedia mentions is was available on the following platforms: Amiga, Amiga CD32, Game Boy Advance, MS-DOS, Mega Drive/Genesis, Super NES, PlayStation
- ianl_person 10y agoBytecode programs can be more compact and built-in coroutines are useful for games.
- vvanders 10y agoYup, coroutines are a really nice fit for game logic which is partly why you see Lua used so often in games(along with being super-compact and fast).
- khedoros1 10y agoVariations on that theme seem pretty common. Ultima Underworld's conversation system uses a stack-based VM. The original Jedi Knight game has a programming API and a compiler. Game assets are compiled from a C-like language at load-time. Various adventure games (both graphical and text-based) were written as bytecode programs that run in a VM.