chris.software     development     reviews     feed

We have lighting!

A snapshot of Visual Studio's Solution Explorer displaying the NePlus project.

Well, sort of. I have been working on integrating lighting effects into the game this week, and have expanded the engine components and arranged them, although I would like to move things around a bit. Currently, my Visual Studio solution is moderately small, although it does grow a bit every day. The engine’s organization is not something I’m completely happy with at the moment, although all of the function calls to it look how I’d like them to. The lighting effects exist now, thanks to an extremely helpful blog post on the subject and an example project showing the code needed to do this. However, the camera class doesn’t yet play nicely with the technique - I am still struggling with matrices and the associated jazz, so I am not sure what the best way to draw the shadows is - currently, they are being drawn at a stationary point, and I’m sure with a little testing I’ll be able to figure out exactly how I should draw them to line up with the rest of the things I’ve got working. Along with the lighting integration, I introduced a couple more of my first bugs - the Farseer debug view shouldn’t be affected by the lighting, so I’ll have to figure out how to exclude it. Also, I need to be able to draw my scenery and not have it obscured by darkness if I don’t want it to be. These things should hopefully be pretty easy to change, and will happen most likely within the next couple of days.

Moving forward, my plan is to fix those bugs and then start working on how to detect if an object is being touched by the lighting. From there, I can decide what happens if an object is indeed being touched by lights, and introduce the anti-gravity light! I also want to play with the lighting so that it is a little more dynamic as far as brightness, when it’s on, when it’s off, and so forth, all of which should be pretty simple. I just need to create simple interfaces to these things so that they can be easily manipulated.

One may note that I have not yet fully mentioned anything about Tiled, although the DLL is sitting in my project. Before the end of Sprint 2, which is now about two weeks from now, I hope to have integrated Tiled into the project in some simple fashion. I will be doing this most likely using TiledLib, which is an extension that was created with the intention of adding Tiled resources to the XNA Content Pipeline so that it is extremely easy to load Tiled maps into XNA projects, and also to provide a simple interface for accessing the data in Tiled resources. Tiled is a map editor that creates easy-to-read maps for projects, so basically I’ll be designing levels in Tiled and then reading the files in my code, and creating the game levels by positioning objects and creating their appropriate physics and lighting properties (and probably many other properties which I am not currently working on). I’m excited about using Tiled, because I have a feeling that it’s going to be a great editor that I’ll be able to use in every 2D game I ever work on during my own time. But I felt similarly about the engine I was going to use for my project, so we’ll see how it turns out in a few weeks.

The decision to be working with my own engine has so far been pretty good - I definitely like having full control over the major aspects of my project. The Farseer physics engine is still a blast to use now that it’s working, and so far none of the components I’ve brought in from outside sources have limited any of my abilities to do exactly what I want to do. That’s a nice kind of freedom, and now that I’ve been enjoying it it’s hard to imagine wanting to use a full-fledged game engine as opposed to pulling together separate components and gluing them together however I see fit.

A square resting on a dark platform while emitting red light.