Original Post
Hi there, Im currently working on a little 2d platform game in c#. I have done one before but that was in pure c which made the game loop very linear. From what i have read i see two things 1) The windows event driven objects 2) the game message pump/loop. Now i know that the events that occure are also sent to some message queue but i still have a hard time distinguishing between the 1 and 2 in relation to a game design. For instance, one of my ideas were to have a timer object that rised an event every 40 ms. Ill have the draw() method subscribed to that timer event to ensure a 25 fps. Were also thinking about a keyboard object to rise keystroke events which again triggers some movement of a player through the producer-subscriber concept. So basicly u already have alot of events/actions wired together. I then read about this message pump in the main game loop. To me it seams quite similar to the old game loop but instead of plawing through functions and FSM's we just wait till a message pops up on the queue, decode what message it is and then get the appropiate handler to take care of it. Now while i like the idea of the message pump I find it a bit obsolete since a lot of the events can be wired indirectly via. the producer-subscriber pattern. So I guess the two methods i see are: 1) Event handling via. producer-subscriber pattern. whitch is kinda of a distributed way of routing things togehter. I could see this being a mess to keep track of all the message handling. 2) The message pump, which is a more centralized approch. All messages go into one queue and are decoded and from there (the center) are handed out to the appropriate handlers. I would be really happy if someone could shred some light on this matter cause im very confused of what is atcually the best way or if the ycan be implemented nicely together.