[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Event handling

> I've chosen to handle events a little differently in my game.  I've
> written a very simple event queue class (Yes, a class.  I using C++
> because I think OOP just makes sense... call me weird...) that events
> can be appended to as they occur.  Somewhere in the main loop, they are
> processed.  I've done this because game events can be generated by any
> number of things: user input, network traffic, a collision, someone's
> health dropping to 0, a certain time being reached...  I've found this
> quite easy to work with, so far.
> I like you idea of emitters and sinks, though.  If you ever get
> something like this going, I'd love to see it in code.

I have done something like this, but it's based on threads - a 'kernel'
messages (events) between processes, each of which has an input and output
message queue.
When a message arrives, the process is threaded (could be done without threads,
If I create a process which'd redirect all incoming messages through network to
kernel, it will work (as long as no pointers are sent :-)


 Tomas Andrle
ICQ : 17688140
Two wrongs don't make a right (but they make me feel a whole lot better)