Skip to content
This repository has been archived by the owner on Apr 13, 2024. It is now read-only.

Performance vs Engine

dandeliondino edited this page Jul 7, 2023 · 3 revisions

Introduction

Algorithms that solve problems like autotiles tend to be slow, and neither Godot 4 nor Terrain Autotiler are an exception.

Godot 4's core algorithm iterates over all tiles in the terrain set for every cell in a linear order, so it scales more consistently by the number of cells updated. At least one update is required for each terrain, and layering updates over each other (duplicating cells) are required for better matching and add on to the time.

Terrain Autotiler's speed scales by the cells updated, but also varies significantly by complexity. As expected, single combined updates using set_cells_terrains are faster than updating individual terrain separately via set_cells_terrain_connect. Because it chooses peering terrains deterministically, the tiles chosen are identical.

Terrain Autotiler outperforms Godot 4 across all tested map sizes and complexities, and is more accurate on complex maps. Because it creates hundreds or thousands of objects during an update -- which are known to be slow in GDScript -- improved performance could be expected if porting it to C++.

These benchmark images were saved during GDScript unit tests with Terrain Autotiler 0.2.0 and Godot 4.1-rc3. All use the same Corners and Sides terrain set with 3 terrains.

32x32 cells

Simple

Typical

Complex

64x64 cells

Simple

Typical

Complex

Clone this wiki locally