SFML community forums

Help => General => Topic started by: charliesnike on November 23, 2014, 11:47:52 am

Title: Large Procedurally Generated Tile Map From Chunks
Post by: charliesnike on November 23, 2014, 11:47:52 am
I'm building a 2D open-world survival game, and I want to setup a rather large procedurally generated tile map. I've already got a single Chunk setup using the official tutorial about creating your own entities with VertexArrays. I'm looking for some general advice on how to expand this into a large map where individual tiles can be updated and changed so the player can build structures on the map. When I tried to push the size of a chunk much past 32x32 with 32-pixel-wide tiles I was getting a segmentation fault.
Title: Re: Large Procedurally Generated Tile Map From Chunks
Post by: Ixrec on November 23, 2014, 12:42:28 pm
As far as I know nothing in the tutorial's example code imposes a size limit.  The main limitation I'm aware of is the graphics card's maximum texture size, but that's a limitation on the size of the spritesheet, not on the tilemap drawn with the spritesheet.  And even if you hit a limit somewhere, you shouldn't be getting a segmentation fault for no apparent reason.  This sounds like a simple error in your code rather than a conceptual problem.

Can you try to reduce the seg faulting code to a complete and minimal example?  Are you using raw arrays or raw pointers anywhere near the seg fault?