Added chunk spawn range, and chunk lod falloff (this is where lod level 0 changes to lod level 1) to the settings, and increased spawn height so mountains are not cut off anymore, and a few small tweaks. Also updated Voxelman to get the lod falloff property.

This commit is contained in:
Relintai 2020-08-03 19:13:17 +02:00
parent 1e264ec9c8
commit 4e3e9d4bbf
8 changed files with 107 additions and 17 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "bc2ee7171a29d02a4687eaddd91374e127cf2b88"}, "entity_spell_system": {"master": "0ac9a8770e1855613bdfbffc5c5e0095a2058717"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "768728139ede479dad006913e2f86d3f85edae57"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "a9bab9896de71966b9c9056869871e618c64cba7"}, "procedural_animations": {"master": "8426e2c976e9f9cb82bca636c0ec6e79ad7b3bcb"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "0ed644e4a4e7867a49fbe7c727b500305f7077f8"}, "mesh_utils": {"master": "65a802ff39a601bd1a55675023871e09500943ef"}, "broken_seals_module": {"master": "8c4b32d3932ccb043b8f6c92c1277547750fe391"}, "thread_pool": {"master": "164ad82feb05842cb944c2907b65e521f8c7c465"}}
{"engine": {"3.2": "36b746d90393299b81ecb991f4aa94a8d742fd11", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "2b17341ac2b22d766d6f90426f161f04d9ddc599"}, "entity_spell_system": {"master": "65782c63d5e9fea43ce32701af6fe1c97f0bf0a6"}, "ui_extensions": {"master": "ca7df8435154d1146be36c4fc97e6cc7092d3eb9"}, "voxelman": {"master": "b95f055acd4fe5032f5f24008ff238a59810672f"}, "texture_packer": {"master": "f98b7410cd3f2a743cb57456910ad9f93ef89937"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "a9bab9896de71966b9c9056869871e618c64cba7"}, "procedural_animations": {"master": "8426e2c976e9f9cb82bca636c0ec6e79ad7b3bcb"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "0ed644e4a4e7867a49fbe7c727b500305f7077f8"}, "mesh_utils": {"master": "65a802ff39a601bd1a55675023871e09500943ef"}, "broken_seals_module": {"master": "8c4b32d3932ccb043b8f6c92c1277547750fe391"}, "thread_pool": {"master": "164ad82feb05842cb944c2907b65e521f8c7c465"}}

View File

@ -584,11 +584,14 @@ max_concurrent_generations = 1
library = ExtResource( 17 )
level_generator = SubResource( 1 )
voxel_scale = 1.6
chunk_spawn_range = 1
chunk_spawn_range = 2
build_flags = 255
chunk_lod_falloff = 1
script = ExtResource( 16 )
show_loading_screen = false
generate_on_ready = true
spawn_height = 2
use_global_chunk_settings = false
[node name="WorldEnvironment" type="WorldEnvironment" parent="World"]
environment = SubResource( 3 )

View File

