Skip to main content
gamedev.net
🔒 Locked

Tile pointer's / Tile painting method

Started by KyleL 1 reply 600+ views
Original Post
KyleL
KyleL
I’ve got a question here that’s not directly related to the isometric view although the game I am working on is isometric so I decided to ask you nice folks. Ok well, this isn’t exactly my first game using direct draw or even the isometric view but yet I’ve got a rather basic question. My question is asking for theory and no more so take a shot at it if you feel upto it. If you’re using many hundreds of tiles for a game and dynamic maps with dynamic tiles and all that how do you keep track of the surfaces for the tiles? See, I was thinking of some sort of array of my own type. Have one thing for the tile ID and one for the pointer to that tiles surface. But to me this has a major flaw that I would hope someone has a way around. See, this method has to search the array everytime it wants to paint a tile. When thinking about it, this game has mutliple levels so it will be passing by and drawing tiles on the screen more than once and I’m also using rather small tiles for my screen resolution in the game; 64x32 / 800x600. So there will be a lot of tiles being painted on here. One good thing about the array method idea of mine is that the surfaces are created in an importance level. The tiles used most often would be at the top of the array while the ones used left often would be at the bottom. The only time this isn’t true is when a tile already exists in the array that needs to be reloaded for the next section. Another good thing about the array is that I am using rather large maps and realize all of my tiles aren’t going to be used all the time. For this reason I’ll be making the code cut the map into sections and load only the tiles needed for the section of the map the user is on. While these last two things aren’t exactly good things about using the array they do offer hope of speeding it up a little. What do you guys think about the array method I’ve come up with for keeping track of the tiles? Happen to know of any other methods that may be faster? I would appreciate any feedback on this post. Thanks, Kyle LaDuke
KyleL
KyleL
Well I see how that idea of mine could work and possibly not be to bad. If the surfaces array was split up into one array per layer; not leaning like one for each level but group types.. for example floor would hold for both the floor of level one and level two in height. Then possible depending how many tiles I end up having in each array split them up into even more depending upon if the tile ID is over or under a number.. unlike the other splitting of array this would would cause an extra if statement but it could be faster depending on the amount of tiles loaded in each.

With these improvements I suspect this idea will work out fine. But don''t ride it off as I''ve solved it yet because I really have no idea and haven''t messed with makes that werent actually hard coded or atleast the tiles werent hard coded.

I''m waiting around for some feedback before I begin so if you think its good or bad let me know. If bad I''d appreceiate a comment or two, possibly the theory, behind a better way.

Thanks again,
Kyle LaDuke
Jason Zelos
Jason Zelos
Why would you have to search the array for a tile ?

Just get the indices from your map and use Graphics[Index].Surface.

If you need to add/delete tiles from your surface list like when moving levels, thats not really a problem since your map indices are only relevant to that levels tileset.

,Jay

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.