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

Author Topic: Combining sf::VertexArray with chunking ?  (Read 364 times)

0 Members and 1 Guest are viewing this topic.


  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Combining sf::VertexArray with chunking ?
« on: June 13, 2024, 11:25:53 am »
I've been wondering how to approach this problem. I currently have tilemap loaded from Ldtk, it uses one big VertexArray to render entire map. This is fine for now since map size is 256x256 tiles. But this would be good moment to implement some kind of chunking. I'm not sure how do combine chunking with VertexArray. Should each chunk have it's own VertexArray ? But then I would need to render 9 smaller vertex arrays for all chunks surrounding player instead of one big array. Or should I have one vertex array and somehow change it's content based on what chunks are currently supposed to be rendered ? Or is there other solution ?


  • SFML Team
  • Hero Member
  • *****
  • Posts: 10936
    • View Profile
    • development blog
    • Email
Re: Combining sf::VertexArray with chunking ?
« Reply #1 on: June 13, 2024, 12:54:43 pm »
Unless you're already seeing performance issues, I'd currently not worry about it and build the rest of the game first. There are enough challenges ahead, getting hung up on an optimization that isn't currently causing an issue, might just slow you down too much.

There isn't necessarily just one possibility.
The simplest approach would probably be to keep a VA per chunk.
But you could also dynamically stitch together multiple chunks into one VA. It's a question of memory usage vs performance.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
Dev Blog: https://duerrenberger.dev/blog/