• entries
707
1173
• views
436339

# Untitled

115 views

Projects are progressing really well. I've completed the new code-base. Took a little bit of doing, but it works correctly now. I also combined it with the DFT code-base (which has graphics, input, and (soon) sound.)

So, now that I have a string manipulation, exception handling, useable math classes, I just have to finish my game systems and I'll be back where I was and ready to roll.

I coded up a tile map system in C#/XNA earlier and I'm in the midst of writing a small article covering it (to put up on OpenXNA.) It's a decent system for only having put a couple of hours into it.

You define a tileset in XML. Information like tile width, tile height, texture, etc. All of the tiles have their tilenumber automatically generated and their values set to default (0 mostly.) Then at the bottom of your XML file, you can override tile information (to setup an animated tile or whatnot.)

For example, here's my test tileset:
"1.0" encoding="utf-8"?>	tileset.png	32	32						1			2			.25			Continuous			false

Since my tileset is 512x512, it auto-generates 256 tiles ((512/16)^2.) Then, I override the index-1 tile to have 2 frames and a frame delay of .25 seconds, an animation loop type of Continuous, and I make it impassable.

The map file is much simpler:
tileset.xml101030 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 5 0 0 0 05 5 5 5 5 5 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 6 0 0 0 06 6 6 6 6 6 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 01 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1

The above is a simple 10x10x3 (Columns x Rows x Layers) map. I think I have the layering backwards so, it just seems odd the way I have it setup (it reads in the layers top to bottom.)

The coolest part (IMHO) is the camera system that I have setup. It's setup to take a camera in the Render() method which specifies the camera's offset in world coordinates as well as a place on-screen to render to. So, I can setup a regular camera and then a mini-map camera that renders to the bottom right corner; call render with the regular camera and the again with the mini-map camera and a scale-factor of 0.25 (Scale is another argument for Render().)

Crap, back to work for me lol.

Edit: Oh, here's a screeny.

## Create an account

Register a new account