#How to load a large 2D map (top down view)

1 messages · Page 1 of 1 (latest)

tawdry perch
#

I see a lot of tutorials using TileMap for tilesets to load levels, but what if the maps are hand-drawn and not standard tilesets (like the Sunless Sea screenshot)? What kind of nodes should I use to hold and then render such large 2D maps? And what might be the equivalent approach if one would do it in 3D with the same top down view approach? Thank you!

slow mason
#

from the GridMap documentation:

Internally, a GridMap is split into a sparse collection of octants for efficient rendering and physics processing. Every octant has the same dimensions and can contain several cells.

https://docs.godotengine.org/en/stable/classes/class_gridmap.html#class-gridmap

#

i.e. GridMaps by themselves already use sparse octrees for optimization, which is what you would probably use if you wanted to build, say, a Minecraft clone from scratch. so one solution could be to use a GridMap where each cell is a unique tile, and play with the "octant size" property to fine tune the result. TileMaps have a similar optimization built in

#

or alternatively, you could build a custom solution where the world is divided into "chunks" that are indexed into an efficient spatial data structure like a quadtree or an R-tree. then you query that tree to figure out which chunks need to be instanced at at any given time

ancient cave
#

You could perhaps search for "infinite world godot"

Something like https://youtu.be/FRH6Xdmq6O0 (haven't watched)

👍👍👍 and subscribe for more godot tutorials: https://www.youtube.com/channel/UC2vVVgKKzN-Gb_xeaUY0o-Q?sub_confirmation=1
Check out my best selling AppSec book: https://amzn.to/3pGO4Vz
Check out my behind-the-scenes newsletter: https://www.andrewhoffman.me/newsletter/

In this tutorial learn about GODOT infinite tilemap generation and the process ...

▶ Play video