From 3ac2fb62b67b6446ab31b2455a4cb74069f1c54f Mon Sep 17 00:00:00 2001 From: dusoleil Date: Sun, 18 Sep 2022 07:45:13 -0400 Subject: Add ChunkLoader to World Generation Break up world gen into chunk and offload generating them to a Chunk Loader. The World figures out which chunks should be loaded and gives this to the Chunk Loader. The Chunk Loader frees any chunks out of render distance. It also picks an unloaded chunk and gives it to a worker thread to generate it. --- World.tscn | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'World.tscn') diff --git a/World.tscn b/World.tscn index db93160..3bdf371 100644 --- a/World.tscn +++ b/World.tscn @@ -1,17 +1,24 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://World.gd" type="Script" id=1] [ext_resource path="res://Chunk.tscn" type="PackedScene" id=3] -[sub_resource type="BoxShape" id=23] - [sub_resource type="SphereShape" id=24] -radius = 300.0 +radius = 500.0 + +[sub_resource type="BoxShape" id=23] [node name="World" type="Spatial"] script = ExtResource( 1 ) acceleration = 50.0 +[node name="ChunkRenderDistance" type="Area" parent="."] +collision_layer = 0 +collision_mask = 32 + +[node name="Radius" type="CollisionShape" parent="ChunkRenderDistance"] +shape = SubResource( 24 ) + [node name="Chunks" type="RigidBody" parent="."] collision_layer = 0 collision_mask = 0 @@ -29,11 +36,4 @@ shape = SubResource( 23 ) visible = false collision_layer = 0 -[node name="ChunkRenderDistance" type="Area" parent="."] -collision_layer = 0 -collision_mask = 32 - -[node name="Radius" type="CollisionShape" parent="ChunkRenderDistance"] -shape = SubResource( 24 ) - [connection signal="area_exited" from="ChunkRenderDistance" to="." method="_on_ChunkRenderDistance_area_exited"] -- cgit v1.2.3