Jump to content
  • entries
    707
  • comments
    1173
  • views
    436339

Untitled

Sign in to follow this  
Programmer16

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.xml
10
10
3
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 5 0 0 0 0
5 5 5 5 5 5 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 6 0 0 0 0
6 6 6 6 6 6 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 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.
Sign in to follow this  


1 Comment


Recommended Comments

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!