Archived

This topic is now archived and is closed to further replies.

Zanthos

Stack vs Register vs Stack vs....

Recommended Posts

I''ve been doing quite a bit of research on Stack based and Register based virtual machines as I''m planning to make a custom scripting system for my game engine. At first I set out trying to find how much faster compiling the code is, but the question was already answered in a previous thread Have you made a virtual machine? Was it stack or register based? How fast is it? Have you made a scripting implementation but couldn''t be bothered with the compiling? Thanks in advance

Share this post


Link to post
Share on other sites
I''ve made a basic vm and language compiler last summer as a prototype for a system I am developing for a game. While not fully functional (hey, it was a prototype ) it was good enough to use. Speed wasn''t an issue for me, but that depends on the game -- a fps game will have much less time to devote to script running than a turn-based game will. My system was stack-based, I did some research on stack vs register based architectures, and while my research tended to conclude that a register-based vm would be faster, the extra complexity in the compiler wasn''t worth it (Yes, I did try a register-based version first, but got bogged down with too much grief keeping track of register usage in the compiler)

In all, stack-based is much easier to write for, and fast enough...

Also, you definatly want to get your hands on "Game scripting mastery", it''s the book I wish I had when I started mucking around with compilers and vm''s...

Share this post


Link to post
Share on other sites