-World Environment Mess Arounds

-Player Height Change
-Altar Sky Video Import Test
-Manually Changed Shading On for a few materials on Altar that weren't switched over
This commit is contained in:
Pal
2025-09-09 03:33:10 -07:00
parent 4f1251d402
commit 09abd588c2
11 changed files with 287 additions and 137 deletions

View File

@@ -10,10 +10,10 @@ public partial class Main : Node
{ {
public override void _Ready() public override void _Ready()
{ {
// If we don't need to run tests, we can just switch to the game scene. // If we don't need to run tests, we can just switch to the game scene.
CallDeferred("RunScene"); CallDeferred("RunScene");
} }
private void RunScene() private void RunScene()
=> GetTree().ChangeSceneToFile("res://src/app/App.tscn"); => GetTree().ChangeSceneToFile("res://src/app/App.tscn");
} }

View File

@@ -41,77 +41,77 @@ public partial class Map : Node3D, IMap
public void OnResolved() public void OnResolved()
{ {
MapChunk = new SaveChunk<MapData>( MapChunk = new SaveChunk<MapData>(
onSave: (chunk) => new MapData() onSave: (chunk) => new MapData()
{ {
FloorScenes = FloorScenes, FloorScenes = FloorScenes,
}, },
onLoad: (chunk, data) => onLoad: (chunk, data) =>
{ {
FloorScenes = data.FloorScenes; FloorScenes = data.FloorScenes;
} }
); );
GameChunk.AddChunk(MapChunk); GameChunk.AddChunk(MapChunk);
this.Provide(); this.Provide();
InitializeMapData(); InitializeMapData();
} }
public void InitializeMapData() public void InitializeMapData()
{ {
ClearMap(); ClearMap();
FloorScenes = []; FloorScenes = [];
foreach (var floor in _floors) foreach (var floor in _floors)
FloorScenes.Add(floor.ResourcePath); FloorScenes.Add(floor.ResourcePath);
CurrentFloorNumber.OnNext(0); CurrentFloorNumber.OnNext(0);
} }
public void LoadMap() public void LoadMap()
{ {
LoadFloor(); LoadFloor();
CurrentFloor.InitializeDungeon(); CurrentFloor.InitializeDungeon();
var transform = GetPlayerSpawnPosition(); var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform); Player.TeleportPlayer(transform);
CurrentFloor.FloorIsLoaded = true; CurrentFloor.FloorIsLoaded = true;
} }
private void ClearMap() private void ClearMap()
{ {
CurrentFloor?.CallDeferred(MethodName.QueueFree, []); CurrentFloor?.CallDeferred(MethodName.QueueFree, []);
} }
public void SpawnNextFloor() public void SpawnNextFloor()
{ {
ClearMap(); ClearMap();
LoadFloor(); LoadFloor();
CurrentFloor.InitializeDungeon(); CurrentFloor.InitializeDungeon();
var transform = GetPlayerSpawnPosition(); var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform); Player.TeleportPlayer(transform);
CurrentFloor.FloorIsLoaded = true; CurrentFloor.FloorIsLoaded = true;
CurrentFloorNumber.OnNext(CurrentFloorNumber.Value + 1); CurrentFloorNumber.OnNext(CurrentFloorNumber.Value + 1);
} }
public IDungeonRoom GetPlayersCurrentRoom() public IDungeonRoom GetPlayersCurrentRoom()
{ {
var rooms = CurrentFloor.Rooms; var rooms = CurrentFloor.Rooms;
var playersRoom = rooms.SingleOrDefault(x => x.IsPlayerInRoom); var playersRoom = rooms.SingleOrDefault(x => x.IsPlayerInRoom);
return playersRoom; return playersRoom;
} }
public Transform3D GetPlayerSpawnPosition() => CurrentFloor.GetPlayerSpawnPoint(); public Transform3D GetPlayerSpawnPosition() => CurrentFloor.GetPlayerSpawnPoint();
public void LoadFloor() public void LoadFloor()
{ {
ClearMap(); ClearMap();
var currentFloorScene = FloorScenes.First(); var currentFloorScene = FloorScenes.First();
var instantiator = new Instantiator(GetTree()); var instantiator = new Instantiator(GetTree());
var loadedScene = instantiator.LoadAndInstantiate<Node3D>(currentFloorScene); var loadedScene = instantiator.LoadAndInstantiate<Node3D>(currentFloorScene);
AddChild(loadedScene); AddChild(loadedScene);
CurrentFloor = (IDungeonFloor)loadedScene; CurrentFloor = (IDungeonFloor)loadedScene;
FloorScenes.Remove(currentFloorScene); FloorScenes.Remove(currentFloorScene);
var transform = GetPlayerSpawnPosition(); var transform = GetPlayerSpawnPosition();
Player.TeleportPlayer(transform); Player.TeleportPlayer(transform);
} }
} }

