News for hackers. Stuff that matters.
Re:Annotated code: Circles bouncing off lines by hcarvalhoalves on Sunday February 08, 2015 @08:57PM (#9019405)
That's pretty educational.

OT: I'm not a game developer. What are the other patterns - besides the global state and mutation functions - that one can use for a game loop?

Re:Annotated code: Circles bouncing off lines by sago on Monday February 09, 2015 @02:50PM (#9023233)
Mostly modern game engines use an entity system[1], which is a form of database (global data, I guess, in as much as any database is).

The main loop then steps through each component (of which physics would be one) and lets it update the entity data for all entities.

This pattern took over from class/inheritance based architectures about 10 years ago.

There have been some suggestions that Functional Reactive Programming is a better approach. I've used it in some prototypes, but I couldn't scale it to engine-size, and I'm not aware of it having been used successfully for a full game engine.

So, this approach is pretty much it. You keep a database of state, then you run a system (the physics system, say) to update that database.

[1] http://t-machine.org/index.php/2007/09/03/entity-systems-are...

Re:Annotated code: Circles bouncing off lines by hemdawgz on Sunday February 08, 2015 @11:22PM (#9019718)
I don't have a specific answer for your question, but I know this site was written specifically for game programming patterns: http://gameprogrammingpatterns.com/contents.html