Handling Events in a Game

May 16, 2014 at 1:38pm
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 May 16, 2014 at 1:55pm
May 16, 2014 at 1:55pm
This would be better suited in the Lounge
May 16, 2014 at 1:57pm
Moved to the lounge now.
May 16, 2014 at 2:31pm
http://gameprogrammingpatterns.com/observer.html
Either that or dedicated event queue (all observers subscribe to)
May 16, 2014 at 2:53pm
Highly helpful article. Thanks @MiiNiPaa.
May 16, 2014 at 4:51pm
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.
May 16, 2014 at 6:40pm
Yes it seems so.
May 16, 2014 at 7:10pm
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 May 16, 2014 at 7:10pm
Topic archived. No new replies allowed.