2D Lightning Continued

By | Blog, Featured, XNA Games | 33 Comments

A week ago i received a twitter message about the 2d lightning i posted. He asked me there if i could reproduce some normal mapping effect with correct lightning. I failed in doing so with the previous code i posted, so i picked it up and began coding once again om my lightning. The results where very pleasing for me and the person that asked for it :).

The results ended up like this:

The effect can off course better be viewed in motion, so i created a little movie for you as wel:

See it in HD on youtube

Source Code

Now it is time for some code, i will not discuss all the code that is required for this effect because at the bottom of the page you can also download the sample code that contains everything you saw in the movie.

First of all you will require a color map of your current scene and a normal map (in the sample we only use one texture for this)

Together with a light source these two images become the result you see below (this image has a low ambient light):

The color map and normal map texture will both be rendered to their own rendertarget. This will result into two different textures, one is your color image and one your normals. These two textures are provided to the shader effect as parameters to create a light map, such image you can see below. This is where all the magic happens :).

This lightning texture is then combined with the color map to produce the desired effect. I do it this way because i had some problems before rendering multiple lights, doing it this way i didn’t have any of those problems.

The variables or constants inside the shader effect file (MultiTarget.fx) can be tweaked to your desires. Especially the following line will adjust the specular highlight (or you can disable it this way):

Also the height of the light will have a huge impact on how the coloring will react. The default value of the height of the light will be around 100. Try to lower the number and see what it does :).

If you have any questions remaining, feel free to ask me :).

Update: I updated the sample application to work with xna 4.0. The lights are now working with a generic list; A specular strength variable is used; Shader is slightly modified.
LightningSample-XNA-4.0 (1721) (This requires XNA 4.0 installed)

Game Object Component System

By | Blog, Featured, XNA Games | 10 Comments

Last time i updated with saying that i included a Game Object Component system. I have update this system, so that it uses interfaces instead of overriding virtual methods defined inside the GOComponent base class.

Here is a class diagram of my current state of the GO’s and GOC’s.

The Manager on the Top Left is optional, that is just a helper class to add new GO’s into the game and draw/update them when it is needed.

The following image show’s an object ingame, also don’t forget to visit here once you are done reading.

This object is made of several GOC’s that are attached to one GO. The following list is an overview of the type of GOC’s that are attached to this GO.

  • GOCOnHit – Makes my GO hittable
  • GOCPhysicsObject – Attaches a Physics Body/Geom to the GO
  • GOCTexture – Makes the GO visible for the player (Texture)
  • GOCHealth – Because its hittable, it will need a Health Pool :).

These four GOC’s make up most of my environment objects for now that can be destroyed by the player. All four derive from the GOComponent base class, but only some of them are implementing the Interfaces as you can see on the class diagram. Now when the object will be Hit by another Physics object, the Physics GOC’s will process the collision handler. If the collision is valid, a message will be broadcasted among all the GOC’s and they act according to that specific message. Here is another picture if i keep hammering it with my guns, it explodes when its health reaches zero:

All those green lines and dots around my GO’s come from the Farseer Physics debug viewer. Every Game Object that has a Physics Body attached to it can be debugged this way.

I can post some code if it is needed, but this code will mostly be focused on my needs inside the game. So if you do want to see some code, just post a reply and we will make it work :).

Maladras on Xbox Marketplace

By | Blog, Featured, XNA Games | No Comments

Maladras has been submitted onto the Xbox360 Marketplace for about a month now! It can be found here. I also have found some positive feedback about my game.

Some quotes from other websites:


The Popcap visual style (Zuma, Peggle, etc.) is becoming about as overdone as the neon graphics popularized by Geometry Wars. On the other hand, having a solid graphical reference point in your low budget indie game ain’t such a bad idea. Maladras seems to run with this notion, skipping over artistic merit and focusing on polished and unique puzzle gameplay. It’s a card matching game with a twist, but before you groan, know that Maladras follows through brilliantly. The cards are laid out before you, face up – the trick is that you have to be able to draw a line from one card to the other, and that line can only change direction twice. It’s certainly a little odd, but once you see it in practice it makes sense. (200pts) (Link)


Maladras is a wonderful puzzle game where you must clear the board of matching tiles if an invisible line can be drawn between them. There are 40 levels, and they are split into 5 campaigns each adding a new wrinkle to the gameplay so it feels fresh and new the entire way through. (200pts) (Link)


OK, so now we finally have some decent puzzling in this week’s ocean of crap. It’s a pretty simple tile matching game with a few very well defined rules. Lines between tiles can’t make more than 2 turns and you can take lines outside of the play area. It’s simple to begin with but gets much more complex as environmental hazards, an increasingly unforgiving timer and walls that your line can’t go through are introduced. It’s the kind of simple that I’m more than willing to subscribe to for 200 points, puzzle fans should certainly check it out.

Try It  (Link)


Okay, I’m starting to get a little freaked out now. Maladras takes the basic foundation of a tile matching game, adds in the twist of a line that has to connect the two tiles but can only “bend” twice and… well, it’s good. In fact, it’s astonishingly polished for a game this cheap and one Vincentvsoolen has side-stepped the temptation to price it in line with other titles this polished. It’s a gamble I hope works, as the game really is solid, and should provide a decent distraction for a few hours. Not bad for just 200 Points.


Reading all these review makes me a happy man, because everybody thinks positive about Maladras and thats really good to hear! I just want to thank all these sites for making time to review my game.
I will post some screenshots from the game later on, for now you can view these on the marketplace.