Archive for the tag 'setuptools'

Box of horrors

Today I adapted the nice setuptools-based plugin module from Spineless to more easily support different physics toolkits in my code, and played around a bit trying to write a Box2D plugin. Frankly, I don’t like the Box2D API design at all, and I like the pyBox2D API even less, as it’s a direct port of the C++ API and doesn’t even try to be Pythonic. Eww. Seems I’ll have to try fake sweeping collision detection and other tweaks to pymunk next to fix the collision problems I wrote about.

In other news, starting tomorrow I’ll try to finish two university courses that are really long overdue and that I want out of the way before September. I have one short paper to write and one coding project to do, so game development progress will probably be a bit slower again for a while. But every finished course takes me closer to graduation (which I’m planning to do next year), so yay for that!

Entities ahoy!

Entity system

Today I’ve continued work under the hood, on the entity system. Both components and entity types are now loaded using the plugin / entry point system of setuptools, which means custom components and units will be really easy to create and distribute. And much easier for me to load. :) I have a habit of making too many sweeping changes to code at once, and this is no exception. On the other hand, this does result in massive improvements to the entity system and especially creation of entity type files, so it’s all for the greater good.

No screenshots to show for my efforts, but see the end of the post for examples of what entity type files currently look like. This might change before these changes are completed.

Entity editor

I’ll probably have to start working on an entity editor at some point, since I recon unit and other entity creation will get quite complicated when multiple linked entities, collision shapes, etc. etc. get involved. I’m no big fan of GUI programming, especially since Python’s GUI libraries all seem kind of shoddy (though that seems to apply to other languages too, at least C# and Java). Anyway, I’ll probably use wxPython for it. Making it in-game would be cool, but too much effort at the moment.

Trac

I tried installing Trac (again) today since they just released version 0.11, and couldn’t get it working (again). After getting over a few hurdles, I was finally stumped when trac-admin hanged while trying to create the environment. Every time. I really want to like Trac, since it’s excellent when it works, but I’ve had nothing but problems trying to get it working myself. It seems I’ll have to let it go and find some other issue tracker when I really start needing one. I’d like it to integrate with Mylyn, but the (free) options there are a bit limited. We’ll see…

Read more »

Artillery Brawl

Today, I got back from Sweden, Arty got a new name, and I continued a tiny bit on my entity system. Rather than keeping the name of my old game, I’m making a tribute to Artillery Duel and naming it Artillery Brawl. Also, I already have some cool ideas for a possible sequel. Of course, that will be far in the future if it ever becomes reality, but at least I can store ideas in its brainstorming wiki instead of throwing them away if they don’t fit in Artillery Brawl. ;)

I’m in the progress of generalizing my entity system a bit. My current step is creating a “component library” so that unit files and other entity type definitions can load and create components by name instead of importing them, which would get really messy, really quick. I’m going to load components using entry points in setuptools, which allows me to trivially support both builtin and modder-provided components. This means it’s going to be easy to make and distribute units with new functionality without the need to modify the source code of the game.

Laying eggs

I’ve been lost on another side path for the past few days (and being lazy on purpose as part of my Christmas holiday ;) ), but hopefully this is the last one on my main path of producing something I can actually show you, my valued readers! …and something I can play with myself. Oh, I haven’t told about my main path? My roadmap for the near future is:

  1. Implement resource loaders
  2. Get the renderer plugin working again
  3. Start writing scene management
  4. Start writing Red Nebula

To explain the first step, I probably have to explain plugins in Spineless (as it’s still called, new name is pending; also see end of this post). Plugins are used to implement low-level parts of the engine which depend on an underlying library. At the moment these include the window manager (Pygame plugin implemented) and renderer (OpenGL plugin). Audio mixer, networking and physics are other examples. As such, there can only be one plugin per group loaded at a time.

Resource loading used to be based on similar plugins too. There would be eg. Pygame and PIL plugins for images. The problem was that this was mixing resource representation with loading. As such, you couldn’t for example load models using both the Collada and OBJ plugins. I’m going to add a second type of plugin now, the resource loader. There can be many of these loaded at once, and any loader can be used to load resources. For some resource types, there can also be toolkit plugins, which you can only load one at a time.

And finally, about the side path. Over the course of this new engine revision, I implemented at least three different ways of loading plugins, none of which I was really happy with. This was before I had learned that setuptools can be used to discover and load plugins! After throwing some code away and writing literally a few lines of setuptools-using code, I had far more elegant plugin loading implemented. Welcome, setuptools!

I’ve also been thinking about a new name for the engine. It’s not critical, but it’s something I want changed. Unfortunately, coming up with good names is extremely difficult. I have a couple of options:

  • Some derivative of Sampo, since it’s from Finnish and magical ;)
  • Something related to the (code) name of my game: Red Nebula. Unfortunately the obvious choice Nebula is already taken at least a couple of times.
  • Something else:

Suggestions are welcome. :)