Monde seamless

pull/19/head
Valentin Stark 3 years ago
parent c73ff8f84a
commit 0542fcd339
  1. 6
      .godot/editor/3DWorld.tscn-editstate-5ee7dca069a2497be3bb28c4d56856bf.cfg
  2. 4
      .godot/editor/3DWorld.tscn-folding-5ee7dca069a2497be3bb28c4d56856bf.cfg
  3. 3
      .godot/editor/Board.gd-folding-9b0debabe1fb858ee1f70bd152cb7104.cfg
  4. 3
      .godot/editor/Chunk.gd-folding-a9f824cfb6fbc0d554437c289015e891.cfg
  5. 3
      .godot/editor/Ground.gd-folding-b469c7b9f58896e43358de1e29cfa8c9.cfg
  6. 6
      .godot/editor/Instance.tscn-editstate-9d991e3bcaa18250a5137d16090bc9f4.cfg
  7. 2
      .godot/editor/Instance.tscn-folding-9d991e3bcaa18250a5137d16090bc9f4.cfg
  8. 3
      .godot/editor/Mouse.gd-folding-cc9260c09ddeb6d1514da23698500e41.cfg
  9. 9
      .godot/editor/create_recent.Node
  10. 4
      .godot/editor/editor_layout.cfg
  11. 2
      .godot/editor/environment.tres-folding-55cb0503692521ce9cd0fcbe7b9a107e.cfg
  12. 48
      .godot/editor/filesystem_cache8
  13. 1
      .godot/editor/filesystem_update4
  14. 3
      .godot/editor/fog.gdshader-folding-ada5e975b953c78202ff6a7ff31140e7.cfg
  15. 8
      .godot/editor/project_metadata.cfg
  16. 6
      .godot/editor/recent_dirs
  17. 90
      .godot/editor/script_editor_cache.cfg
  18. 3
      .godot/editor/water.material-folding-3631a1ad48c82fa676d48240427e2249.cfg
  19. 6
      .godot/global_script_class_cache.cfg
  20. BIN
      .godot/shader_cache/SceneForwardClusteredShaderRD/10eab2d50272ac19a0440e0d2ff261f4664d7a2b76b1e7f13ea4b4351d96dfd8/1654c36b61579f79bbac221202cb782109aedb7a.cache
  21. BIN
      .godot/shader_cache/SceneForwardClusteredShaderRD/10eab2d50272ac19a0440e0d2ff261f4664d7a2b76b1e7f13ea4b4351d96dfd8/19a518e9d1d9c8ee0222de6625d81686b515c89d.cache
  22. BIN
      .godot/shader_cache/SceneForwardClusteredShaderRD/10eab2d50272ac19a0440e0d2ff261f4664d7a2b76b1e7f13ea4b4351d96dfd8/408e513259bddf05272f01abcfc6291a570d4ef2.cache
  23. BIN
      .godot/uid_cache.bin
  24. 158
      3DWorld.gdshader
  25. 7
      assets/environment.tres
  26. BIN
      assets/water.material
  27. 340
      blocs_no_collision.tres
  28. 40
      export_presets.cfg
  29. 5
      project.godot
  30. 86
      scenes/3DWorld.tscn
  31. 52
      scenes/Instance.tscn
  32. 16
      scenes/MultiColorFog/MultiColorFogMaterial.tres
  33. 12
      scenes/MultiColorFog/MultiColorFogOverlay.tscn
  34. 28
      scenes/MultiColorFog/MultiColorFogShader.gshader
  35. 30
      scenes/fog.gdshader
  36. 24
      scripts/Board.gd
  37. 2
      scripts/Camera3D.gd
  38. 67
      scripts/Chunk.gd
  39. 3
      scripts/Entity.gd
  40. 253
      scripts/Ground.gd
  41. 3
      scripts/Instance3D.gd
  42. 54
      scripts/World.gd
  43. 31
      scripts/WorldGeneration.gd

