SFML community forums

Help => General => Topic started by: bdens on December 24, 2015, 09:53:00 am

Title: Optimization Help
Post by: bdens on December 24, 2015, 09:53:00 am
Hi,

I'm writing a 2D game similar to Dungeon Keeper.  I have a view that looks at a grid of sprites, and can be scrolled around by the mouse.  I optimized the world view by only drawing sprites that are near the view (or camera if you will). 

I also have a map in the bottom left corner that draws the entire world with a different set of sprites, but which are still representative of what is seen in the main view.  Each map sprite contains 9 pixels, whereas each world sprite contains 48 * 48.  Now, the map sprites and view sprites used to be the same sprites, but I hoped that making a second smaller sprite that was drawn every frame would be less intensive.  I did not see any visual performance increase from the change.  Is that what should be expected? 

Now, the game only modifies one sprite at a time, so it would be very easy to draw the map once and then make a change and draw that change whenever necessary.  But doing that yields some undesirable results, like screen flickering (I actually broke a monitor doing that lol).

Beyond these two options, I'm rather clueless about how to optimize my map drawing process.  Anyone willing to give me some suggestions?
Title: Re: Optimization Help
Post by: Mario on December 24, 2015, 11:14:19 am
How about drawing the map to a render texture and reusing that?

Btw. you can't break actual hardware, no matter what you draw on screen or how often you update. That's most likely been some odd coincidence.