SFML community forums
Help => Graphics => Topic started by: etixpp on July 19, 2013, 05:16:25 pm
-
Hello, i have created a map, well its 3200x8000 and as i thought it lags as fuck :/
The problem with the tilemap is that is created out of 30 tilesets and alone the .txt file which has the coordinates for the tilemaps is 1,7 Mb >_<
I just tried to insert the image with this:
sf::Texture testx;
if (!testx.loadFromFile("brunnen3.png"))
{
std::cerr << "PlayerTexture could not load.";
}
sf::Sprite Testxy;
Testxy.setTexture(testx);
window.draw(Testxy);
into the window but it lags as fuck, even if i make it on a 1700*3000 image or sth... anyone got a idea?
http://s1.directupload.net/images/130719/firesigx.png
-
o.0 that is a lot of tiles... Can the player see all these tiles are once? or is this the 'zoomed' out version?
If the world is more zoomed in, you are going to want to only draw what the player can see.
-
What's the point of tiles if you display one huge image?
Anyway, I'm not sure I understand your message. ^^
-
What I'm trying to say is you are drawing a lot of tiles. If your map size is 3200x8000 and each tile is 16x16 ( I'm guessing here), that would mean there's 100,000+ tiles that are getting drawn every single frame. I would expect it to run very slow at this point. You need to make less draw calls.
-
If your problem is with the actual size of the texture, you could look into Thor's BigTexture and BigSprite class.
If the problem is with the slowness due to too many draw calls, try using vertex arrays.
If it's a mixture, you'll have to look into your own solution. Split the texture into multiples and use multiple vertex arrays (one for each texture), try to sort it as needed, only draw what's visible, etc. :)
Also a more descriptive explanation would be helpful. ;)