Sign in to follow this  
  • entries
    5
  • comments
    9
  • views
    5655

Oh noes! Another gameengine rewrite!

Sign in to follow this  
Enselic

231 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!
Sign in to follow this  


1 Comment


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now