Yogoda / ZoneLoadingSystem

Dynamic zone loading system for Godot
Creative Commons Zero v1.0 Universal
221 stars 12 forks source link
godot godot-engine

Disclaimer: This was for Godot 3 and is not maintained anymore

Zone Loading System

This template shows you how your game can automatically load/unload zones according to your player position. By implementing this template in your game you can have a seamless world as big as needed, without loading screens.

This works for both 2D games and 3D games, try the demo by executing this project.

Note that it is not a chunk system based on distance to the player, if you need chunks loading for an open world, please check other solutions.

Test image

Pros

Cons

How does it work ?

The geometry/sprites of each zone sits inside an area node that should encompass all the zone geometry/sprites. The zones areas should be overlapping.

Rules:

Background loading

All the loading and instancing is done by one background thread that runs parallel to the main game, so it should not create stutters, please check "background_loader.gd".

The thread is automatically started at the start of the game, and stopped at the end. Stopping the thread can take a few seconds if the thread is currently loading data.

Configure the player

Add a new zone

Done. Now the zone will be loaded, instanced and attached to the tree automatically by the system.

Known issues

Stutter when a new zone is attached to the tree

Error: _body_enter_tree: Condition "!E" is true (fixed in Godot 3.4 beta 4!).

Objects/monsters are reset when going back

Contribute

You can leave comments here: https://github.com/Yogoda/ZoneLoadingSystem/issues/3

You are free to submit issues, contribute and improve this template, this is a Creative Commons

Big thanks to rmvermeulen, Wrzlprnft and jbpuryear for their contributions!

Test image