chris.software     development     reviews     feed

Anti-Gravity Light Created

Working with Tiled has been a real joy so far. My latest feat has been integrating TiledLib with the physics in my game, so that when I open up a map file I read in the artwork, collision (both with tiles and with Tiled “objects,” which I’ll go into in more detail in a bit, player spawn points, and light objects. What I’m striving for is having as much level data and configuration in Tiled maps as possible, given that the Tiled maps are XML (although they can be many different formats). In fact, I might switch to CSV, because that might represent maps more visually in text before they are loaded, which might be nice to keep in source control to watch their developments.

A grid interface with two rectangles and some configuration information.

The above image shows me designing a testbed for the anti-gravity light. The goal of this experiment was to create a light that enables the player to move between two platforms. When under the light, the player floats upwards. This is what it looks like loaded in-game, with the appropriate additions to the engine to take care of most of this automatically…

Two platforms, a blue light, and a red box float against a black background.

The test went really well, but I’m most excited about the fact that it’s so easy to define all of this stuff in my map files and have the engine take care of all the loading. As you can see in the image above, Farseer’s debug view is showing that the left platform is composed of many small squares, whereas the right platform is just one big rectangle. Obviously the one is more efficient that the many, but I am just going to keep the code around for both because it might be neat to utilize different techniques depending on the situation.

For my next trick, I’m planning on creating more light components, but after I refactor the code a bit, because I still have a bit left in my Game1 class that shouldn’t be there as a hack to get this example going. I would like to create the light that nulls other lights so that I’ve always got that in my arsenal. I also would like to have my dynamic lighting back, but I am waiting on Krypton XNA for the 4.0 update so that I can hopefully utilize that project to speed up development. However, I am still confident that if that never happens I’ll be able to do something from scratch without too much trouble. I am going to keep a collection of lights in my level class, so that they’re all easily and logically accessible. I need to figure out what the best way is to affect objects that are being touched by light with the appropriate effects, which as of now is a bit hacked together.