View File

@@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://14e8mu48ed4" path="res://src/map/Map.cs" id="1_bw70o"] [ext_resource type="Script" uid="uid://14e8mu48ed4" path="res://src/map/Map.cs" id="1_bw70o"]
[ext_resource type="PackedScene" uid="uid://bh8wgd536f317" path="res://src/map/dungeon/debug_floors/DebugFloor03.tscn" id="2_0qcd2"] [ext_resource type="PackedScene" uid="uid://bh8wgd536f317" path="res://src/map/dungeon/debug_floors/DebugFloor03.tscn" id="2_0qcd2"]
[ext_resource type="PackedScene" uid="uid://bep0gljnsdmwl" path="res://src/map/dungeon/debug_floors/DebugFloor01.tscn" id="2_00xd7"] [ext_resource type="PackedScene" uid="uid://dl6h1djc27ddl" path="res://src/map/dungeon/floors/Floor00.tscn" id="2_ne2vg"]
[ext_resource type="PackedScene" uid="uid://8oiglrv8q818" path="res://src/map/dungeon/debug_floors/DebugFloor02.tscn" id="3_v14r0"] [ext_resource type="PackedScene" uid="uid://8oiglrv8q818" path="res://src/map/dungeon/debug_floors/DebugFloor02.tscn" id="3_v14r0"]
[ext_resource type="PackedScene" uid="uid://bpqm38kxonb35" path="res://src/map/dungeon/debug_floors/DebugFloor04.tscn" id="5_ne2vg"] [ext_resource type="PackedScene" uid="uid://bpqm38kxonb35" path="res://src/map/dungeon/debug_floors/DebugFloor04.tscn" id="5_ne2vg"]
[ext_resource type="PackedScene" uid="uid://5ja3qxn8h7iw" path="res://src/map/dungeon/rooms/Set A/15. Boss Floor A.tscn" id="6_abpbr"] [ext_resource type="PackedScene" uid="uid://5ja3qxn8h7iw" path="res://src/map/dungeon/rooms/Set A/15. Boss Floor A.tscn" id="6_abpbr"]
@@ -13,6 +13,6 @@
[node name="Map" type="Node3D"] [node name="Map" type="Node3D"]
script = ExtResource("1_bw70o") script = ExtResource("1_bw70o")
_floors = Array[PackedScene]([ExtResource("2_00xd7"), ExtResource("3_v14r0"), ExtResource("2_0qcd2"), ExtResource("5_ne2vg"), ExtResource("6_abpbr"), ExtResource("7_caf7v"), ExtResource("8_y74f3"), ExtResource("9_dbqu2"), ExtResource("10_xcm54")]) _floors = Array[PackedScene]([ExtResource("2_ne2vg"), ExtResource("3_v14r0"), ExtResource("2_0qcd2"), ExtResource("5_ne2vg"), ExtResource("6_abpbr"), ExtResource("7_caf7v"), ExtResource("8_y74f3"), ExtResource("9_dbqu2"), ExtResource("10_xcm54")])
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="WorldEnvironment" type="WorldEnvironment" parent="."]

View File

