From cfb731c27e22dda6f139361888c2ad96b9eedb9b Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Thu, 14 Dec 2023 17:27:07 +0100 Subject: [PATCH] Intermediate commit --- assets/4x4checker.png.import | 2 +- assets/4x4checkerColor.png.import | 2 +- assets/IslandMasks/IslandMask2.png.import | 18 ++-- components/NavigationComponent.cs | 10 +- entities/Tree.cs | 1 + project.godot | 4 + scenes/Game.cs | 52 ++++------ scenes/Game.tscn | 86 ++++----------- scenes/World.cs | 118 +++++++++++++++++++-- scenes/World.tscn | 50 +++++++++ scenes/WorldChunk.cs | 24 ++--- scenes/tests/NavigationTests.cs | 26 ++--- scenes/tests/NavigationTests.tscn | 18 ++-- ui/WorldGeneratorUI.gd | 35 ++++--- ui/WorldGeneratorUI.tscn | 121 ++++++++++++++++++++++ ui/WorldGeneratorWidget.gd | 21 ++++ 16 files changed, 420 insertions(+), 168 deletions(-) create mode 100644 scenes/World.tscn create mode 100644 ui/WorldGeneratorUI.tscn create mode 100644 ui/WorldGeneratorWidget.gd diff --git a/assets/4x4checker.png.import b/assets/4x4checker.png.import index c165888..657ffa0 100644 --- a/assets/4x4checker.png.import +++ b/assets/4x4checker.png.import @@ -21,7 +21,7 @@ compress/lossy_quality=0.7 compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 -flags/repeat=true +flags/repeat=1 flags/filter=false flags/mipmaps=true flags/anisotropic=false diff --git a/assets/4x4checkerColor.png.import b/assets/4x4checkerColor.png.import index 66d87ff..a830882 100644 --- a/assets/4x4checkerColor.png.import +++ b/assets/4x4checkerColor.png.import @@ -19,7 +19,7 @@ compress/lossy_quality=0.7 compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=2 -flags/repeat=true +flags/repeat=0 flags/filter=false flags/mipmaps=true flags/anisotropic=false diff --git a/assets/IslandMasks/IslandMask2.png.import b/assets/IslandMasks/IslandMask2.png.import index 53adc99..3fea1d9 100644 --- a/assets/IslandMasks/IslandMask2.png.import +++ b/assets/IslandMasks/IslandMask2.png.import @@ -2,28 +2,30 @@ importer="texture" type="StreamTexture" -path="res://.import/IslandMask2.png-b09deb1a0f8633d5ff352ae53948f6ed.stex" +path.s3tc="res://.import/IslandMask2.png-b09deb1a0f8633d5ff352ae53948f6ed.s3tc.stex" +path.etc2="res://.import/IslandMask2.png-b09deb1a0f8633d5ff352ae53948f6ed.etc2.stex" metadata={ -"vram_texture": false +"imported_formats": [ "s3tc", "etc2" ], +"vram_texture": true } [deps] source_file="res://assets/IslandMasks/IslandMask2.png" -dest_files=[ "res://.import/IslandMask2.png-b09deb1a0f8633d5ff352ae53948f6ed.stex" ] +dest_files=[ "res://.import/IslandMask2.png-b09deb1a0f8633d5ff352ae53948f6ed.s3tc.stex", "res://.import/IslandMask2.png-b09deb1a0f8633d5ff352ae53948f6ed.etc2.stex" ] [params] -compress/mode=0 +compress/mode=2 compress/lossy_quality=0.7 compress/hdr_mode=0 compress/bptc_ldr=0 compress/normal_map=0 -flags/repeat=0 +flags/repeat=true flags/filter=true -flags/mipmaps=false +flags/mipmaps=true flags/anisotropic=false -flags/srgb=2 +flags/srgb=1 process/fix_alpha_border=true process/premult_alpha=false process/HDR_as_SRGB=false @@ -31,5 +33,5 @@ process/invert_color=false process/normal_map_invert_y=false stream=false size_limit=0 -detect_3d=true +detect_3d=false svg/scale=1.0 diff --git a/components/NavigationComponent.cs b/components/NavigationComponent.cs index fcd2ff9..66fcaa0 100644 --- a/components/NavigationComponent.cs +++ b/components/NavigationComponent.cs @@ -79,7 +79,7 @@ public class NavigationComponent : Spatial { } // Perform smoothing - _planningPathSmoothedWorldNavigationPoints = SmoothPath(entity, _planningPathWorldNavigationPoints); + _planningPathSmoothedWorldNavigationPoints = World.SmoothPath(entity, _planningPathWorldNavigationPoints); // Ensure starting point is the current position if (_planningPathSmoothedWorldNavigationPoints.Count > 0) { @@ -90,11 +90,9 @@ public class NavigationComponent : Spatial { public void FindPath(Entity entity, Vector3 fromPositionWorld, NavigationPoint navigationPoint) { FindPath(entity, fromPositionWorld, navigationPoint.WorldPosition); - if (_planningPathSmoothedWorldNavigationPoints.Count > 0) { - _planningPathWorldNavigationPoints[_planningPathWorldNavigationPoints.Count - 1] = navigationPoint; - _planningPathSmoothedWorldNavigationPoints[_planningPathSmoothedWorldNavigationPoints.Count - 1] = - navigationPoint; - } + _planningPathWorldNavigationPoints[_planningPathWorldNavigationPoints.Count - 1] = navigationPoint; + _planningPathSmoothedWorldNavigationPoints[_planningPathSmoothedWorldNavigationPoints.Count - 1] = + navigationPoint; } public void PlanGridPath(Entity entity, Vector3 fromPositionWorld, Vector3 toPositionWorld) { diff --git a/entities/Tree.cs b/entities/Tree.cs index 28c0283..955c6fa 100644 --- a/entities/Tree.cs +++ b/entities/Tree.cs @@ -44,6 +44,7 @@ public class Tree : StaticBody, IInteractionInterface { if (_health == 0) { InteractionComponent.EndInteraction(); InteractionComponent.TargetEntity = null; + GD.Print("Tree chopped!"); EmitSignal("TreeChopped", this); } } diff --git a/project.godot b/project.godot index 579d6ec..38ec882 100644 --- a/project.godot +++ b/project.godot @@ -134,5 +134,9 @@ common/enable_pause_aware_picking=true quality/directional_shadow/size.mobile=512 quality/shadow_atlas/size.mobile=1024 +quality/shadow_atlas/quadrant_0_subdiv=0 +quality/shadow_atlas/quadrant_1_subdiv=0 +quality/shadow_atlas/quadrant_2_subdiv=0 +quality/shadow_atlas/quadrant_3_subdiv=0 quality/subsurface_scattering/quality=0 environment/default_environment="res://default_env.tres" diff --git a/scenes/Game.cs b/scenes/Game.cs index 5da3f74..1e69d07 100644 --- a/scenes/Game.cs +++ b/scenes/Game.cs @@ -12,29 +12,23 @@ public class Game : Spatial { // ui elements private Label _framesPerSecondLabel; private Control _gameUi; - private Button _generateWorldButton; private Label _goldCountLabel; private TextureRect _heightTextureRect; // other members private HexGrid _hexGrid; private InteractionSystem _interactionSystem; - private HexCell _lastTile; private Label _mouseTileCubeLabel; private Label _mouseTileAxialLabel; private Spatial _mouseTileHighlight; private Label _mouseTileOffsetLabel; private Label _mouseWorldLabel; - private Label _numCoordsAddedLabel; - private Label _numCoordsRemovedLabel; - private Label _numTilesLabel; private Player _player; // scene nodes private Spatial _tileHighlight; // Resources - private PackedScene _tileHighlightScene; private ShaderMaterial _tileMaterial; private Label _tileOffsetLabel; private World _world; @@ -48,19 +42,15 @@ public class Game : Spatial { _framesPerSecondLabel = debugStatsContainer.GetNode