DinoMage on Twitter RSS Feed

When I was writing Frank the Dinosaur, I ran into a question:  How should I handle game events?  Of course, since I was on a bit of a time crunch, I just did it the naive way.  I checked each condition once every frame.  I knew this was a bad way, since some events were time-based and hence would not be triggered out of order.  Yesterday, I wrote up the first bit of a library that will deal with this problem.  JEL Event Library holds both time-based and action-based events.  The action events are stored for quick access in a vector.  The time events are stored in a sorted tree.  In this way, many time conditions can be skipped altogether, meaning fewer checks and a more efficient system.  Borrowing from the GRO_gui codebase, JEL events trigger Signals, which are typesafe wrappers for function pointers (i.e. events call the functions you give them).  With Ludum Dare 15 starting this coming weekend, I’ve uploaded the initial implementation here.  There are pieces missing, but the basic functionality is there.  Future plans include a conditional system that automatically checks variables that you provide and triggers events as their conditions are met.

Leave a Reply