@@ -24,40 +24,40 @@ public partial class DungeonFloor : Node3D, IDungeonFloor
public void InitializeDungeon() public void InitializeDungeon()
{ {
Rooms = []; Rooms = [];
Rooms = FindAllDungeonRooms([.. GetChildren()], Rooms); Rooms = FindAllDungeonRooms([.. GetChildren()], Rooms);
_playerSpawnPoint = RandomizePlayerSpawnPoint(); _playerSpawnPoint = RandomizePlayerSpawnPoint();
var monsterRooms = Rooms.OfType<MonsterRoom>(); var monsterRooms = Rooms.OfType<MonsterRoom>();
foreach (var room in monsterRooms) foreach (var room in monsterRooms)
room.SpawnEnemies(EnemyDatabase); room.SpawnEnemies(EnemyDatabase);
DungeonGenerator.EmitSignal("done_generating"); DungeonGenerator.EmitSignal("done_generating");
} }
public Transform3D GetPlayerSpawnPoint() => new Transform3D(_playerSpawnPoint.Basis, new Vector3(_playerSpawnPoint.Origin.X, -1.75f, _playerSpawnPoint.Origin.Z)); public Transform3D GetPlayerSpawnPoint() => new Transform3D(_playerSpawnPoint.Basis, new Vector3(_playerSpawnPoint.Origin.X, -1.75f, _playerSpawnPoint.Origin.Z));
private Transform3D RandomizePlayerSpawnPoint() private Transform3D RandomizePlayerSpawnPoint()
{ {
var randomSpawnLocations = Rooms var randomSpawnLocations = Rooms
.OfType<MonsterRoom>() .OfType<MonsterRoom>()
.Select(x => x.PlayerSpawn); .Select(x => x.PlayerSpawn);
var godotCollection = new Godot.Collections.Array<Marker3D>(randomSpawnLocations); var godotCollection = new Godot.Collections.Array<Marker3D>(randomSpawnLocations);
var result = godotCollection.PickRandom(); var result = godotCollection.PickRandom();
return result.GlobalTransform; return result.GlobalTransform;
} }
private static ImmutableList<IDungeonRoom> FindAllDungeonRooms(List<Node> nodesToSearch, ImmutableList<IDungeonRoom> roomsFound) private static ImmutableList<IDungeonRoom> FindAllDungeonRooms(List<Node> nodesToSearch, ImmutableList<IDungeonRoom> roomsFound)
{ {
if (nodesToSearch.Count == 0) if (nodesToSearch.Count == 0)
return roomsFound; return roomsFound;
foreach (var node in nodesToSearch) foreach (var node in nodesToSearch)
{ {
if (node is IDungeonRoom dungeonRoom) if (node is IDungeonRoom dungeonRoom)
roomsFound = roomsFound.Add(dungeonRoom); roomsFound = roomsFound.Add(dungeonRoom);
if (node.HasSignal("dungeon_done_generating")) if (node.HasSignal("dungeon_done_generating"))
node.EmitSignal("dungeon_done_generating"); node.EmitSignal("dungeon_done_generating");
} }
return FindAllDungeonRooms(nodesToSearch.SelectMany(x => x.GetChildren()).ToList(), roomsFound); return FindAllDungeonRooms(nodesToSearch.SelectMany(x => x.GetChildren()).ToList(), roomsFound);
} }
} }

View File

@@ -23,15 +23,15 @@ public partial class Floor0 : Node3D, IDungeonFloor
public override void _Ready() public override void _Ready()
{ {
Show(); Show();
Exit.AreaEntered += Exit_AreaEntered; Exit.AreaEntered += Exit_AreaEntered;
FloorIsLoaded = true; FloorIsLoaded = true;
} }
private void Exit_AreaEntered(Area3D area) private void Exit_AreaEntered(Area3D area)
{ {
if (area.GetOwner() is IPlayer) if (area.GetOwner() is IPlayer)
ExitReached(); ExitReached();
} }
public void ExitReached() => Game.FloorExitReached(); public void ExitReached() => Game.FloorExitReached();

View File

@@ -1,4 +1,4 @@
using Chickensoft.AutoInject; using Chickensoft.AutoInject;
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Godot; using Godot;
using System.Collections.Immutable; using System.Collections.Immutable;
@@ -22,21 +22,21 @@ public partial class Overworld : Node3D, IDungeonFloor
public void InitializeDungeon() public void InitializeDungeon()
{ {
Show(); Show();
Exit.AreaEntered += Exit_AreaEntered; Exit.AreaEntered += Exit_AreaEntered;
FloorIsLoaded = true; FloorIsLoaded = true;
} }
private void Exit_AreaEntered(Area3D area) private void Exit_AreaEntered(Area3D area)
{ {
if (area.GetOwner() is IPlayer) if (area.GetOwner() is IPlayer)
ExitReached(); ExitReached();
} }
public void ExitReached() => Game.FloorExitReached(); public void ExitReached() => Game.FloorExitReached();
public Transform3D GetPlayerSpawnPoint() public Transform3D GetPlayerSpawnPoint()
{ {
return PlayerSpawnPoint.GlobalTransform; return PlayerSpawnPoint.GlobalTransform;
} }
} }

View File

