Search This Blog

Sunday, October 17, 2004

Roamer: recent updates

[Audio Version]

I've made quite a bit of progress along the way of this project. It would be tedious to document the full progression since the start. Still, I suppose I should get in the habit of documenting progress from time to time.

Since my previous posting, when I wrote an opening summary of the Roamer project, I've made some significant progress. Most importantly, I noticed a memory leak that was occurring because of the poor way I was using the graphics features of the .NET framework. I'm a bit disappointed that it doesn't seem to deal well with cleaning up after itself. With a little effort, I eliminated that memory leak nearly completely. It's hard to tell, though, because, as the .NET documentation indicates, garbage collection doesn't happen immediately as objects are removed from use.

One exciting change is that now I can define a world using an XML file. Previously, I had to hard-code the initializations of each demonstration. It's not just a matter of moving code to an external file, though. More importantly, the format I chose offers an important layer of object abstraction. In my hard-coded demos, I would instantiate particle after particle for a critter. In my XML file, by contrast, I can define a segment of particles - perhaps a leg or arm, for example. That segment can be duplicated any number of times and put into different positions and at different angles. Moreover, each duplicated instance of a segment can specify changes that add, remove, or modify particles from the original definition. Segments can be composed of other segments, which in turn can be composed of other segments, and so on. It's a particularly object-oriented way of looking at the critters, and blends nicely with the notion of segmentation to the evolution of complex life forms on Earth.

The end result of all this reusability is the ability to construct worlds composed of potentially thousands of particles that may only require dozens of definitions in an XML file.

What I haven't done yet is to implement the same for the brains of these beasts. Although I originally conceived the use of XML files for defining brain wiring, I realized it was going to be more complicated than doing the same for the world. That's next on my list.

No comments:

Post a Comment