• entries
5
9
• views
5786

# Oh noes! Another gameengine rewrite!

316 views

I just decided to do another gameengine rewrite of my current project, Spatra 2, written in C#.

This must be the, like what, fourth rewrite? I recently rewrote it from the noobish while(notQuit) run; structure to the Kernel/Task structure presented by superpig in his awesome Enginuity series

Moving to a taskbased engine made it *so much more* scalable and modifiable. For instance, if you want a fancy explosion, you just create a RenderExplosionTask which deletes itself from the Kernel after the simulation is done. So the only thing you do is
Kernel.AddTask(new RenderExplosionTask(pos));

And the object renders an explosion, and after it is done, it just deletes itself with
// In RenderExplosionTask.Update()if (explosionRadius > 500.0f)    Kernel.KillTask(this);

I.e. no if (shouldRenderExplosion) updateAndRenderAllExplosions(); mess in some gameloop somewhere.

Anyway, I have tasks that handles core functionallity of the engine. Like there's a InputTask that updates the state of the input, but as it is now, it is hardcoded for DirectInput, so the rewrite will consist in creating generic interfaces for the core classes, and implementing these interfaces with API specific solutions. That way porting the game to Linux will be a *lot* easier since it will only consist of writing a Linux-based inputhandler that implements the generic Input-interface.

Now go rewrite your engine too!

## 1 Comment

Interesting kind of design. Thanks for mentioning it!

## Create an account

Register a new account

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.