Archive for the ‘cpp’ Category

Using GameLoop in Your Own C++ Projects

Wednesday, April 2nd, 2014

About 2 months ago, I released a modified chunk of code from one of my personal projects under the MIT license and put the repository up on Github. The project itself was comparatively much larger than the repo then (orders of magnitude larger if you compare sloc), and is even larger now, but I thought that there was value in releasing an abstracted, bare-bones version of my main program loop, mostly because I often benefit from such efforts myself (often when I’m trying to learn something new) and thought of it as some form of giving back, and partly because I believe that releasing code under flexible licenses helps foster a sense of community among developers.

The project was borne out of a desire to learn a bit more about Control Theory, in particular its applications in multi-agent systems, and having decided (in my infinite wisdom, and largely unemployed state) to brush up on my C++, I wanted to make a simulation so I could test a few core concepts from the multitude of papers I got off Springer and IEEE and whatnot using my girlfriend’s library account. Since it was a simulation, and since it was going to require both some form of artificial intelligence and some amount of user input, I decided to build it like a game from the offset. In many ways the idea was basically a real-time strategy anyway, since the tests I had in mind all had at least some of the elements you’d expect from a strategy game: customizable input schemes, some quantifiable amount of resources on a finite map, deterministic results and playback, agent competition, differences in agent abilities, and so forth. As such, it needed a loop, and needing a loop meant that I had to revisit some old reference material from way back when. (more…)