So I'm trying to create a simple multi-threaded game engine for the game I want to write. So far, everything has worked without any problems, I even know what steps I have to take to finish it.
There is only one thing I don't know (well, technically, I know a solution for it, but I'm hoping there is something more elegant and faster): Basically, I have a seperate thread for every part of my engine - Graphics, Input, Physics, Audio, etc.
The physics thread has a complete scene node structure of the world, where it simulates everything. However, I now have to get this structure over to my graphics thread, with the least overhead possible. Ideally, it should only transfer the parts which changed since the last update.
I have components in place for transfering this data, only problem is generating it.
So far, I have thought of two different approaches:
Approach one would copy a big amount of memory, but without much processing power, approach two would do the reverse: plenty of processing power, less memory copied.
Is there some general answer which approach would be faster in a typical gaming environment?
No, there is not an accepted general answer, it is a current area of research in games development.
My 2 cents is the conventional wisdom - which one to use really depends on your specific use case - if your game has lots of data (ie it's very memory intensive, like most blockbuster titles), you'll probably want to just transmit changes. If your game isn't memory intensive (eg, arcade games), you can probably get away with copying the entire object.
I'd suggest implementing both and hooking up performance timers to see which works better for you; it is possible to implement an architecture which can handle both methods transparently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With