I want to create one large tilemap, and want objects placed on it like multiple blades of grass and trees. I want the tufts of grass and tree objects to be placed based on specific placeholder tiles on the one tile map (to make pathfinding easier). Now, if I were to populate the entire map with these individual objects (especially, individual blades of grass), I feel like it would slow things down and be unsustainable. My thought is that I could review the tiles that are within the scope of the camera view, and add the objects temporarily, so that I'm not filling the entire map with blades of grass or trees, but only the current camera view.

To do this, I would find the camera positions, iterate through the tiles on the tilemap within the camera view, and apply the objects onto said tiles, and delete those objects anytime the camera changes. Is this a reasonable solution to what I want to do, or am I missing something that would make this whole process easier?

  • \$\begingroup\$ As I explain in this Meta post, just about any game development solution that makes enough sense to you to explain to a stranger is worth a try. It has at least the potential to work adequately. And more often than not, the determining factor of whether it meets your needs comes down to details of your implementation - not the high-level description. When you try this, do you encounter any specific hurdle that you need help overcoming, or observe any specific performance problems that we can help you solve? \$\endgroup\$
    – DMGregory
    Aug 1, 2022 at 20:31
  • \$\begingroup\$ Have you profiled your scene to determine that there is actually a performance problem? Are the built-in tilemap culling features not adequate for your game? \$\endgroup\$
    – Kevin
    Aug 1, 2022 at 23:32
  • \$\begingroup\$ @DMGregory This is wise. I will move forward and give it a try! \$\endgroup\$ Aug 2, 2022 at 9:53


You must log in to answer this question.

Browse other questions tagged .