Jump to content
  • Advertisement
Sign in to follow this  
SonicD007

Tiled Map redraw resource hog

This topic is 2504 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone, so I've been working on a level editor and it's going well so far. I have a huge performance problem though. When I need to redraw only one tile of the map, I'm drawing the entire map over again to "refresh" that one tile. When the map is small (say 2x2) you don't notice the performance drop because it only has to draw 4 tiles, but at 15x15, the program slows down considerably. How would I get around this performance issue? It's redrawing the map by going through my Lists to get which tile is at x y location, clipping that image from the source image, and drawing that clipped image at x,y location.

Right now when the mouse cursor hovers over a tile, I'm drawing a Rectangle to show which tile is going to be selected. When the mouse moves to another tile, the whole map gets redrawn and the program lags behind.

Any ideas on how to fix this?

Share this post


Link to post
Share on other sites
Advertisement
Just redraw the tile that changed. You never want to redraw the whole screen unless everyhting has changed. If it is just one tile, then just redraw the tile at that location.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!