@@ -0,0 +1,25 @@
[gd_resource type="VisualShader" load_steps=3 format=3 uid="uid://bl4n1pe2c1l07"]
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_2ykon"]
input_name = "time"
[sub_resource type="VisualShaderNodeTexture3D" id="VisualShaderNodeTexture3D_iqpgl"]
[resource]
code = "shader_type sky;
void sky() {
}
"
graph_offset = Vector2(-173.47, -138.662)
mode = 3
flags/use_half_res_pass = false
flags/use_quarter_res_pass = false
flags/disable_fog = false
flags/use_debanding = false
nodes/sky/2/node = SubResource("VisualShaderNodeInput_2ykon")
nodes/sky/2/position = Vector2(320, 40)
nodes/sky/3/node = SubResource("VisualShaderNodeTexture3D_iqpgl")
nodes/sky/3/position = Vector2(20, 40)

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=20 format=3 uid="uid://dmiqwmivkjgmq"] [gd_scene load_steps=21 format=3 uid="uid://dmiqwmivkjgmq"]
[ext_resource type="Script" uid="uid://b1x125h0tya2w" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_afeds"] [ext_resource type="Script" uid="uid://b1x125h0tya2w" path="res://addons/SimpleDungeons/DungeonGenerator3D.gd" id="1_afeds"]
[ext_resource type="PackedScene" uid="uid://dpec2lbt83dhe" path="res://src/map/dungeon/rooms/Set A/03. Antechamber A.tscn" id="3_7txs6"] [ext_resource type="PackedScene" uid="uid://dpec2lbt83dhe" path="res://src/map/dungeon/rooms/Set A/03. Antechamber A.tscn" id="3_7txs6"]
@@ -27,6 +27,44 @@ geometry_collision_mask = 2147483648
agent_height = 2.0 agent_height = 2.0
region_min_size = 8.0 region_min_size = 8.0
[sub_resource type="Environment" id="Environment_sn0iw"]
background_mode = 1
background_energy_multiplier = 0.73
background_camera_feed_id = 3
ambient_light_source = 2
ambient_light_color = Color(1, 1, 1, 1)
ambient_light_energy = 0.16
reflected_light_source = 1
ssr_fade_in = 6.11789
ssr_fade_out = 2.92817
ssr_depth_tolerance = 6.61
ssao_radius = 0.01
ssao_intensity = 0.02
ssil_radius = 6.3
sdfgi_use_occlusion = true
sdfgi_bounce_feedback = 0.77
sdfgi_min_cell_size = 0.01
sdfgi_cascade0_distance = 0.64
sdfgi_max_distance = 10.24
glow_enabled = true
glow_intensity = 0.84
glow_strength = 0.63
glow_bloom = 1.0
glow_blend_mode = 1
glow_hdr_threshold = 1.1
glow_hdr_scale = 1.92
glow_map_strength = 1.0
fog_light_color = Color(0, 0, 0, 1)
fog_light_energy = 1.41
fog_sun_scatter = 0.08
fog_density = 0.082
fog_height = 1.0
fog_height_density = 1.0
volumetric_fog_enabled = true
volumetric_fog_density = 0.2786
volumetric_fog_albedo = Color(0, 0, 0, 1)
volumetric_fog_emission_energy = 0.0
[sub_resource type="BoxShape3D" id="BoxShape3D_23nxb"] [sub_resource type="BoxShape3D" id="BoxShape3D_23nxb"]
size = Vector3(135, 1, 125) size = Vector3(135, 1, 125)
@@ -258,13 +296,19 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 38, 0, 14)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 42, 0, 14) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 42, 0, 14)
[node name="RoomsContainer" type="Node3D" parent="NavigationRegion3D/DungeonGenerator"] [node name="RoomsContainer" type="Node3D" parent="NavigationRegion3D/DungeonGenerator"]
visible = false
[node name="Altar Environment" type="WorldEnvironment" parent="NavigationRegion3D/DungeonGenerator"]
environment = SubResource("Environment_sn0iw")
[node name="StaticBody3D" type="StaticBody3D" parent="NavigationRegion3D"] [node name="StaticBody3D" type="StaticBody3D" parent="NavigationRegion3D"]
visible = false
collision_layer = 2147483648 collision_layer = 2147483648
collision_mask = 2147483648 collision_mask = 2147483648
[node name="CollisionShape3D" type="CollisionShape3D" parent="NavigationRegion3D/StaticBody3D"] [node name="CollisionShape3D" type="CollisionShape3D" parent="NavigationRegion3D/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, -1.5, -4.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, -1.5, -4.5)
visible = false
shape = SubResource("BoxShape3D_23nxb") shape = SubResource("BoxShape3D_23nxb")
[node name="EnemyDatabase" parent="." instance=ExtResource("11_yvj8v")] [node name="EnemyDatabase" parent="." instance=ExtResource("11_yvj8v")]

Binary file not shown.

View File

@@ -0,0 +1 @@
uid://cms0sqekyx4pf