Improve chunks, optimization, replace placeholder and more
Co-authored-by: f.fabbrizi <f.fabbrizi@jmpgames.it> Co-committed-by: f.fabbrizi <f.fabbrizi@jmpgames.it>
This commit was merged in pull request #25.
This commit is contained in:
@@ -10,6 +10,19 @@ const ENTITY_SPAWN_ANY: int = 0
|
||||
const ENTITY_SPAWN_HUMANOID_ONLY: int = 1
|
||||
const ENTITY_SPAWN_ANIMAL_ONLY: int = 2
|
||||
|
||||
const CHUNK_GENERATION_FRAME_BUDGET_USEC: int = 1000 #2 ms/frame to generate chunks
|
||||
const CHUNK_CLEANUP_FRAME_BUDGET_USEC: int = 1000 #1 ms/frame per cleanup
|
||||
const LAMPPOST_WIRE_FRAME_BUDGET_USEC: int = 1000 #1 ms/frame per i fili dei lampioni
|
||||
#(about 4 ms o work for frame)
|
||||
#Se compaiono chunk troppo lentamente davanti al treno:
|
||||
#aumentare generazione a 3000 o 4000
|
||||
#Se ci sono micro-scatti:
|
||||
#abbassare generazione a 1000 o 1500
|
||||
#Se i fili appaiono in ritardo:
|
||||
#aumentare wire a 1500 o 2000
|
||||
#Se il cleanup causa scatti:
|
||||
#abbassare cleanup a 500
|
||||
|
||||
const MAX_CHUNK_UNIQUENESS: int = 5
|
||||
const RIVER_SIDE_ORDER: Array[String] = ["north", "est", "south", "west"]
|
||||
const RIVER_DIRECTIONS: Dictionary = {
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
[gd_resource type="Resource" script_class="RailwayPool" format=3 uid="uid://nrm040srfjwo"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cl2ast2tk7ifw" path="res://tgcc/chunk/railway/scene/chunk_railway_curve.tscn" id="1_86h1y"]
|
||||
[ext_resource type="PackedScene" uid="uid://85l80b6jcdhr" path="res://tgcc/chunk/railway/scene/chunk_railway_curve_2.tscn" id="2_r0882"]
|
||||
[ext_resource type="PackedScene" uid="uid://cewdxvcpqb53f" path="res://tgcc/chunk/railway/scene/chunk_railway_station_doubleside.tscn" id="3_3auto"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3pcshw2bioic" path="res://tgcc/chunk/railway/scene/chunk_railway_station_oneside.tscn" id="4_i1umq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bqxpqhla2kogq" path="res://tgcc/chunk/railway/scene/chunk_railway_straight.tscn" id="5_x44at"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3ub6rj0tlt6q" path="res://tgcc/chunk/railway/scene/chunk_railway_straight_2.tscn" id="6_vrrkw"]
|
||||
[ext_resource type="PackedScene" uid="uid://cqevecsd1cm1v" path="res://tgcc/chunk/railway/scene/chunk_railway_straight_3.tscn" id="7_l17bw"]
|
||||
[ext_resource type="PackedScene" uid="uid://f53hfrjaxkwa" path="res://tgcc/chunk/railway/scene/chunk_railway_straight_bridge.tscn" id="8_qcl5o"]
|
||||
[ext_resource type="PackedScene" uid="uid://fi6faw7ag1i0" path="res://tgcc/chunk/railway/scene/chunk_railway_curve_3.tscn" id="8_r0882"]
|
||||
[ext_resource type="PackedScene" uid="uid://dglpoh63x2lpy" path="res://tgcc/chunk/railway/scene/chunk_railway_curve_4.tscn" id="9_3auto"]
|
||||
[ext_resource type="Script" uid="uid://c374rv220mvh1" path="res://core/biome_generator/railway_pool.gd" id="9_8tdc7"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("9_8tdc7")
|
||||
name = "Railway Pool"
|
||||
available_railways = Array[PackedScene]([ExtResource("1_86h1y"), ExtResource("2_r0882"), ExtResource("3_3auto"), ExtResource("4_i1umq"), ExtResource("5_x44at"), ExtResource("6_vrrkw"), ExtResource("7_l17bw"), ExtResource("8_qcl5o")])
|
||||
available_railways = Array[PackedScene]([ExtResource("1_86h1y"), ExtResource("3_3auto"), ExtResource("4_i1umq"), ExtResource("5_x44at"), ExtResource("6_vrrkw"), ExtResource("7_l17bw"), ExtResource("8_qcl5o"), ExtResource("8_r0882"), ExtResource("9_3auto")])
|
||||
|
||||
@@ -73,6 +73,7 @@ fog_density_morning = 0.01
|
||||
fog_density_afternoon = 0.02
|
||||
glow_morning = 0.4
|
||||
glow_night = 0.8
|
||||
enable_fog = true
|
||||
material_fog = SubResource("ShaderMaterial_b5atu")
|
||||
material_drops = SubResource("StandardMaterial3D_r4tfj")
|
||||
material_clouds = SubResource("ShaderMaterial_ruhh7")
|
||||
|
||||
74
core/shader_warmup.gd
Normal file
74
core/shader_warmup.gd
Normal file
@@ -0,0 +1,74 @@
|
||||
extends Node
|
||||
## Autoload — pre-warms custom shaders on startup by rendering each
|
||||
## ShaderMaterial once in a hidden 64×64 viewport.
|
||||
##
|
||||
## StandardMaterial3D is covered by ubershaders (already enabled).
|
||||
## This catches the custom .gdshader materials that ubershaders miss.
|
||||
|
||||
# Paths to all ShaderMaterial .tres files with custom shaders
|
||||
const MATERIAL_PATHS: Array[String] = [
|
||||
"res://core/daynight/environment_dust_material.tres",
|
||||
"res://core/daynight/environment_shadows.tres",
|
||||
"res://core/daynight/godrays.tres",
|
||||
"res://core/daynight/weather_overlay.tres",
|
||||
"res://core/daynight/weather_plain_shader.tres",
|
||||
"res://core/biome_generator/wires.tres",
|
||||
"res://tgcc/chunk/prop/grass/grass_chunk.tres",
|
||||
"res://tgcc/chunk/prop/grass/grass_chunk_weeds.tres",
|
||||
"res://tgcc/chunk/prop/grass/grass_chunk_weeds2.tres",
|
||||
"res://tgcc/chunk/prop/grass/grass_bank.tres",
|
||||
"res://tgcc/chunk/prop/tree/leaves_tree1.tres",
|
||||
"res://tgcc/chunk/prop/tree/leaves_tree_small.tres",
|
||||
"res://tgcc/chunk/prop/tree/trunk.tres",
|
||||
"res://tgcc/chunk/prop/flower/flower.tres",
|
||||
"res://tgcc/chunk/prop/flower/bush.tres",
|
||||
"res://tgcc/chunk/prop/house/house_emissiv.tres",
|
||||
"res://tgcc/chunk/prop/tenda noren/tenda.tres",
|
||||
"res://tgcc/chunk/prop/Tori/Tori.tres",
|
||||
"res://tgcc/chunk/prop/zen garden/zengardenCircle.tres",
|
||||
"res://tgcc/chunk/prop/zen garden/zengarden.tres",
|
||||
]
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
await get_tree().process_frame
|
||||
warmup()
|
||||
|
||||
|
||||
func warmup() -> void:
|
||||
var valid: Array[ShaderMaterial] = []
|
||||
for path in MATERIAL_PATHS:
|
||||
if not ResourceLoader.exists(path):
|
||||
continue
|
||||
var mat := load(path)
|
||||
if mat is ShaderMaterial:
|
||||
valid.append(mat)
|
||||
|
||||
if valid.is_empty():
|
||||
return
|
||||
|
||||
print("[ShaderWarmup] Pre-warming %d custom ShaderMaterials..." % valid.size())
|
||||
|
||||
# Tiny hidden viewport — 64×64 is cheap to render
|
||||
var vp := SubViewport.new()
|
||||
vp.size = Vector2i(64, 64)
|
||||
vp.render_target_update_mode = SubViewport.UPDATE_ALWAYS
|
||||
add_child(vp)
|
||||
|
||||
var cam := Camera3D.new()
|
||||
cam.current = true
|
||||
cam.environment = null
|
||||
vp.add_child(cam)
|
||||
|
||||
var quad := MeshInstance3D.new()
|
||||
quad.mesh = QuadMesh.new()
|
||||
quad.mesh.size = Vector2(1, 1)
|
||||
quad.position = Vector3(0, 0, -2)
|
||||
cam.add_child(quad)
|
||||
|
||||
for mat in valid:
|
||||
quad.material_override = mat
|
||||
await get_tree().process_frame # one frame renders the quad with this material
|
||||
|
||||
vp.queue_free()
|
||||
print("[ShaderWarmup] Done.")
|
||||
1
core/shader_warmup.gd.uid
Normal file
1
core/shader_warmup.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d16jx65gmy20b
|
||||
Reference in New Issue
Block a user