Handling Events in a Game

Hi everyone.

The topic is events in a game. Mainly sharing experience.

No matter what framework you use there are some things that has to exist in all games such as events.

Mostly games separate functions such as handleEvent() update() draw() and blah blah. The choice is programmers of course.

What i want to talk is where and how exactly do you handle your events. Do you use an event poll class. Maybe inside handleEvent function. Or you just handle events in update function. Please share your experience gained at former projects, companies.

Thanks in advance.
Last edited on
This would be better suited in the Lounge
Moved to the lounge now.
http://gameprogrammingpatterns.com/observer.html
Either that or dedicated event queue (all observers subscribe to)
Highly helpful article. Thanks @MiiNiPaa.
For a relatively small gmae I'd suggest a handleEvent() function should suffice, for bigger games go for the observer pattern. It scales a lot better.
Yes it seems so.
Also when i was using using handleEvents(). I always thought it was not a good solution at all. Even at some small scaled games(Though i did not make any game that is published). Which bugged me till now.

Now i am reading gameprogrammingpatterns book. I am relieved that there are lots of useful methods.
Last edited on
Topic archived. No new replies allowed.