News for hackers. Stuff that matters.
Re:Finding the Lost Vikings – Reversing a Virtual Machine by Peaker on Tuesday February 21, 2017 @07:09AM (#13694920)
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?

Re:Finding the Lost Vikings – Reversing a Virtual Machine by groby_b on Tuesday February 21, 2017 @08:28AM (#13695234)
Having 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 ;)

Re:Finding the Lost Vikings – Reversing a Virtual Machine by ryiron on Tuesday February 21, 2017 @04:16PM (#13700086)
This 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.

Re:Finding the Lost Vikings – Reversing a Virtual Machine by CJefferson on Tuesday February 21, 2017 @07:55AM (#13695076)
In 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.
Re:Finding the Lost Vikings – Reversing a Virtual Machine by jmedefind on Tuesday February 21, 2017 @11:05AM (#13696481)
For 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

Re:Finding the Lost Vikings – Reversing a Virtual Machine by khedoros1 on Tuesday February 21, 2017 @03:11PM (#13699389)
Variations 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.
Re:Finding the Lost Vikings – Reversing a Virtual Machine by ianl_person on Tuesday February 21, 2017 @11:34AM (#13696790)
Bytecode programs can be more compact and built-in coroutines are useful for games.
Re:Finding the Lost Vikings – Reversing a Virtual Machine by vvanders on Tuesday February 21, 2017 @12:00PM (#13697085)
Yup, 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).
Re:Finding the Lost Vikings – Reversing a Virtual Machine by ekianjo on Tuesday February 21, 2017 @07:54AM (#13695070)
another world used a similar technique.
Re:Finding the Lost Vikings – Reversing a Virtual Machine by corysama on Tuesday February 21, 2017 @11:47AM (#13696930)