RTS tile editor

Started by
0 comments, last by markr 18 years, 7 months ago
I'm trying to make a tile editor for a 2D RTS game using Direct x. I'm looking for some suggestions on what's the best way to set up the tile. My plan is to make an array of tile structure which will have an int for the tile texture, 8 tile pointers that points to the surrounding tiles (for AI pathfinding), and a flag to check if it's walkable etc. Any comments or suggestions will be appriciated, and btw, what's the best way to scroll the tiles?
Advertisement
The way you represent your map is entirely independent of either the type of game you're building (i.e. RTS) or what you're using to render your graphics (Direct x).

Personally I'd recommend that you don't store the texture on the tile, rather store some information telling you what sort of tile it is to the game, then look up based on some rules what sort of texture you might need to represent that.

It's redundant to store 8 pointers to the surrounding tiles as you can trivially determine where they are by adding / subtracting one from the x and y coordinates.

Tiles don't *really* scroll, you simply set up your frustum so it only shows visible ones, i.e. cull ones which are out of view. To make it appear to scroll, either you write a transformation function to transform world coordinates into screen coordinates, or you let your rendering hardware do that for you, and call whatever functions necessary to set up this transformation there.

As far as editing the tilemap itself and loading / saving, have you considered:
- Use a pixel drawing program with one tile per pixel
- Use a text editor and have different characters for different tiles
- Use an existing third party tile editor (there are many free ones)

All of which will save you effort over writing your own (and probably have more features, like copy / paste and undo)

Mark

This topic is closed to new replies.

Advertisement