@ -97,7 +97,7 @@ Anim={
"auto_orthogonal_enabled": true,
"cinematic_preview": false,
"display_mode": 20,
"distance": 291.892,
"distance": 0.334141,
"doppler": false,
"frame_time": false,
"gizmos": true,
@ -108,8 +108,8 @@ Anim={
"use_environment": false,
"use_orthogonal": false,
"view_type": 0,
"x_rotation": 0.313363,
"y_rotation": -22.4738
"x_rotation": 0.583889,
"y_rotation": -24.1668
}, {
"auto_orthogonal": false,
"auto_orthogonal_enabled": true,

@ -1,5 +1,5 @@
[folding]
node_unfolds=[NodePath("Grid"), PackedStringArray("Transform", "Cell", "Navigation", "Collision", "Process"), NodePath("Ocean"), PackedStringArray("Collision", "Transform"), NodePath("Ocean/Mesh"), PackedStringArray("Transform", "Skeleton", "mesh"), NodePath("Ocean/CollisionShape3D"), PackedStringArray("shape"), NodePath("DirectionalLight3D"), PackedStringArray("Transform", "Light", "Shadow", "Directional Shadow"), NodePath("Highlighter"), PackedStringArray("Transform"), NodePath("Camera3D"), PackedStringArray("Transform"), NodePath("WorldEnvironment"), PackedStringArray("environment")]
resource_unfolds=["res://scenes/3DWorld.tscn::PlaneMesh_7x62x", PackedStringArray("Resource"), "res://scenes/3DWorld.tscn::BoxShape3D_g3t7x", PackedStringArray()]
node_unfolds=[NodePath("DirectionalLight3D"), PackedStringArray("Transform", "Light", "Shadow", "Directional Shadow"), NodePath("Highlighter"), PackedStringArray("Transform"), NodePath("WorldEnvironment"), PackedStringArray("environment"), NodePath("Camera3D"), PackedStringArray("Transform"), NodePath("GridMap"), PackedStringArray("Cell")]
resource_unfolds=[]
nodes_folded=[]

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

@ -97,7 +97,7 @@ Anim={
"auto_orthogonal_enabled": true,
"cinematic_preview": false,
"display_mode": 20,
"distance": 3.72507,
"distance": 12.7619,
"doppler": false,
"frame_time": false,
"gizmos": true,
@ -108,8 +108,8 @@ Anim={
"use_environment": false,
"use_orthogonal": false,
"view_type": 0,
"x_rotation": 0.447642,
"y_rotation": -7.1148
"x_rotation": 0.661445,
"y_rotation": -8.48052
}, {
"auto_orthogonal": false,
"auto_orthogonal_enabled": true,

@ -1,5 +1,5 @@
[folding]
node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("Pivot"), PackedStringArray("Transform"), NodePath("Pivot/fox"), PackedStringArray("Visibility", "Transform"), NodePath("CollisionShape3D"), PackedStringArray("shape", "Transform"), NodePath("RayCast3D"), PackedStringArray("Transform", "Collide With")]
node_unfolds=[NodePath("."), PackedStringArray("Transform"), NodePath("Pivot"), PackedStringArray("Transform"), NodePath("Pivot/fox"), PackedStringArray("Visibility", "Transform"), NodePath("CollisionShape3D"), PackedStringArray("shape", "Transform"), NodePath("RayCast3D"), PackedStringArray("Transform")]
resource_unfolds=["res://scenes/Instance.tscn::ArrayMesh_e2578", PackedStringArray(), "res://scenes/Instance.tscn::Skin_ue8ij", PackedStringArray(), "res://scenes/Instance.tscn::ArrayMesh_atpyt", PackedStringArray(), "res://scenes/Instance.tscn::ArrayMesh_6pt58", PackedStringArray(), "res://scenes/Instance.tscn::ArrayMesh_dsilq", PackedStringArray(), "res://scenes/Instance.tscn::ArrayMesh_hauf1", PackedStringArray(), "res://scenes/Instance.tscn::ArrayMesh_46uut", PackedStringArray(), "res://scenes/Instance.tscn::ArrayMesh_cxm68", PackedStringArray(), "res://scenes/Instance.tscn::CapsuleShape3D_ed37x", PackedStringArray(), "res://scenes/Instance.tscn::AnimationNodeStateMachine_wao7v", PackedStringArray(), "res://scenes/Instance.tscn::AnimationNodeStateMachinePlayback_r217c", PackedStringArray()]
nodes_folded=[NodePath("Pivot/fox")]

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

@ -1,19 +1,20 @@
GridMap
MeshInstance3D
RayCast3D
Node3D
Node
FogVolume
VoxelGI
ReflectionProbe
WorldEnvironment
Camera3D
AnimationTree
RayCast3D
Node3D
StaticBody3D
CollisionShape3D
Sprite3D
CharacterBody3D
TextureRect
TileMap
Node
GridMap
SpotLight3D
DirectionalLight3D
DirectionalLight2D

@ -20,8 +20,8 @@ open_scenes=["res://scenes/WorldGeneration.tscn", "res://scenes/3DWorld.tscn", "
[ScriptEditor]
open_scripts=["res://scripts/Camera3D.gd", "res://scripts/Chunks.gd", "res://scripts/Entity.gd", "res://scripts/Global.gd", "res://scripts/Instance3D.gd", "res://scripts/Map.gd", "res://scripts/Selection.gd", "res://scripts/World.gd", "res://scripts/WorldGeneration.gd"]
open_help=["@GlobalScope", "Callable", "GridMap", "Node3D", "Object", "PhysicsDirectBodyState3D", "PhysicsDirectSpaceState2D", "PhysicsDirectSpaceState3D", "RayCast3D", "RID", "Vector2"]
open_scripts=["res://scripts/Board.gd", "res://scripts/Chunk.gd", "res://scripts/Entity.gd", "res://scripts/Ground.gd", "res://scripts/Instance3D.gd", "res://scripts/World.gd", "res://scripts/WorldGeneration.gd"]
open_help=["Vector2i"]
script_split_offset=70
list_split_offset=0

@ -1,3 +1,3 @@
[folding]
sections_unfolded=PackedStringArray("Background", "Volumetric Fog", "SDFGI", "Reflected Light", "SSAO", "Sky", "SSIL", "Tonemap")
sections_unfolded=PackedStringArray("Background", "Volumetric Fog", "SDFGI", "Reflected Light", "SSAO", "Sky", "SSIL", "Tonemap", "Fog", "Volumetric Fog/Temporal Reprojection", "Adjustments")

@ -1,17 +1,16 @@
2a60927148abd1d33b818b535e306557
::res://::1679697463
3DWorld.gdshader::Shader::-1::1679697057::0::1::::<><>::
blocs_no_collision.tres::MeshLibrary::1346467984297363414::1679684420::0::1::::<><>::uid://b53thhe2sa6x0<>uid://cfr1s2lqng8eo<>uid://c0xxcgdm7s2ak<>uid://bffdt5if5pnda<>uid://kc4nqve8lx14<>uid://dlo0nmochxy4u
export_presets.cfg::TextFile::-1::1677257344::0::1::::<><>::
::res://::1680352161
export_presets.cfg::TextFile::-1::1679835270::0::1::::<><>::
icon.png::CompressedTexture2D::4672001524465425285::1676574357::1676664790::1::::<><>::
README.md::TextFile::-1::1676578345::0::1::::<><>::
test.tscn::PackedScene::2574507083474873372::1679697032::0::1::::<><>::res://scripts/Camera3D.gd
::res://assets/::1679697411
::res://assets/::1680198063
animestyled_hdr.hdr::CompressedTexture2D::7983615197667896801::1679693431::1679693542::1::::<><>::
environment.tres::Environment::8600195688495287911::1679697411::0::1::::<><>::uid://dl0k8gegahjf2
environment.tres::Environment::8600195688495287911::1680198063::0::1::::<><>::uid://dl0k8gegahjf2
sky.exr::CompressedTexture2D::3639266560030997135::1679692720::1679692784::1::::<><>::
water.gdshader::Shader::-1::1677015851::0::1::::<><>::
::res://assets/blocs/::1679697411
water.material::ShaderMaterial::9221375527372224942::1680198063::0::1::::<><>::res://assets/water.gdshader
::res://assets/blocs/::1680198063
0_sides.glb::PackedScene::7036506600244808940::1677003366::1677015904::1::::<><>::
0_sides_grass.png::CompressedTexture2D::4551055068461159203::1677003427::1677015904::1::::<><>::
1_side.glb::PackedScene::5601417408597394875::1677003385::1677015904::1::::<><>::
@ -25,7 +24,7 @@ water.gdshader::Shader::-1::1677015851::0::1::::<><>::
4_sides.glb::PackedScene::139420628202576697::1677003373::1677015905::1::::<><>::
4_sides_grass.png::CompressedTexture2D::7961782411803042998::1677003428::1677015904::1::::<><>::
blocs.meshlib::MeshLibrary::3161916306234183153::1677960056::0::1::::<><>::uid://b53thhe2sa6x0<>uid://cfr1s2lqng8eo<>uid://c0xxcgdm7s2ak<>uid://bffdt5if5pnda<>uid://kc4nqve8lx14<>uid://dlo0nmochxy4u
blocs.tscn::PackedScene::3779811605783367088::1679697411::0::1::::<><>::uid://b53thhe2sa6x0<>uid://cfr1s2lqng8eo<>uid://c0xxcgdm7s2ak<>uid://bffdt5if5pnda<>uid://kc4nqve8lx14<>uid://dlo0nmochxy4u
blocs.tscn::PackedScene::3779811605783367088::1680198063::0::1::::<><>::uid://b53thhe2sa6x0<>uid://cfr1s2lqng8eo<>uid://c0xxcgdm7s2ak<>uid://bffdt5if5pnda<>uid://kc4nqve8lx14<>uid://dlo0nmochxy4u
::res://assets/entities/::1679682604
character.tscn::PackedScene::7228591986680468162::1679682604::0::1::::<><>::uid://cnra1i2164n8e<>uid://bluw1mspkoy71<>uid://dttdl45idwmdq<>uid://bnm2cr6xrmyne<>uid://q1bmi2lut4w5
fox.glb::PackedScene::7089061536691691956::1679682604::1679682604::1::::<><>::
@ -75,21 +74,26 @@ sdqs.meshlib::MeshLibrary::2440886030015449773::1677960056::0::1::::<><>::uid://
blocs.meshlib::MeshLibrary::5001218139483850589::1677960056::0::1::::<><>::uid://ffn1ia7c3x60<>uid://birlu82nfgbsx<>uid://t03cipsdfuim<>uid://68inkwq5fe2v<>uid://blv0o0tit1gob<>uid://dg3l2dsc7n6s<>uid://dpewuerjdlgms<>uid://d3a4ur67k13wa<>uid://d1ioc5uj71iud<>uid://2s6bm46h6kfw<>uid://bttpxki4m82q1<>uid://bh7awq00jlfkn
::res://assets/ui/::1677960056
bloc_select.png::CompressedTexture2D::1141775147858261351::1677960056::1677960056::1::::<><>::
::res://scenes/::1679697412
3DWorld.gdshader::Shader::-1::1679697057::0::1::::<><>::
3DWorld.tscn::PackedScene::3599411568061770725::1679697411::0::1::::<><>::uid://blbwkgls3oafx<>res://scripts/Chunks.gd<>res://scripts/Camera3D.gd<>res://assets/water.gdshader<>uid://dur874iy77jjr<>uid://qjc4ttmkxbch<>res://scripts/Selection.gd
::res://scenes/::1680198064
3DWorld.gdshader::Shader::-1::1679829541::0::1::::<><>::
3DWorld.tscn::PackedScene::3599411568061770725::1680198063::0::1::::<><>::res://scripts/Ground.gd<>res://scripts/Board.gd<>res://scripts/Camera3D.gd<>uid://dur874iy77jjr<>uid://qjc4ttmkxbch
3DWorld.VoxelGI_data.res::VoxelGIData::7277764935364316181::1679688605::0::1::::<><>::
fog.gdshader::Shader::-1::1679829541::0::1::::<><>::
Game.tscn::PackedScene::9075056520838281688::1677106092::0::1::::<><>::uid://brjt1u0dgbmi4<>uid://d1sd7pxywgunu
HUD.tscn::PackedScene::9021570906125339886::1679697411::0::1::::<><>::res://scripts/Map.gd
Instance.tscn::PackedScene::4220804716574195494::1679697412::0::1::::<><>::res://scripts/Instance3D.gd<>uid://dw2latnr2vbxc<>uid://cfd2s833ldeuy<>uid://bavhx67iarml6<>uid://b3ljxodmxmuhg<>uid://c831hydrcv4i6
WorldGeneration.tscn::PackedScene::1108513713840477990::1679697411::0::1::::<><>::res://scripts/WorldGeneration.gd
::res://scripts/::1679692462
Camera3D.gd::GDScript::-1::1679686246::0::1::::<>Camera3D<>::
Chunks.gd::GDScript::-1::1679682604::0::1::::<>GridMap<>::
Entity.gd::GDScript::-1::1679682604::0::1::::Entity<>Node<>::
HUD.tscn::PackedScene::9021570906125339886::1680198063::0::1::::<><>::res://scripts/Map.gd
Instance.tscn::PackedScene::4220804716574195494::1680198064::0::1::::<><>::res://scripts/Instance3D.gd<>uid://dw2latnr2vbxc<>uid://cfd2s833ldeuy<>uid://bavhx67iarml6<>uid://b3ljxodmxmuhg<>uid://c831hydrcv4i6
WorldGeneration.tscn::PackedScene::1108513713840477990::1680198063::0::1::::<><>::res://scripts/WorldGeneration.gd
::res://scenes/MultiColorFog/::1679756576
MultiColorFogMaterial.tres::ShaderMaterial::-1::1610706439::0::1::::<><>::res://MultiColorFog/MultiColorFog.shader
MultiColorFogOverlay.tscn::PackedScene::-1::1610706439::0::1::::<><>::res://MultiColorFog/MultiColorFogMaterial.tres
::res://scripts/::1680037452
Board.gd::GDScript::-1::1680037452::0::1::::<>Node3D<>::
Camera3D.gd::GDScript::-1::1679764692::0::1::::<>Camera3D<>::
Chunk.gd::GDScript::-1::1680037271::0::1::::Chunk<>GridMap<>::
Entity.gd::GDScript::-1::1679949455::0::1::::Entity<>Node<>::
Global.gd::GDScript::-1::1677079629::0::1::::<>Node<>::
Instance3D.gd::GDScript::-1::1679682604::0::1::::<>CharacterBody3D<>::
Ground.gd::GDScript::-1::1680036683::0::1::::<>Node3D<>::
Instance3D.gd::GDScript::-1::1679951014::0::1::::<>CharacterBody3D<>::
Map.gd::GDScript::-1::1678572216::0::1::::<>TextureRect<>::
Selection.gd::GDScript::-1::1679686964::0::1::::<>Node3D<>::
World.gd::GDScript::-1::1679682604::0::1::::World<>Node<>::
WorldGeneration.gd::GDScript::-1::1679692462::0::1::::<>Control<>::
World.gd::GDScript::-1::1680036046::0::1::::World<>Node<>::
WorldGeneration.gd::GDScript::-1::1680014648::0::1::::<>Control<>::

@ -1,4 +1,5 @@
res://scenes/WorldGeneration.tscn
res://assets/water.material
res://assets/environment.tres
res://scenes/3DWorld.tscn
res://assets/blocs/blocs.tscn

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray()

@ -12,17 +12,17 @@ run_reload_scripts=true
[recent_files]
scenes=["res://scenes/Instance.tscn", "res://scenes/HUD.tscn", "res://assets/blocs/blocs.tscn", "res://scenes/3DWorld.tscn", "res://scenes/WorldGeneration.tscn", "res://test.tscn", "res://assets/entities/fox.tscn", "res://assets/entities/character.tscn", "res://assets/entities/fox.glb", "res://assets/blocs/4_sides.glb"]
scripts=["Vector2", "RID", "RayCast3D", "PhysicsDirectSpaceState3D", "PhysicsDirectSpaceState2D", "PhysicsDirectBodyState3D", "Object", "Node3D", "GridMap", "Callable"]
scripts=["Vector2i", "res://scripts/Entity.gd", "res://scripts/Chunk.gd", "res://scripts/Instance3D.gd", "res://scripts/WorldGeneration.gd", "res://scripts/World.gd", "res://scripts/Board.gd", "res://scripts/Ground.gd", "res://scripts/Mouse.gd", "Vector2"]
[color_picker]
recent_presets=PackedColorArray(1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0.121263, 0.432004, 0.849088, 1, 0, 0, 0.866667, 1, 0.411372, 0.238174, 0.105652, 1, 0.381714, 0.213426, 0.390387, 1, 0.843137, 0, 0, 1, 0.70009, 0.293668, 0.361002, 1)
recent_presets=PackedColorArray(0.996078, 0, 0, 1, 0.310787, 2.43662e-07, 3.60981e-08, 1, 0.675659, 1.82897e-06, 9.62615e-08, 1, 0.0156863, 1, 1, 1, 0, 0, 0, 1, 0, 0.764706, 0, 1, 0.921569, 0, 0, 1, 0.517475, 0.454223, 0.632742, 1, 1, 1, 1, 1)
[dialog_bounds]
project_settings=Rect2(575, 408, 1531, 671)
project_settings=Rect2(258, 656, 1683, 1168)
search_help=Rect2(1192, 168, 1368, 912)
export=Rect2(468, 69, 1800, 1011)
export=Rect2(468, 217, 1800, 1392)
editor_settings=Rect2(830, 227, 900, 700)
[project_settings]

@ -1,10 +1,10 @@
res://assets
/home/valentin/Documents/Gridmap/scripts
res://scripts
res://
res://scenes
res://scripts
res://assets/entities
res://assets/test/falaise
res://assets/blocs
res://assets/test
/home/valentin/Documents/Gridmap/scripts
res://assets
/home/valentin/Documents/Gridmap

@ -3,11 +3,11 @@
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 12,
"column": 24,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 16,
"scroll_position": 1.0,
"row": 19,
"scroll_position": 9.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -17,26 +17,16 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 40,
"column": 9,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 36,
"scroll_position": 32.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
[res://scripts/Chunks.gd]
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 0,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 76,
"scroll_position": 56.0,
"selection": false,
"row": 65,
"scroll_position": 63.0,
"selection": true,
"selection_from_column": 9,
"selection_from_line": 65,
"selection_to_column": 13,
"selection_to_line": 65,
"syntax_highlighter": "GDScript"
}
@ -45,11 +35,11 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 22,
"column": 8,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 29,
"scroll_position": 9.0,
"row": 81,
"scroll_position": 49.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
@ -61,7 +51,7 @@ state={
"breakpoints": PackedInt32Array(),
"column": 13,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"h_scroll_position": 374,
"row": 8,
"scroll_position": 0.0,
"selection": false,
@ -73,12 +63,16 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 26,
"column": 14,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 30,
"scroll_position": 14.0,
"selection": false,
"row": 20,
"scroll_position": 2.0,
"selection": true,
"selection_from_column": 14,
"selection_from_line": 20,
"selection_to_column": 32,
"selection_to_line": 20,
"syntax_highlighter": "GDScript"
}
@ -101,16 +95,44 @@ state={
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 5,
"column": 19,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 33,
"row": 19,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
[res://scripts/Selection.gd]
[res://scripts/Board.gd]
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 46,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 26,
"scroll_position": 18.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
[res://scripts/Chunk.gd]
state={
"bookmarks": PackedInt32Array(),
"breakpoints": PackedInt32Array(),
"column": 28,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 103,
"scroll_position": 89.0,
"selection": false,
"syntax_highlighter": "GDScript"
}
[res://scripts/Ground.gd]
state={
"bookmarks": PackedInt32Array(),
@ -118,8 +140,8 @@ state={
"column": 0,
"folded_lines": Array[int]([]),
"h_scroll_position": 0,
"row": 24,
"scroll_position": 15.0,
"row": 7,
"scroll_position": 0.0,
"selection": false,
"syntax_highlighter": "GDScript"
}

@ -0,0 +1,3 @@
[folding]
sections_unfolded=PackedStringArray("Shader Parameters")

@ -5,6 +5,12 @@ list=Array[Dictionary]([{
"language": &"GDScript",
"path": "res://utils/camera/CameraController.gd"
}, {
"base": &"GridMap",
"class": &"Chunk",
"icon": "",
"language": &"GDScript",
"path": "res://scripts/Chunk.gd"
}, {
"base": &"Node",
"class": &"Entity",
"icon": "",

Binary file not shown.

@ -1,158 +0,0 @@
/* TODO: Recalculate normals, cleanup
*/
shader_type spatial;
// player_pos updated in Ground.gd, used to calculate distance from player
uniform vec3 player_pos = vec3(0.0, 0.0, 0.0);
// Set "active" to false to turn off the displacement shader.
uniform bool active = true;
// Set "remap_normals" to true if you want lighting to take place after displacement
uniform bool remap_normals = true;
// Use RADIUS to determine how warped the world should be.
uniform float RADIUS = 10.0;
uniform bool hang = false;
void fragment() {
// Add color
ALBEDO = vec3(0.1, 0.3, 0.05);
}
void vertex() {
// Vertex displacement math, as a function of dist_z, dist_y
float dist_z = VERTEX.z - player_pos.z;
float dist_y = VERTEX.y;
// Dz and theta is calculated from RADIUS for use in the transform.
float Dz = PI*RADIUS/2.0;
float theta = dist_z / RADIUS;
// Calculate which "side" we're on
// 1 and -1 represent "hanging towel"
// 0 represents the "rolling log" part
int side;
if (active) {
if (dist_z > Dz) {
side = 1;
} else if (dist_z < -Dz) {
side = -1;
} else {
side = 0;
}
// set side = 0 if you want a log without "hanging sides"
if (!hang) { side = 0; }
if (side == 1) {
// positive vertical side
VERTEX.y = -(dist_z - Dz) - RADIUS;
VERTEX.z = dist_y + RADIUS;
}
if (side == -1) {
// negative vertical side
VERTEX.y = (dist_z + Dz) - RADIUS;
VERTEX.z = - (dist_y + RADIUS);
}
if (side == 0) {
// rolling log
VERTEX.y = (dist_y + RADIUS)*cos(theta) - RADIUS;
VERTEX.z = (dist_y + RADIUS)*sin(theta) ;
}
// reposition world vertices
VERTEX.z += player_pos.z;
}
// todo - recalculate normals
if (remap_normals) {
if (side == 1) {
//vec3 normal = normalize(vec3(NORMAL.x, -NORMAL.z, NORMAL.y));
vec3 normal = normalize(vec3(0.0, 1.0, 0.0));
NORMAL = normal;
} else if (side == -1) {
//vec3 normal = normalize(vec3(NORMAL.x, NORMAL.z, -NORMAL.y));
vec3 normal = normalize(vec3(0.0, 1.0, 0.0));
NORMAL = normal;
} else if (side == 0) {
// todo - check this math!
vec3 normal = normalize(vec3(
NORMAL.x,
NORMAL.y * cos(theta) - NORMAL.z * sin(theta),
NORMAL.z * cos(theta) + NORMAL.z * sin(theta)
));
NORMAL = normal;
}
}
}

@ -14,4 +14,11 @@ sky = SubResource("Sky_l0jbv")
sky_rotation = Vector3(6.2221, 0, 0)
tonemap_mode = 2
tonemap_white = 1.3
fog_aerial_perspective = 0.522
fog_sky_affect = 0.0
volumetric_fog_enabled = true
volumetric_fog_density = 0.01
volumetric_fog_albedo = Color(0.517647, 0.454902, 0.631373, 1)
volumetric_fog_emission = Color(0, 0.764706, 0, 1)
volumetric_fog_ambient_inject = 16.0
volumetric_fog_temporal_reprojection_enabled = false

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -25,7 +25,6 @@ texture_format/bptc=false
texture_format/s3tc=true
texture_format/etc=false
texture_format/etc2=false
texture_format/no_bptc_fallbacks=true
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
@ -39,3 +38,42 @@ unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.1]
name="Web"
platform="Web"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""
[preset.1.options]
custom_template/debug=""
custom_template/release=""
variant/extensions_support=false
vram_texture_compression/for_desktop=true
vram_texture_compression/for_mobile=false
html/export_icon=true
html/custom_html_shell=""
html/head_include=""
html/canvas_resize_policy=2
html/focus_canvas_on_start=true
html/experimental_virtual_keyboard=false
progressive_web_app/enabled=false
progressive_web_app/offline_page=""
progressive_web_app/display=1
progressive_web_app/orientation=0
progressive_web_app/icon_144x144=""
progressive_web_app/icon_180x180=""
progressive_web_app/icon_512x512=""
progressive_web_app/background_color=Color(0, 0, 0, 1)

@ -19,6 +19,11 @@ config/icon="res://icon.png"
Global="*res://scripts/Global.gd"
[display]
window/stretch/mode="canvas_items"
window/stretch/aspect="expand"
[gui]
common/drop_mouse_on_gui_input_disabled=true

@ -1,80 +1,20 @@
[gd_scene load_steps=15 format=3 uid="uid://brjt1u0dgbmi4"]
[gd_scene load_steps=6 format=3 uid="uid://brjt1u0dgbmi4"]
[ext_resource type="MeshLibrary" uid="uid://blbwkgls3oafx" path="res://assets/blocs/blocs.meshlib" id="1_cg1yu"]
[ext_resource type="Script" path="res://scripts/Chunks.gd" id="2_c1ype"]
[ext_resource type="Script" path="res://scripts/Ground.gd" id="3_f4vd0"]
[ext_resource type="Script" path="res://scripts/Board.gd" id="3_g32xc"]
[ext_resource type="Script" path="res://scripts/Camera3D.gd" id="3_lkvuw"]
[ext_resource type="Shader" path="res://assets/water.gdshader" id="4_35uvc"]
[ext_resource type="Environment" uid="uid://dur874iy77jjr" path="res://assets/environment.tres" id="4_dycnn"]
[ext_resource type="Texture2D" uid="uid://qjc4ttmkxbch" path="res://assets/ui/bloc_select.png" id="4_nyumm"]
[ext_resource type="Script" path="res://scripts/Selection.gd" id="7_pmhvq"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_n8qd5"]
[node name="Board" type="Node3D"]
script = ExtResource("3_g32xc")
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_1g5a7"]
width = 2048
height = 2048
noise = SubResource("FastNoiseLite_n8qd5")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_n7hja"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_oj1yx"]
width = 2048
height = 2048
noise = SubResource("FastNoiseLite_n7hja")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_crcqq"]
render_priority = 0
shader = ExtResource("4_35uvc")
shader_parameter/speed = 0.00100005
shader_parameter/color = Color(0.054902, 0.533333, 0.741176, 1)
shader_parameter/edge_color = Color(0.0509804, 0.313726, 0.741176, 1)
shader_parameter/edge_scale = 0.25
shader_parameter/near = 0.1
shader_parameter/far = 100.0
shader_parameter/wave_strengh = Vector2(0.05, 0.025)
shader_parameter/wave_frequency = Vector2(1.2, 1.2)
shader_parameter/time_factor = Vector2(0.1, 0.2)
shader_parameter/noise1 = SubResource("NoiseTexture2D_1g5a7")
shader_parameter/noise2 = SubResource("NoiseTexture2D_oj1yx")
[sub_resource type="PlaneMesh" id="PlaneMesh_7x62x"]
material = SubResource("ShaderMaterial_crcqq")
size = Vector2(512, 512)
subdivide_width = 20
subdivide_depth = 20
[sub_resource type="BoxShape3D" id="BoxShape3D_g3t7x"]
size = Vector3(512, 0, 512)
[node name="3DWorld" type="Node3D"]
script = ExtResource("7_pmhvq")
[node name="Grid" type="GridMap" parent="."]
[node name="Ground" type="Node3D" parent="." node_paths=PackedStringArray("camera")]
transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
mesh_library = ExtResource("1_cg1yu")
cell_size = Vector3(1, 1, 1)
cell_octant_size = 512
cell_center_x = false
cell_center_y = false
cell_center_z = false
collision_layer = 129
data = {
"cells": PackedInt32Array(1619, 64841, 0, 130877, 765, 0, 590646, 65155, 0)
}
script = ExtResource("2_c1ype")
script = ExtResource("3_f4vd0")
camera = NodePath("../Camera3D")
metadata/_editor_floor_ = Vector3(0, 0, 0)
[node name="Ocean" type="StaticBody3D" parent="."]
transform = Transform3D(0.999999, 0, 0, 0, 1, 0, 0, 0, 1, 256, 0.5, 256)
collision_layer = 129
[node name="Mesh" type="MeshInstance3D" parent="Ocean"]
mesh = SubResource("PlaneMesh_7x62x")
skeleton = NodePath("../../Grid")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ocean"]
shape = SubResource("BoxShape3D_g3t7x")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.838816, -0.462141, 0.287772, 0.48185, -0.384196, 0.787537, -0.253392, 0.799262, 0.544952, 0, 0, 0)
light_color = Color(0.67451, 0.847059, 0.901961, 1)
@ -89,9 +29,15 @@ transform = Transform3D(0.999999, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08,
pixel_size = 0.0039
texture = ExtResource("4_nyumm")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource("4_dycnn")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.820851, 0.571143, 0, -0.571143, 0.820851, 0, 8.70843, 0)
script = ExtResource("3_lkvuw")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource("4_dycnn")
[node name="GridMap" type="GridMap" parent="."]
cell_size = Vector3(1, 1, 1)
cell_center_x = false
cell_center_y = false
cell_center_z = false

@ -2092,15 +2092,15 @@ bones/4/name = "Bone"
bones/4/parent = -1
bones/4/rest = Transform3D(1, -2.5291e-08, -6.43127e-08, 6.49611e-08, 0.0265338, 0.999648, -2.35757e-08, -0.999648, 0.0265338, 1.86265e-09, 0.417916, -2.98023e-08)
bones/4/enabled = true
bones/4/position = Vector3(3.32322e-09, 0.395214, -0.000602629)
bones/4/rotation = Quaternion(-0.615751, 0.151982, 0.124873, 0.762994)
bones/4/position = Vector3(3.80287e-09, 0.387758, -0.000800519)
bones/4/rotation = Quaternion(-0.607974, 0.192244, 0.159278, 0.753685)
bones/4/scale = Vector3(1, 1, 1)
bones/5/name = "Bone.001"
bones/5/parent = 4
bones/5/rest = Transform3D(1, 6.49611e-08, 3.22196e-08, 3.04846e-08, 0.0265337, -0.999648, -6.57931e-08, 0.999648, 0.0265337, 5.25223e-09, 1.53668e-08, 0.132351)
bones/5/enabled = true
bones/5/position = Vector3(5.25223e-09, 1.53668e-08, 0.132351)
bones/5/rotation = Quaternion(0.667434, 4.8857e-08, -2.18174e-09, 0.744669)
bones/5/rotation = Quaternion(0.636043, 2.23772e-08, -2.13547e-08, 0.771653)
bones/5/scale = Vector3(1, 1, 1)
bones/6/name = "Hood"
bones/6/parent = 5
@ -2121,14 +2121,14 @@ bones/8/parent = 7
bones/8/rest = Transform3D(0.432955, 0.625736, -0.648848, 0.0448991, 0.703947, 0.708832, 0.900297, -0.336025, 0.276682, 5.82709e-08, 0.177444, -2.03371e-08)
bones/8/enabled = true
bones/8/position = Vector3(5.82709e-08, 0.177444, -2.03371e-08)
bones/8/rotation = Quaternion(-0.645553, -0.124866, -0.204517, 0.72515)
bones/8/rotation = Quaternion(-0.636747, -0.134009, -0.262501, 0.712522)
bones/8/scale = Vector3(1, 1, 1)
bones/9/name = "Bone.007"
bones/9/parent = 8
bones/9/rest = Transform3D(0.993116, 0.117134, -5.41402e-07, -0.117134, 0.993116, 5.5995e-07, 6.03264e-07, -4.92679e-07, 1, -7.73984e-09, 0.162903, -8.55013e-08)
bones/9/enabled = true
bones/9/position = Vector3(-7.73984e-09, 0.162903, -8.55013e-08)
bones/9/rotation = Quaternion(-1.61989e-06, -3.0388e-07, -0.575961, 0.817477)
bones/9/rotation = Quaternion(-1.43562e-06, -3.15463e-07, -0.505819, 0.86264)
bones/9/scale = Vector3(1, 1, 1)
bones/10/name = "Sword"
bones/10/parent = 9
@ -2141,15 +2141,15 @@ bones/11/name = "Bone.008"
bones/11/parent = 4
bones/11/rest = Transform3D(1, 3.55271e-15, -3.8117e-08, 3.81036e-08, -0.0265341, 0.999648, -1.0114e-09, -0.999648, -0.0265341, 0.480619, 0.00333734, 0.125734)
bones/11/enabled = true
bones/11/position = Vector3(0.327701, 0.00478315, -0.0840381)
bones/11/rotation = Quaternion(-0.762992, 0.124882, -0.151994, 0.615748)
bones/11/position = Vector3(0.327701, 0.00421036, -0.105617)
bones/11/rotation = Quaternion(-0.753685, 0.159278, -0.192243, 0.607974)
bones/11/scale = Vector3(1, 1, 1)
bones/12/name = "Bone.011"
bones/12/parent = 4
bones/12/rest = Transform3D(1, 3.10862e-15, -6.95332e-09, 6.95087e-09, -0.0265341, 0.999648, -1.84497e-10, -0.999648, -0.0265341, 0.287738, 0.203267, 0.120427)
bones/12/enabled = true
bones/12/position = Vector3(0.291431, 0.236535, 0.000400938)
bones/12/rotation = Quaternion(-0.762994, 0.124873, -0.151982, 0.615751)
bones/12/rotation = Quaternion(-0.753685, 0.159278, -0.192243, 0.607974)
bones/12/scale = Vector3(1, 1, 1)
bones/13/name = "Bone.019"
bones/13/parent = 4
@ -2163,91 +2163,91 @@ bones/14/parent = 13
bones/14/rest = Transform3D(0.432955, -0.625736, 0.648848, -0.044899, 0.703947, 0.708832, -0.900297, -0.336025, 0.276683, 4.20827e-08, 0.177444, 3.85194e-08)
bones/14/enabled = true
bones/14/position = Vector3(4.20827e-08, 0.177444, 3.85194e-08)
bones/14/rotation = Quaternion(-0.67285, 0.460843, 0.267531, 0.513151)
bones/14/rotation = Quaternion(-0.679592, 0.461843, 0.244522, 0.514845)
bones/14/scale = Vector3(1, 1, 1)
bones/15/name = "Bone.021"
bones/15/parent = 14
bones/15/rest = Transform3D(0.993116, -0.117134, 4.12768e-07, 0.117134, 0.993116, 8.259e-07, -5.06667e-07, -7.71865e-07, 1, 1.81458e-10, 0.162903, -8.5116e-09)
bones/15/enabled = true
bones/15/position = Vector3(1.81458e-10, 0.162903, -8.5116e-09)
bones/15/rotation = Quaternion(-1.90704e-06, 2.40531e-07, 0.442795, 0.896623)
bones/15/rotation = Quaternion(-2.0333e-06, 2.53638e-07, 0.488558, 0.872532)
bones/15/scale = Vector3(1, 1, 1)
bones/16/name = "Bone.022"
bones/16/parent = 4
bones/16/rest = Transform3D(1, 3.55271e-15, -3.8117e-08, 3.81036e-08, -0.0265341, 0.999648, -1.0114e-09, -0.999648, -0.0265341, -0.480619, 0.00333737, 0.125734)
bones/16/enabled = true
bones/16/position = Vector3(-0.358609, -0.128956, -0.0469393)
bones/16/rotation = Quaternion(-0.762994, 0.124873, -0.151982, 0.615751)
bones/16/position = Vector3(-0.358609, -0.128557, -0.0319018)
bones/16/rotation = Quaternion(-0.753685, 0.159278, -0.192244, 0.607974)
bones/16/scale = Vector3(1, 1, 1)
bones/17/name = "Bone.023"
bones/17/parent = 4
bones/17/rest = Transform3D(1, 4.88498e-15, -6.95333e-09, 6.95088e-09, -0.0265341, 0.999648, -1.84495e-10, -0.999648, -0.0265341, -0.287738, 0.203267, 0.120427)
bones/17/enabled = true
bones/17/position = Vector3(-0.285902, 0.16505, -0.138443)
bones/17/rotation = Quaternion(-0.762994, 0.124873, -0.151982, 0.615751)
bones/17/rotation = Quaternion(-0.753685, 0.159278, -0.192243, 0.607974)
bones/17/scale = Vector3(1, 1, 1)
bones/18/name = "Tail_1"
bones/18/parent = 4
bones/18/rest = Transform3D(1, 2.31377e-08, 6.49611e-08, -2.48533e-08, 0.999648, 0.0265338, -6.43243e-08, -0.0265338, 0.999648, 7.52368e-09, 0.139991, -0.0720165)
bones/18/enabled = true
bones/18/position = Vector3(7.52368e-09, 0.139991, -0.0720165)
bones/18/rotation = Quaternion(0.0660546, 2.96001e-08, -2.4461e-08, 0.997816)
bones/18/rotation = Quaternion(-0.0891353, 3.26041e-08, -3.43612e-09, 0.99602)
bones/18/scale = Vector3(1, 1, 1)
bones/19/name = "Tail_2"
bones/19/parent = 18
bones/19/rest = Transform3D(1, -3.40006e-15, -2.66127e-15, 3.40006e-15, 1, 7.45058e-09, 2.66127e-15, -7.45058e-09, 1, 5.70345e-16, 0.132915, -2.04718e-09)
bones/19/enabled = true
bones/19/position = Vector3(5.70345e-16, 0.132915, -2.04718e-09)
bones/19/rotation = Quaternion(0.101783, -1.70179e-09, 6.31483e-09, 0.994807)
bones/19/rotation = Quaternion(0.0310456, 1.21785e-09, 1.32724e-08, 0.999518)
bones/19/scale = Vector3(1, 1, 1)
bones/20/name = "Tail_3"
bones/20/parent = 19
bones/20/rest = Transform3D(1, 9.71445e-17, -8.4713e-22, -9.71445e-17, 1, 2.13933e-24, 8.4713e-22, -2.13933e-24, 1, -1.10819e-15, 0.132915, -2.98023e-08)
bones/20/enabled = true
bones/20/position = Vector3(-1.10819e-15, 0.132915, -2.98023e-08)
bones/20/rotation = Quaternion(0.0602187, -2.82354e-09, -1.18853e-08, 0.998185)
bones/20/rotation = Quaternion(0.213945, -6.941e-09, -4.30992e-09, 0.976846)
bones/20/scale = Vector3(1, 1, 1)
bones/21/name = "Tail_4"
bones/21/parent = 20
bones/21/rest = Transform3D(1, 9.71445e-17, -9.72421e-26, -9.71445e-17, 1, 2.13933e-24, 9.72421e-26, -2.13933e-24, 1, -1.16371e-15, 0.132915, -2.98023e-08)
bones/21/enabled = true
bones/21/position = Vector3(-1.16371e-15, 0.132915, -2.98023e-08)
bones/21/rotation = Quaternion(0.176366, 1.04296e-08, 1.04854e-08, 0.984325)
bones/21/rotation = Quaternion(0.245662, -5.59292e-09, 6.13994e-09, 0.969356)
bones/21/scale = Vector3(1, 1, 1)
bones/22/name = "Bone.003"
bones/22/parent = 4
bones/22/rest = Transform3D(1, -6.49611e-08, -1.74055e-08, 1.56754e-08, -0.0265388, 0.999648, -6.54002e-08, -0.999648, -0.0265388, -2.83161e-15, -1.57499e-10, -3.06139e-08)
bones/22/enabled = true
bones/22/position = Vector3(-2.27119e-09, -0.00627534, -0.0291115)
bones/22/rotation = Quaternion(-0.762995, 0.124873, -0.151982, 0.615749)
bones/22/rotation = Quaternion(-0.753686, 0.159278, -0.192243, 0.607972)
bones/22/scale = Vector3(0.963893, 0.963829, 0.963391)
bones/23/name = "Bone.002"
bones/23/parent = 22
bones/23/rest = Transform3D(1, -5.68103e-08, -1.28744e-07, 7.358e-08, 0.990947, 0.13425, 1.19952e-07, -0.13425, 0.990947, 0.103074, 0.0448339, 0.0144274)
bones/23/enabled = true
bones/23/position = Vector3(0.103074, 0.0448339, 0.0144274)
bones/23/rotation = Quaternion(-0.299894, -0.338126, -0.149637, 0.879399)
bones/23/rotation = Quaternion(-0.326767, -0.333414, -0.160467, 0.86966)
bones/23/scale = Vector3(1.00015, 0.999976, 0.999842)
bones/24/name = "L_leg_3"
bones/24/parent = 23
bones/24/rest = Transform3D(1, 1.46768e-07, 1.41892e-07, -1.08988e-07, 0.97155, -0.236835, -1.72615e-07, 0.236835, 0.97155, -1.09502e-08, 0.131148, -7.90992e-09)
bones/24/enabled = true
bones/24/position = Vector3(-1.09502e-08, 0.131148, -7.90992e-09)
bones/24/rotation = Quaternion(0.499733, 2.76342e-08, -2.17794e-07, 0.86618)
bones/24/rotation = Quaternion(0.540206, 4.74854e-08, -2.72443e-07, 0.841533)
bones/24/scale = Vector3(1, 0.999986, 1.00002)
bones/25/name = "R_leg_1"
bones/25/parent = 22
bones/25/rest = Transform3D(1, 5.68103e-08, 2.09964e-07, -8.44838e-08, 0.990947, 0.13425, -2.00436e-07, -0.13425, 0.990947, -0.103074, 0.0448339, 0.0144275)
bones/25/enabled = true
bones/25/position = Vector3(-0.103074, 0.0448339, 0.0144275)
bones/25/rotation = Quaternion(-0.231883, 0.230695, 0.198382, 0.923934)
bones/25/rotation = Quaternion(-0.260926, 0.224917, 0.209506, 0.915116)
bones/25/scale = Vector3(1.00008, 0.999967, 0.999928)
bones/26/name = "R_leg_2"
bones/26/parent = 25
bones/26/rest = Transform3D(1, -1.57459e-07, -1.39286e-07, 1.19991e-07, 0.97155, -0.236835, 1.72615e-07, 0.236835, 0.97155, 1.35965e-08, 0.131148, -5.11595e-09)
bones/26/enabled = true
bones/26/position = Vector3(1.35965e-08, 0.131148, -5.11595e-09)
bones/26/rotation = Quaternion(0.443942, -8.59087e-08, 2.08723e-07, 0.896056)
bones/26/rotation = Quaternion(0.489128, -5.60148e-08, 2.19699e-07, 0.872212)
bones/26/scale = Vector3(1, 0.99997, 1.00006)
bones/27/name = "Bone.013"
bones/27/parent = -1
@ -2331,12 +2331,12 @@ libraries = {
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6, 0)
shape = SubResource("CapsuleShape3D_ed37x")
[node name="RayCast3D" type="RayCast3D" parent="."]
transform = Transform3D(0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 10, 0)
collision_mask = 128
[node name="AnimationTree" type="AnimationTree" parent="."]
tree_root = SubResource("AnimationNodeStateMachine_wao7v")
anim_player = NodePath("../Pivot/fox/AnimationPlayer")
active = true
parameters/playback = SubResource("AnimationNodeStateMachinePlayback_r217c")
[node name="RayCast3D" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 20, 0, 0, 0, 1, 0, 10, 0)
collision_mask = 128

@ -0,0 +1,16 @@
[gd_resource type="ShaderMaterial" load_steps=4 format=2]
[ext_resource path="res://MultiColorFog/MultiColorFog.shader" type="Shader" id=1]
[sub_resource type="Gradient" id=1]
offsets = PoolRealArray( 0, 0.257862, 1 )
colors = PoolColorArray( 0.572549, 1, 0.639216, 0, 0.967743, 0.410156, 1, 0.647799, 1, 0.517647, 0.517647, 1 )
[sub_resource type="GradientTexture" id=2]
gradient = SubResource( 1 )
[resource]
shader = ExtResource( 1 )
shader_param/fog_intensity = 0.919
shader_param/fog_amount = 0.011
shader_param/gradient = SubResource( 2 )

@ -0,0 +1,12 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://MultiColorFog/MultiColorFogMaterial.tres" type="Material" id=1]
[sub_resource type="QuadMesh" id=1]
material = ExtResource( 1 )
size = Vector2( 2, 2 )
[node name="MultiColorFogOverlay" type="MeshInstance"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.1 )
mesh = SubResource( 1 )
material/0 = null

@ -0,0 +1,28 @@
shader_type spatial;
render_mode unshaded;
uniform sampler2D gradient: hint_albedo;
uniform float fog_intensity: hint_range(0.0, 1.0);
uniform float fog_amount: hint_range(0.0, 1.0);
void vertex() {
POSITION = vec4(VERTEX, 1.0);
}
void fragment() {
vec4 original = texture(SCREEN_TEXTURE, SCREEN_UV);
float depth = texture(DEPTH_TEXTURE, SCREEN_UV).x;
vec3 ndc= vec3(SCREEN_UV, depth) * 2.0 - 1.0;
vec4 view = INV_PROJECTION_MATRIX* vec4(ndc, 1.0);
view.xyz /= view.w;
depth = -view.z;
float fog = depth * fog_amount;
vec4 fog_color = texture(gradient, vec2(fog, 0.0));
if (depth > 1.0)
ALBEDO = mix(original.rgb, fog_color.rgb, fog_color.a * fog_intensity);
else
ALBEDO = fog_color.rgb;
}

@ -0,0 +1,30 @@
shader_type spatial;
render_mode unshaded;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;
uniform sampler2D gradient: source_color;
uniform float fog_intensity: hint_range(0.0, 1.0);
uniform float fog_amount: hint_range(0.0, 1.0);
void vertex() {
POSITION = vec4(VERTEX, 1.0);
}
void fragment() {
vec4 original = texture(SCREEN_TEXTURE, SCREEN_UV);
float depth = texture(DEPTH_TEXTURE, SCREEN_UV).x;
vec3 ndc= vec3(SCREEN_UV, depth) * 2.0 - 1.0;
vec4 view = INV_PROJECTION_MATRIX* vec4(ndc, 1.0);
view.xyz /= view.w;
depth = -view.z;
float fog = depth * fog_amount;
vec4 fog_color = texture(gradient, vec2(fog, 0.0));
if (depth > 1.0)
ALBEDO = mix(original.rgb, fog_color.rgb, fog_color.a * fog_intensity);
else
ALBEDO = fog_color.rgb;
}

@ -5,10 +5,12 @@ const Entity3D = preload("res://scenes/Instance.tscn")
@onready var grid = $Grid
@onready var ground = $Ground
@onready var camera =$Camera3D
@onready var highlighter = $Highlighter
@onready var gridmap = $GridMap
var highlight = {}
var selection = {}
@ -22,7 +24,7 @@ func _process(delta):
selection = highlight
else:
selection = reset_highlight()
var entity = Global.world.add_entity(Vector2i(highlight.data.position.x, highlight.data.position.z))
var entity = Global.world.add_entity(Vector2i(highlight.grid_position.x, highlight.grid_position.y))
var entity_instance = Entity3D.instantiate()
entity_instance.id = entity.id
entity_instance.position = highlight.data.position
@ -30,14 +32,14 @@ func _process(delta):
add_child(entity_instance)
if Input.is_action_just_pressed("main_command"):
if selection.type == 1:
var path = Global.world.entities[selection.data.id].path_create(Vector2i(highlight.data.position.x, highlight.data.position.z))
var path = Global.world.entities[selection.data.id].path_create(Global.world.get_real_coordinates(Vector2i(highlight.data.position.x, highlight.data.position.z)))
Global.world.entities[selection.data.id].path_start()
func _unhandled_input(event):
if event is InputEventMouseMotion:
highlight = get_highlight()
if highlight.type == 0:
highlighter.transparency = 0.0
var sprite_position = Vector3(round(highlight.data.position.x), ceil(highlight.data.position.y), round(highlight.data.position.z)) + Vector3(0, 0.01, 0)
var sprite_position = Vector3(round(highlight.board_position.x), ceil(highlight.board_position.y), round(highlight.board_position.z)) + Vector3(0, 0.01, 0)
highlighter.position = sprite_position
else:
highlighter.transparency = 1.0
@ -55,14 +57,14 @@ func get_highlight():
ray_query.collide_with_areas = true
var raycast_result = space.intersect_ray(ray_query)
if raycast_result:
if raycast_result.collider.name == "Grid":
var position = grid.get_used_cells()[raycast_result.shape]
result["type"] = 0
result["data"] = Global.world.get_bloc(Vector2i(position.x, position.z))
if raycast_result.collider.name == "Ocean":
var position = grid.get_used_cells()[raycast_result.shape]
var collider = raycast_result.collider
if "Chunk" in raycast_result.collider.name or "Ocean" in raycast_result.collider.name:
var position = gridmap.local_to_map(raycast_result.position)
# var position = collider.get_used_cells()[raycast_result.shape] * Vector3i(collider.x, 1, collider.z)
result["type"] = 0
result["data"] = Global.world.get_bloc(Vector2i(grid.local_to_map(raycast_result.position).x, grid.local_to_map(raycast_result.position).z))
result["board_position"] = position
result["grid_position"] = Global.world.get_real_coordinates(Vector2i(position.x, position.z))
result["data"] = Global.world.get_bloc(result["grid_position"])
elif "id" in raycast_result.collider:
result["type"] = 1
result["data"] = Global.world.entities[raycast_result.collider.id].get_data()

@ -18,7 +18,7 @@ func _process(delta):
func calc_move(m_pos, delta):
var v_size = get_viewport().size
var v_size = Vector2(1152, 648)
var move_vec = Vector3()
if m_pos.x < MOVE_MARGIN:
move_vec.x -= 1

@ -1,21 +1,41 @@
extends GridMap
class_name Chunk
const Entity3D = preload("res://scenes/Instance.tscn")
var x = 0
var z = 0
var size = 0
var should_remove = false
func _ready():
setFloor()
setEntities()
func _init(x: int, z: int, size: int):
self.x = x
self.z = z
self.size = size
mesh_library = load("res://assets/blocs/blocs.meshlib")
cell_size = Vector3(1, 1, 1)
cell_center_x = false
cell_center_y = false
cell_center_z = false
set_collision_layer_value(7, true)
set_collision_mask_value(7, true)
set_collision_layer_value(8, true)
set_collision_mask_value(8, true)
func setFloor():
clear()
for mz in range(0, Global.world.width - 1):
for mx in range(0, Global.world.height - 1):
var bloc = Global.world.get_bloc(Vector2i(mx, mz))
create_chunk()
create_water()
func create_chunk():
for mx in size:
for mz in size:
var position = Vector2i(mx + (size) * x, mz + (size) * z)
# position.x = min(position.x, Global.world.width - 1)
# position.y = min(position.y, Global.world.height - 1)
var bloc = Global.world.get_bloc(position)
var my: float = bloc.position.y
var meshID
var mesh_rotation
if bloc.type != 0:
var neighbours = Global.world.get_neighbours_4_at_same_height(Vector2i(mx, mz))
var neighbours = Global.world.get_neighbours_4_at_same_height(position)
if neighbours == Global.directions_4.RIGHT:
meshID = Global.bloc_sides_id.SIDE_3
mesh_rotation = Global.GRID_ROTATION[3]
@ -67,10 +87,23 @@ func setFloor():
set_cell_item( Vector3(mx, my, mz) , meshID, mesh_rotation)
func setEntities():
for entity in Global.world.entities:
var entity_instance = Entity3D.instantiate()
entity_instance.id = entity.id
entity_instance.position = map_to_local(Vector3(entity.position.x, entity.position.y, entity.position.z))
entity_instance.connect_to_world(entity_instance.id)
add_child(entity_instance)
func create_water():
var plane_mesh = PlaneMesh.new()
plane_mesh.size = Vector2(size, size)
plane_mesh.material = preload("res://assets/water.material")
var mesh_instance = MeshInstance3D.new()
mesh_instance.mesh = plane_mesh
var collision_shape = CollisionShape3D.new()
var box = BoxShape3D.new()
box.size = Vector3(512, 0, 512)
collision_shape.shape = box
var static_body = StaticBody3D.new()
static_body.set_name("Ocean")
static_body.set_collision_layer_value(8, true)
static_body.add_child(mesh_instance)
static_body.add_child(collision_shape)
static_body.translate(Vector3(size/2, 0.5, size/2))
add_child(static_body)

@ -39,7 +39,7 @@ func get_data():
func move(new_position: Vector2i, speed: float):
emit_signal("moving", new_position, speed)
print(new_position)
Global.world.blocs[position.x][position.y].entity = -1
self.position = new_position
position = new_position
@ -80,7 +80,6 @@ func path_create(goal: Vector2i):
if current == goal:
break
for next in Global.world.neighbours(current):
var new_cost = cost_so_far[current] + Global.world.cost(current, next)
if next not in cost_so_far or new_cost < cost_so_far[next]:

@ -0,0 +1,253 @@
extends Node3D
const Entity3D = preload("res://scenes/Instance.tscn")
var thread
var displayed_chunks = {} # displayed_chunks
var unready_chunks = {}
#@onready var camera = get_node("Camera3D")
#@export @onready var camera = get_node(camera)
@export var camera: Camera3D
var chunks: Array
func _ready():
thread = Thread.new()
# pass
init_chunks()
# setFloor()
# setEntities()
func init_chunks():
for x in Global.world.width / Global.world.chunk_size:
chunks.append([])
for y in Global.world.height / Global.world.chunk_size:
chunks[x].append([])
chunks[x][y] = Chunk.new(x, y, Global.world.chunk_size)
chunks[x][y].set_name("Chunk")
# print(chunks)
#
#func create_chunk(coord: Vector2i):
# var chunk = GridMap.new()
# for mx in Global.world.chunk_size:
# for mz in Global.world.chunk_size:
# var bloc = Global.world.get_bloc(Vector2i(mx * Global.world.chunk_size, mz * Global.world.chunk_size))
# var my: float = bloc.position.y
# var meshID
# var mesh_rotation
# if bloc.type != 0:
# var neighbours = Global.world.get_neighbours_4_at_same_height(Vector2i(mx, mz))
# if neighbours == Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_3
# mesh_rotation = Global.GRID_ROTATION[3]
# elif neighbours == Global.directions_4.LEFT:
# meshID = Global.bloc_sides_id.SIDE_3
# mesh_rotation = Global.GRID_ROTATION[1]
# elif neighbours == Global.directions_4.LEFT + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_2_OPPOSITE
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == Global.directions_4.BOTTOM:
# meshID = Global.bloc_sides_id.SIDE_3
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == Global.directions_4.BOTTOM + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_2_ANGLE
# mesh_rotation = Global.GRID_ROTATION[3]
# elif neighbours == Global.directions_4.BOTTOM + Global.directions_4.LEFT:
# meshID = Global.bloc_sides_id.SIDE_2_ANGLE
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == Global.directions_4.BOTTOM + Global.directions_4.LEFT + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_1
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == Global.directions_4.TOP:
# meshID = Global.bloc_sides_id.SIDE_3
# mesh_rotation = Global.GRID_ROTATION[2]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_2_ANGLE
# mesh_rotation = Global.GRID_ROTATION[2]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.LEFT:
# meshID = Global.bloc_sides_id.SIDE_2_ANGLE
# mesh_rotation = Global.GRID_ROTATION[1]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.LEFT + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_1
# mesh_rotation = Global.GRID_ROTATION[2]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.BOTTOM:
# meshID = Global.bloc_sides_id.SIDE_2_OPPOSITE
# mesh_rotation = Global.GRID_ROTATION[1]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.BOTTOM + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_1
# mesh_rotation = Global.GRID_ROTATION[3]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.BOTTOM + Global.directions_4.LEFT:
# meshID = Global.bloc_sides_id.SIDE_1
# mesh_rotation = Global.GRID_ROTATION[1]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.BOTTOM + Global.directions_4.LEFT + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_0
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == 0:
# meshID = Global.bloc_sides_id.SIDE_4
# mesh_rotation = Global.GRID_ROTATION[0]
#
# chunk.set_cell_item( Vector3(mx, my, mz) , meshID, mesh_rotation)
# return chunk
#func setFloor():
# clear()
# for mz in range(0, Global.world.width - 1):
# for mx in range(0, Global.world.height - 1):
# var bloc = Global.world.get_bloc(Vector2i(mx, mz))
# var my: float = bloc.position.y
# var meshID
# var mesh_rotation
# if bloc.type != 0:
# var neighbours = Global.world.get_neighbours_4_at_same_height(Vector2i(mx, mz))
# if neighbours == Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_3
# mesh_rotation = Global.GRID_ROTATION[3]
# elif neighbours == Global.directions_4.LEFT:
# meshID = Global.bloc_sides_id.SIDE_3
# mesh_rotation = Global.GRID_ROTATION[1]
# elif neighbours == Global.directions_4.LEFT + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_2_OPPOSITE
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == Global.directions_4.BOTTOM:
# meshID = Global.bloc_sides_id.SIDE_3
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == Global.directions_4.BOTTOM + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_2_ANGLE
# mesh_rotation = Global.GRID_ROTATION[3]
# elif neighbours == Global.directions_4.BOTTOM + Global.directions_4.LEFT:
# meshID = Global.bloc_sides_id.SIDE_2_ANGLE
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == Global.directions_4.BOTTOM + Global.directions_4.LEFT + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_1
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == Global.directions_4.TOP:
# meshID = Global.bloc_sides_id.SIDE_3
# mesh_rotation = Global.GRID_ROTATION[2]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_2_ANGLE
# mesh_rotation = Global.GRID_ROTATION[2]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.LEFT:
# meshID = Global.bloc_sides_id.SIDE_2_ANGLE
# mesh_rotation = Global.GRID_ROTATION[1]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.LEFT + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_1
# mesh_rotation = Global.GRID_ROTATION[2]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.BOTTOM:
# meshID = Global.bloc_sides_id.SIDE_2_OPPOSITE
# mesh_rotation = Global.GRID_ROTATION[1]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.BOTTOM + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_1
# mesh_rotation = Global.GRID_ROTATION[3]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.BOTTOM + Global.directions_4.LEFT:
# meshID = Global.bloc_sides_id.SIDE_1
# mesh_rotation = Global.GRID_ROTATION[1]
# elif neighbours == Global.directions_4.TOP + Global.directions_4.BOTTOM + Global.directions_4.LEFT + Global.directions_4.RIGHT:
# meshID = Global.bloc_sides_id.SIDE_0
# mesh_rotation = Global.GRID_ROTATION[0]
# elif neighbours == 0:
# meshID = Global.bloc_sides_id.SIDE_4
# mesh_rotation = Global.GRID_ROTATION[0]
#
# set_cell_item( Vector3(mx, my, mz) , meshID, mesh_rotation)
#
#func setEntities():
# for entity in Global.world.entities:
# var entity_instance = Entity3D.instantiate()
# entity_instance.id = entity.id
# entity_instance.position = map_to_local(Vector3(entity.position.x, entity.position.y, entity.position.z))
# entity_instance.connect_to_world(entity_instance.id)
# add_child(entity_instance)
func add_chunk(x, z):
var key = str(x) + "," + str(z)
if displayed_chunks.has(key) or unready_chunks.has(key):
return
if not thread.is_started():
thread.start(Callable(self, "load_chunk").bind([thread, x, z]))
# thread.start(self, "load_chunk", [thread, x, z])
unready_chunks[key] = 1
#
#func gen_chunk(array):
# var thread = array[0]
# var x = array[1]
# var z = array[2]
# var chunk = {
# "x": x,
# "y": z,
# "should_remove": true
# }
#
# call_deferred("load_done", chunk, thread)
func load_chunk(array):
var thread = array[0]
var posX = array[1]
var posZ = array[2]
var x = fmod(posX, Global.world.width / Global.world.chunk_size)
var z = fmod(posZ, Global.world.height / Global.world.chunk_size)
#
# # Chargement du chunk
var chunk = chunks[x][z]
## var chunk = Chunk.new()
# chunk.translate(Vector3(posX * Global.world.chunk_size, 0, posZ * Global.world.chunk_size))
var chunk_position = Vector2(posX, posZ)
chunk.position = Vector3(posX * Global.world.chunk_size, 0, posZ * Global.world.chunk_size)
call_deferred("load_done", chunk, thread, chunk_position)
func load_done(chunk, thread, position):
add_child(chunk)
var key = str(position.x) + "," + str(position.y)
displayed_chunks[key] = chunk
unready_chunks.erase(key)
thread.wait_to_finish()
func get_chunk(x, z):
var key = str(x) + "," + str(z)
if displayed_chunks.has(key):
return displayed_chunks.get(key)
return null
func _process(delta):
update_chunks()
clean_up_chunks()
reset_chunks()
func update_chunks():
var camera_translation = camera.position
var c_x = int(camera_translation.x) / Global.world.chunk_size
var c_z = int(camera_translation.z) / Global.world.chunk_size
for x in range(c_x - Global.world.chunk_number * 0.5, c_x + Global.world.chunk_number * 0.53):
for z in range(c_z - Global.world.chunk_number * 0.5, c_z + Global.world.chunk_number * 0.53):
add_chunk(x, z)
var chunk = get_chunk(x, z)
if chunk != null:
chunk.should_remove = false
func clean_up_chunks():
for key in displayed_chunks:
var chunk = displayed_chunks[key]
if chunk.should_remove:
remove_child(chunk)
displayed_chunks.erase(key)
func reset_chunks():
for key in displayed_chunks:
var chunk = displayed_chunks[key]
chunk.should_remove = true

@ -1,6 +1,7 @@
extends CharacterBody3D
var id = -1
var instance_position: Vector2i
@onready var ray = $RayCast3D
func _process(delta):
@ -13,8 +14,10 @@ func connect_to_world(id):
var world_entity = Global.world.entities[id]
world_entity.moving.connect(_on_entity_moving)
world_entity.changed_state.connect(_on_changed_state)
instance_position = world_entity.position
func _on_entity_moving(new_position, speed):
print(new_position)
var x_tween = get_tree().create_tween()
var z_tween = get_tree().create_tween()
var rot_tween = get_tree().create_tween()

@ -12,65 +12,71 @@ var entities: Array
var width: int
var height: int
var chunk_size = 64
var chunk_number = 6
func get_neighbours_8_at_same_height(point: Vector2i):
var neighbours = 0
var current_bloc = heightMap[point.x][point.y]
if heightMap[point.x-1][point.y-1] == current_bloc:
var current_bloc = get_height(Vector2i(point.x, point.y))
if get_height(Vector2i(point.x-1, point.y-1)) == current_bloc:
neighbours += Global.directions_8.TOP_LEFT
if heightMap[point.x][point.y-1] == current_bloc:
if get_height(Vector2i(point.x, point.y-1)) == current_bloc:
neighbours += Global.directions_8.TOP
if heightMap[point.x+1][point.y-1] == current_bloc:
if get_height(Vector2i(point.x+1,point.y-1)) == current_bloc:
neighbours += Global.directions_8.TOP_RIGHT
if heightMap[point.x+1][point.y] == current_bloc:
if get_height(Vector2i(point.x+1, point.y)) == current_bloc:
neighbours += Global.directions_8.RIGHT
if heightMap[point.x+1][point.y+1] == current_bloc:
if get_height(Vector2i(point.x+1, point.y+1)) == current_bloc:
neighbours += Global.directions_8.BOTTOM_RIGHT
if heightMap[point.x][point.y+1] == current_bloc:
if get_height(Vector2i(point.x, point.y+1)) == current_bloc:
neighbours += Global.directions_8.BOTTOM
if heightMap[point.x-1][point.y+1] == current_bloc:
if get_height(Vector2i(point.x-1, point.y+1)) == current_bloc:
neighbours += Global.directions_8.BOTTOM_LEFT
if heightMap[point.x-1][point.y] == current_bloc:
if get_height(Vector2i(point.x-1, point.y)) == current_bloc:
neighbours += Global.directions_8.LEFT
return neighbours
func get_neighbours_4_at_same_height(point: Vector2i):
var neighbours = 0
var current_bloc = heightMap[point.x][point.y]
if heightMap[point.x][point.y-1] == current_bloc:
var current_bloc = get_height(Vector2i(point.x, point.y))
if get_height(Vector2i(point.x, point.y-1)) == current_bloc:
neighbours += Global.directions_4.TOP
if heightMap[point.x+1][point.y] == current_bloc:
if get_height(Vector2i(point.x+1, point.y)) == current_bloc:
neighbours += Global.directions_4.RIGHT
if heightMap[point.x][point.y+1] == current_bloc:
if get_height(Vector2i(point.x, point.y+1)) == current_bloc:
neighbours += Global.directions_4.BOTTOM
if heightMap[point.x-1][point.y] == current_bloc:
if get_height(Vector2i(point.x-1, point.y)) == current_bloc:
neighbours += Global.directions_4.LEFT
return neighbours
func neighbours(point: Vector2i):
var neighbours = []
return [
Vector2i(point.x, point.y - 1),
Vector2i(point.x + 1, point.y),
Vector2i(point.x, point.y + 1),
Vector2i(point.x - 1, point.y),
Vector2i(point.x + 1, point.y - 1),
Vector2i(point.x + 1, point.y + 1),
Vector2i(point.x - 1, point.y + 1),
Vector2i(point.x - 1, point.y - 1)
get_real_coordinates(Vector2i(point.x, point.y - 1)),
get_real_coordinates(Vector2i(point.x + 1, point.y)),
get_real_coordinates(Vector2i(point.x, point.y + 1)),
get_real_coordinates(Vector2i(point.x - 1, point.y)),
get_real_coordinates(Vector2i(point.x + 1, point.y - 1)),
get_real_coordinates(Vector2i(point.x + 1, point.y + 1)),
get_real_coordinates(Vector2i(point.x - 1, point.y + 1)),
get_real_coordinates(Vector2i(point.x - 1, point.y - 1))
]
func get_real_coordinates(point: Vector2i):
return Vector2i(fposmod(point.x, width), fposmod(point.y, height))
func get_bloc(point: Vector2i):
point = get_real_coordinates(point)
var bloc = {}
bloc["position"] = Vector3i(point.x, heightMap[point.x][point.y], point.y)
bloc["position"] = Vector3i(point.x, get_height(Vector2i(point.x, point.y)), point.y)
for key in blocs[point.x][point.y].keys():
bloc[key] = blocs[point.x][point.y][key]
return bloc
func get_height(point: Vector2i):
point = get_real_coordinates(point)
return heightMap[point.x][point.y]
func add_entity(position: Vector2i):

@ -1,7 +1,7 @@
extends Control
@export var world_width = 256
@export var world_height = 256
@export var world_width = 512
@export var world_height = 512
func _ready():
Global.world.width = world_width
@ -17,31 +17,36 @@ func generate_heightmap(width, height):
randomize()
var noise = FastNoiseLite.new()
noise.seed = randi()
noise.frequency = 0.005
# var wavelength = 2.5
# var terraces = 20
# var elevation = noise.get_noise_2d(x / wavelength, y / wavelength)
var image = noise.get_seamless_image(width, height)
for x in width:
heightmap.append([])
for y in width:
var wavelength = 2.5
var terraces = 20
var elevation = image.get_pixel(x, y).r
elevation = remap(elevation, 0, 1, -1, 1)
# var border = border_width + rng.randf_range(-20.0, 20.0)
var elevation = noise.get_noise_2d(x / wavelength, y / wavelength)
var nx = 2 * x / width - 1
var ny = 2 * y / height - 1
# var elevation = noise.get_noise_2d(x / wavelength, y / wavelength)
#
# var nx = 2 * x / width - 1
# var ny = 2 * y / height - 1
elevation = max(elevation, -1)
#
if elevation > 0.1:
elevation = max(pow((elevation) * 1.2, 1.5), 0.1)
elevation = max(elevation, 0)
# elevation = min(elevation, 1)
## elevation = min(elevation, 1)
#
elevation = (elevation * terraces)
# print(elevation)
#
## print(elevation)
heightmap[x].append(floor(elevation))
return heightmap

Loading…
Cancel
Save