Wednesday, August 17, 2011

A matter of scale

Wow! Has it been a month, already?

Anyway, just as a quick update of my progress, I have made some major changes...

1) New map editor written in C#/XNA. This is speeding things up. Its amazing how much more you can produce when you don't have a slow, clunky editor killing your creative buzz.

2) Shadows! After putting it off for ages, I decided to attempt adding shadows to my HLSL shader code. After 2 days of coding, I finally got it happening...and it was worth the effort!
Basically, the technique I am using is called Shadow Mapping. It is fairly straight forward: Draw the view from the lights' point of view, but only store the depths and store this in a shadow map. Then, draw from the camera's point of view, testing each pixel against the depths in the shadow map. If the light is farther away than the entry in the shadow map for that pixel, then something is closer and it is therefore in shadow.
Of course, this is drawing an extra frame per light. It has reduced my framerate down from 60fps to 25fps for just 10 lights. Not bad for unoptimised code. I have a few tricks up my sleeve to get the framerate back up.

3) I have changed the scale of the game, relative to the player. Previously, I was working on a tile of about 1 metre square. Only one thing can occupy each square (well, 2 things: a block and an actor). It meant that all detail had to be in the model, and I found myself making thin and thick walls, etc. After playing Sega's Spiral Knights, I can see that it is much better to reduce that scale. So, the character models are bigger, filling the square...and the block models are smaller, half the size. Of course, this makes the maps smaller, but I may introduce several maps per map (if that makes sense), such as elevators that take you to the next map. Would also be good for hiding secret areas, etc.

4) I have added a scale attribute to blocks, so I can have the same block as a 1x1 or a 2x2 (or any size really). Will make the game lighter: why draw 4 blocks when I can draw a 2x2.

5) The point of view has changed to be higher. This is so you can see more of what's going on, and to stop the camera being blocked by walls as it will be well above them....it also negates the need to draw ceilings.

Sorry that there are no screenshots for this update because I am working on the final solid version of the first map. The changes have lead me to redesign sections of the game engine (which is a good thing). Some things need a rethink (such as the now 1x4 doorways), and I want to polish things up before releasing screenshots. So, maybe in a day or so....

No comments:

Post a Comment