@ -207,6 +207,11 @@ profiles/automatic_save=true
level/max_character_level=60
level/max_class_level=60
[game]
chunk_lod_falloff=2
chunk_spawn_range=8
[importer_defaults]
texture_array={

View File

@ -42,6 +42,10 @@ var _settings : Dictionary = {
"use_vsync" : ProjectSettings.get("display/window/vsync/use_vsync"),
"vsync_via_compositor" : ProjectSettings.get("display/window/vsync/vsync_via_compositor"),
},
"game" : {
"chunk_spawn_range" : ProjectSettings.get("game/chunk_spawn_range"),
"chunk_lod_falloff" : ProjectSettings.get("game/chunk_lod_falloff"),
},
"ui" : {
"touchscreen_mode" : OS.has_touchscreen_ui_hint(),
"ui_scale" : ProjectSettings.get("display/window/size/ui_scale"),

View File

@ -122,6 +122,35 @@ property_category = "rendering"
property_name = "vsync_via_compositor"
property_label = "VSync Via Compositor"
[node name="Game" type="VBoxContainer" parent="PanelContainer/VBoxContainer/TabContainer"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 31.0
margin_right = -4.0
margin_bottom = -4.0
size_flags_horizontal = 3
[node name="OptionsSpinboxRow" parent="PanelContainer/VBoxContainer/TabContainer/Game" instance=ExtResource( 8 )]
margin_top = 0.0
margin_bottom = 24.0
property_category = "game"
property_name = "chunk_spawn_range"
property_label = "Chunk Spawn Range"
min_value = 2.0
max_value = 30.0
step = 1.0
[node name="OptionsSpinboxRow2" parent="PanelContainer/VBoxContainer/TabContainer/Game" instance=ExtResource( 8 )]
margin_top = 32.0
margin_bottom = 56.0
property_category = "game"
property_name = "chunk_lod_falloff"
property_label = "Chunk Lod Falloff"
max_value = 30.0
step = 1.0
[node name="Interface" type="VBoxContainer" parent="PanelContainer/VBoxContainer/TabContainer"]
visible = false
anchor_right = 1.0

View File

@ -11,7 +11,15 @@ script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
property_category = ""
property_name = ""
property_label = ""
min_value = 0.0
max_value = 100.0
step = 0.0
rounded = true
prefix = ""
suffix = ""
[node name="Label" type="Label" parent="."]
margin_top = 5.0

File diff suppressed because one or more lines are too long

View File

@ -30,6 +30,10 @@ export(bool) var editor_generate : bool = false setget set_editor_generate, get_
export(bool) var show_loading_screen : bool = true
export(bool) var generate_on_ready : bool = false
export(int) var spawn_height : int = 5
export(bool) var use_global_chunk_settings : bool = true
export(PropData) var test_prop : PropData
var initial_generation : bool = true
@ -48,9 +52,32 @@ var _max_frame_chunk_build_temp : int
var rc : int = 0
func _enter_tree():
if !Engine.is_editor_hint() && use_global_chunk_settings:
Settings.connect("setting_changed", self, "on_setting_changed")
Settings.connect("settings_loaded", self, "on_settings_loaded")
if Settings.loaded:
on_settings_loaded()
if generate_on_ready and not Engine.is_editor_hint():
# call_deferred("generate")
generate()
func on_setting_changed(section, key, value):
if section == "game":
if key == "chunk_spawn_range":
chunk_spawn_range = value
if key == "chunk_lod_falloff":
chunk_lod_falloff = value
func on_settings_loaded():
chunk_spawn_range = Settings.get_value("game", "chunk_spawn_range")
chunk_lod_falloff = Settings.get_value("game", "chunk_lod_falloff")
vis_update += VIS_UPDATE_INTERVAL
func generate():
if level_generator != null:
@ -72,7 +99,7 @@ func _process(delta):
if vis_update >= VIS_UPDATE_INTERVAL:
vis_update = 0
var ppos : Vector3 = _player.get_transform_3d().origin
var ppos : Vector3 = _player.get_body_3d().transform.origin
var cpos : Vector3 = ppos
var ppx : int = int(cpos.x / (chunk_size_x * voxel_scale))
@ -114,9 +141,15 @@ func _process(delta):
i += 1
for x in range(-chunk_spawn_range + int(cpos.x), chunk_spawn_range + int(cpos.x)):
for z in range(-chunk_spawn_range + int(cpos.z), chunk_spawn_range + int(cpos.z)):
for y in range(-1, 2):
for x in range(int(cpos.x) - chunk_spawn_range, chunk_spawn_range + int(cpos.x)):
for z in range(int(cpos.z) - chunk_spawn_range, chunk_spawn_range + int(cpos.z)):
var l : float = (Vector2(cpos.x, cpos.z) - Vector2(x, z)).length()
if l > chunk_spawn_range:
continue
for y in range(-1 + cpos.y, spawn_height + cpos.y):
if not has_chunk(x, y, z):
# print("spawn " + str(Vector3(x, y, z)))
create_chunk(x, y, z)
@ -179,10 +212,18 @@ func spawn(start_x : int, start_y : int, start_z : int) -> void:
if not Engine.editor_hint:
_max_frame_chunk_build_temp = max_frame_chunk_build_steps
max_frame_chunk_build_steps = 0
var spv : Vector2 = Vector2(start_x, start_z)
for x in range(-chunk_spawn_range + start_x, chunk_spawn_range + start_x):
for z in range(-chunk_spawn_range + start_z, chunk_spawn_range + start_z):
for y in range(-1 + start_y, 2 + start_y):
for x in range(start_x - chunk_spawn_range, chunk_spawn_range + start_x):
for z in range(start_z - chunk_spawn_range, chunk_spawn_range + start_z):
var l : float = (spv - Vector2(x, z)).length()
if l > chunk_spawn_range:
continue
for y in range(-1 + start_y, spawn_height + start_y):
create_chunk(x, y, z)
# add_prop(Transform().translated(Vector3(0, 2, 0)), test_prop)