Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: TileMap Problem with 30,000,000 tiles  (Read 1876 times)

0 Members and 1 Guest are viewing this topic.

josephdetor

  • Guest
TileMap Problem with 30,000,000 tiles
« on: May 20, 2019, 01:07:47 pm »
I am making a maze game.

I got a problem showing 30,000,000 tiles at the same time, it slow a lot the rendering process, it take 0.6 seconds for each frames.

My maze is composed of 2 sprite, one yellow and one blue. What decide the position of everything is a std::vector<std::vector<sf::Color>>. I draw everything by reference to the 2 existing sprite without copy of any kind. Even more, i only draw what can be seen by the view. But i have to test every sprite to know if they can be seen.

I would like to know if there are way to keep up 60 fps while been able to differentiate each tile programmatically.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: TileMap Problem with 30,000,000 tiles
« Reply #1 on: May 20, 2019, 10:53:44 pm »
What do you need 30M tiles for exactly?

Despite that number, your processor will have no problem traversing that set if data.
However when it comes to drawing, you're losing massive amount of time by making a draw call per tile. Instead use a vertex buffer (or vertex array).

As for reducing the need for iterating over everything. By using a quad tree or similar structures, you should be able to further reduce whatever checks you're doing.

Abd finally, don't forget that a 4K screen has only about 8-9M pixels. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything