Monday, October 22, 2007

Building Games in Small Pieces

A few people have been asking for ICCARUS source code.

In it's current state, it is a big ball of mud, and probably useless to most people. So, I'm attempting to refactor parts of the code and release them as re-usable units of functionality, which can be easily tested, documented and even used! :-) I'll think about a complete ICCARUS release later.

The first useful chunk is my mainloop module. This module supplies a generic Loop construct (which implements frame skipping and a fixed simulation supdate), for your pyglet/pygame/opengl application.

It's rather simple. To use it, you create 3 callback functions to handle tick, render and gui events.
>>> import time
>>> from mainloop import Loop
>>> loop = Loop(time.time, time.sleep, tick_func, render_func, gui_func)
>>> loop.start()
It's quite a tight loop, and IMO is probably about the most code you should have as your inner game loop.

No comments:

Popular Posts