Efficient Terrain Generation
Amoria Game Jam 14 » Devlog
I was thinking about how the terrain generation was taking a long time, and I had an idea! The old implementation used a Ɵ(n²). But I had an idea for one with a Ɵ(nlog(n)) implementation. Basically, it performs BFT (Breadth-first-traversal) of the map during generation. It starts with a queue with the coordinates of all of the positions in the map, then every time it changes a tile, it enqueues it and it’s neighbors back into the queue, that way, it only processes tiles that have a non-zero chance of changing in subsequent passes. It can still run in O(n²) buut, the average is much better. In fact, it runs almost twice as fast as the origin implementation (0.1s vs 0.06s).
Files
amoria.zip 1.1 MB
Jan 26, 2024
Get Amoria Game Jam 14
Download NowName your own price
Leave a comment
Log in with itch.io to leave a comment.