diff --git a/.godot/editor/Bloc.gd-folding-777908489b1a8005763f3e64e2d617fa.cfg b/.godot/editor/Bloc.gd-folding-777908489b1a8005763f3e64e2d617fa.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/Bloc.gd-folding-777908489b1a8005763f3e64e2d617fa.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/Character.gd-folding-bf899ffaaf35dcc8291eb6a2a32ad186.cfg b/.godot/editor/Character.gd-folding-bf899ffaaf35dcc8291eb6a2a32ad186.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/Character.gd-folding-bf899ffaaf35dcc8291eb6a2a32ad186.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/Character.tscn-editstate-93f18c909dc2d6f15b41da300e4d1e0b.cfg b/.godot/editor/Character.tscn-editstate-93f18c909dc2d6f15b41da300e4d1e0b.cfg new file mode 100644 index 0000000..d5bf273 --- /dev/null +++ b/.godot/editor/Character.tscn-editstate-93f18c909dc2d6f15b41da300e4d1e0b.cfg @@ -0,0 +1,170 @@ +[editor_states] + +Anim={ +"visible": false +} +2D={ +"grid_offset": Vector2(0, 0), +"grid_snap_active": false, +"grid_step": Vector2(8, 8), +"grid_visibility": 1, +"ofs": Vector2(-114.654, -46.1878), +"primary_grid_steps": 8, +"show_edit_locks": true, +"show_guides": true, +"show_helpers": false, +"show_origin": true, +"show_rulers": true, +"show_transformation_gizmos": true, +"show_viewport": true, +"show_zoom_control": true, +"smart_snap_active": false, +"snap_guides": true, +"snap_node_anchors": true, +"snap_node_center": true, +"snap_node_parent": true, +"snap_node_sides": true, +"snap_other_nodes": true, +"snap_pixel": true, +"snap_relative": false, +"snap_rotation": false, +"snap_rotation_offset": 0.0, +"snap_rotation_step": 0.261799, +"snap_scale": false, +"snap_scale_step": 0.1, +"zoom": 5.65685 +} +3D={ +"fov": 70.01, +"gizmos_status": { +"AudioListener3D": 0, +"AudioStreamPlayer3D": 0, +"CPUParticles3D": 0, +"CSGShape3D": 0, +"Camera3D": 0, +"CollisionObject3D": 0, +"CollisionPolygon3D": 0, +"CollisionShape3D": 0, +"Decal": 0, +"FogVolume": 0, +"GPUParticles3D": 0, +"GPUParticlesCollision3D": 0, +"Joint3D": 0, +"Light3D": 0, +"LightmapGI": 0, +"LightmapProbe": 0, +"Marker3D": 0, +"NavigationLink3D": 0, +"NavigationRegion3D": 0, +"OccluderInstance3D": 0, +"Path3D": 0, +"PhysicalBone3D": 0, +"RayCast3D": 0, +"ReflectionProbe": 0, +"ShapeCast3D": 0, +"Skeleton3D": 0, +"SoftBody3D": 0, +"SpringArm3D": 0, +"VehicleWheel3D": 0, +"VisibleOnScreenNotifier3D": 0, +"VoxelGI": 0 +}, +"local_coords": false, +"preview_sun_env": { +"environ_ao_enabled": false, +"environ_enabled": true, +"environ_energy": 1.0, +"environ_gi_enabled": false, +"environ_glow_enabled": true, +"environ_ground_color": Color(0.2, 0.169, 0.133, 1), +"environ_sky_color": Color(0.385, 0.454, 0.55, 1), +"environ_tonemap_enabled": true, +"sun_color": Color(1, 1, 1, 1), +"sun_enabled": true, +"sun_energy": 1.0, +"sun_max_distance": 100.0, +"sun_rotation": Vector2(-1.0472, 2.61799) +}, +"rotate_snap": 15.0, +"scale_snap": 10.0, +"show_grid": true, +"show_origin": true, +"snap_enabled": false, +"translate_snap": 1.0, +"viewport_mode": 1, +"viewports": [{ +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 5.44196, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": true, +"position": Vector3(0, 0, 0), +"use_environment": false, +"use_orthogonal": false, +"view_type": 0, +"x_rotation": 0.32983, +"y_rotation": -3.64159 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"use_orthogonal": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"use_orthogonal": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"use_orthogonal": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}], +"zfar": 4000.01, +"znear": 0.05 +} diff --git a/.godot/editor/Character.tscn-folding-93f18c909dc2d6f15b41da300e4d1e0b.cfg b/.godot/editor/Character.tscn-folding-93f18c909dc2d6f15b41da300e4d1e0b.cfg new file mode 100644 index 0000000..0d1758d --- /dev/null +++ b/.godot/editor/Character.tscn-folding-93f18c909dc2d6f15b41da300e4d1e0b.cfg @@ -0,0 +1,5 @@ +[folding] + +node_unfolds=[] +resource_unfolds=["res://scenes/Character.tscn::CapsuleMesh_4bik6", PackedStringArray()] +nodes_folded=[] diff --git a/.godot/editor/Chunks.gd-folding-5949b78e31fd40a7520f4ee5be998ee8.cfg b/.godot/editor/Chunks.gd-folding-5949b78e31fd40a7520f4ee5be998ee8.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/Chunks.gd-folding-5949b78e31fd40a7520f4ee5be998ee8.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/Entity.gd-folding-62048656195efaca6cbfe20b70ff68c3.cfg b/.godot/editor/Entity.gd-folding-62048656195efaca6cbfe20b70ff68c3.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/Entity.gd-folding-62048656195efaca6cbfe20b70ff68c3.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/WorldGeneration.tscn-editstate-0f1c0c812be0be68b9754190599b56a4.cfg b/.godot/editor/WorldGeneration.tscn-editstate-0f1c0c812be0be68b9754190599b56a4.cfg index 9d68af5..f631e28 100644 --- a/.godot/editor/WorldGeneration.tscn-editstate-0f1c0c812be0be68b9754190599b56a4.cfg +++ b/.godot/editor/WorldGeneration.tscn-editstate-0f1c0c812be0be68b9754190599b56a4.cfg @@ -8,7 +8,7 @@ Anim={ "grid_snap_active": false, "grid_step": Vector2(8, 8), "grid_visibility": 1, -"ofs": Vector2(-35.886, -12.5758), +"ofs": Vector2(-114.654, -46.1878), "primary_grid_steps": 8, "show_edit_locks": true, "show_guides": true, @@ -32,7 +32,7 @@ Anim={ "snap_rotation_step": 0.261799, "snap_scale": false, "snap_scale_step": 0.1, -"zoom": 11.9865 +"zoom": 5.65685 } 3D={ "fov": 70.01, @@ -85,12 +85,12 @@ Anim={ "sun_max_distance": 100.0, "sun_rotation": Vector2(-1.0472, 2.61799) }, -"rotate_snap": 15.0, -"scale_snap": 10.0, +"rotate_snap": 0.555556, +"scale_snap": 1.25, "show_grid": true, "show_origin": true, "snap_enabled": false, -"translate_snap": 1.0, +"translate_snap": 0.001, "viewport_mode": 1, "viewports": [{ "auto_orthogonal": false, diff --git a/.godot/editor/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.scn-folding-58f320eeb26a92b0faf87f84b599f07b.cfg b/.godot/editor/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.scn-folding-58f320eeb26a92b0faf87f84b599f07b.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.scn-folding-58f320eeb26a92b0faf87f84b599f07b.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/bloc_complet.glb-editstate-994aa1e23eb71978e33bad80f3deaabb.cfg b/.godot/editor/bloc_complet.glb-editstate-994aa1e23eb71978e33bad80f3deaabb.cfg new file mode 100644 index 0000000..7fba8d5 --- /dev/null +++ b/.godot/editor/bloc_complet.glb-editstate-994aa1e23eb71978e33bad80f3deaabb.cfg @@ -0,0 +1,170 @@ +[editor_states] + +Anim={ +"visible": false +} +2D={ +"grid_offset": Vector2(0, 0), +"grid_snap_active": false, +"grid_step": Vector2(8, 8), +"grid_visibility": 1, +"ofs": Vector2(-114.654, -46.1878), +"primary_grid_steps": 8, +"show_edit_locks": true, +"show_guides": true, +"show_helpers": false, +"show_origin": true, +"show_rulers": true, +"show_transformation_gizmos": true, +"show_viewport": true, +"show_zoom_control": true, +"smart_snap_active": false, +"snap_guides": true, +"snap_node_anchors": true, +"snap_node_center": true, +"snap_node_parent": true, +"snap_node_sides": true, +"snap_other_nodes": true, +"snap_pixel": true, +"snap_relative": false, +"snap_rotation": false, +"snap_rotation_offset": 0.0, +"snap_rotation_step": 0.261799, +"snap_scale": false, +"snap_scale_step": 0.1, +"zoom": 5.65685 +} +3D={ +"fov": 70.01, +"gizmos_status": { +"AudioListener3D": 0, +"AudioStreamPlayer3D": 0, +"CPUParticles3D": 0, +"CSGShape3D": 0, +"Camera3D": 0, +"CollisionObject3D": 0, +"CollisionPolygon3D": 0, +"CollisionShape3D": 0, +"Decal": 0, +"FogVolume": 0, +"GPUParticles3D": 0, +"GPUParticlesCollision3D": 0, +"Joint3D": 0, +"Light3D": 0, +"LightmapGI": 0, +"LightmapProbe": 0, +"Marker3D": 0, +"NavigationLink3D": 0, +"NavigationRegion3D": 0, +"OccluderInstance3D": 0, +"Path3D": 0, +"PhysicalBone3D": 0, +"RayCast3D": 0, +"ReflectionProbe": 0, +"ShapeCast3D": 0, +"Skeleton3D": 0, +"SoftBody3D": 0, +"SpringArm3D": 0, +"VehicleWheel3D": 0, +"VisibleOnScreenNotifier3D": 0, +"VoxelGI": 0 +}, +"local_coords": false, +"preview_sun_env": { +"environ_ao_enabled": false, +"environ_enabled": true, +"environ_energy": 1.0, +"environ_gi_enabled": false, +"environ_glow_enabled": true, +"environ_ground_color": Color(0.2, 0.169, 0.133, 1), +"environ_sky_color": Color(0.385, 0.454, 0.55, 1), +"environ_tonemap_enabled": true, +"sun_color": Color(1, 1, 1, 1), +"sun_enabled": true, +"sun_energy": 1.0, +"sun_max_distance": 100.0, +"sun_rotation": Vector2(-1.0472, 2.61799) +}, +"rotate_snap": 5.0, +"scale_snap": 5.0, +"show_grid": true, +"show_origin": true, +"snap_enabled": false, +"translate_snap": 0.1, +"viewport_mode": 1, +"viewports": [{ +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 1.36184, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": true, +"position": Vector3(0, 0, 0), +"use_environment": false, +"use_orthogonal": false, +"view_type": 0, +"x_rotation": 0.649339, +"y_rotation": -18.5162 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"use_orthogonal": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"use_orthogonal": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}, { +"auto_orthogonal": false, +"auto_orthogonal_enabled": true, +"cinematic_preview": false, +"display_mode": 20, +"distance": 4.0, +"doppler": false, +"frame_time": false, +"gizmos": true, +"half_res": false, +"information": false, +"listener": false, +"position": Vector3(0, 0, 0), +"use_environment": false, +"use_orthogonal": false, +"view_type": 0, +"x_rotation": 0.5, +"y_rotation": -0.5 +}], +"zfar": 4000.01, +"znear": 0.05 +} diff --git a/.godot/editor/bloc_complet.glb-folding-994aa1e23eb71978e33bad80f3deaabb.cfg b/.godot/editor/bloc_complet.glb-folding-994aa1e23eb71978e33bad80f3deaabb.cfg new file mode 100644 index 0000000..971bc19 --- /dev/null +++ b/.godot/editor/bloc_complet.glb-folding-994aa1e23eb71978e33bad80f3deaabb.cfg @@ -0,0 +1,5 @@ +[folding] + +node_unfolds=[NodePath("bloc_complet2"), PackedStringArray("Skeleton")] +resource_unfolds=["res://assets/test/bloc_complet.glb::ArrayMesh_bygxf", PackedStringArray("Resource")] +nodes_folded=[] diff --git a/.godot/editor/create_recent.Node b/.godot/editor/create_recent.Node index f578c87..8ec6d78 100644 --- a/.godot/editor/create_recent.Node +++ b/.godot/editor/create_recent.Node @@ -1,8 +1,10 @@ +MeshInstance3D +CollisionShape3D +CharacterBody3D TextureRect TileMap Node GridMap -MeshInstance3D Camera3D SpotLight3D DirectionalLight3D diff --git a/.godot/editor/cube.meshlib-folding-80a9dd2f2162760de06730ce36ab0a07.cfg b/.godot/editor/cube.meshlib-folding-80a9dd2f2162760de06730ce36ab0a07.cfg new file mode 100644 index 0000000..e860dd4 --- /dev/null +++ b/.godot/editor/cube.meshlib-folding-80a9dd2f2162760de06730ce36ab0a07.cfg @@ -0,0 +1,3 @@ +[folding] + +sections_unfolded=PackedStringArray() diff --git a/.godot/editor/editor_layout.cfg b/.godot/editor/editor_layout.cfg index 8c95cac..3a4d154 100644 --- a/.godot/editor/editor_layout.cfg +++ b/.godot/editor/editor_layout.cfg @@ -7,8 +7,8 @@ dock_filesystem_file_list_display_mode=1 dock_split_2=0 dock_split_3=0 dock_hsplit_1=0 -dock_hsplit_2=703 -dock_hsplit_3=-432 +dock_hsplit_2=270 +dock_hsplit_3=-270 dock_hsplit_4=0 dock_3="Scene,Import" dock_4="FileSystem" @@ -16,11 +16,11 @@ dock_5="Inspector,Node,History" [EditorNode] -open_scenes=["res://scenes/3DWorld.tscn", "res://scenes/Game.tscn", "res://scenes/HUD.tscn", "res://scenes/WorldGeneration.tscn"] +open_scenes=["res://scenes/WorldGeneration.tscn", "res://scenes/3DWorld.tscn"] [ScriptEditor] -open_scripts=["res://scripts/Camera3D.gd", "res://scripts/Chunks.gd", "res://scripts/Global.gd", "res://scripts/Map.gd", "res://scripts/World.gd", "res://scripts/WorldGeneration.gd"] -open_help=["Image", "ImageTexture", "Object", "Texture2D", "TextureRect"] -script_split_offset=518 +open_scripts=["res://scripts/Camera3D.gd", "res://scripts/Chunks.gd", "res://scripts/Entity.gd", "res://scripts/Map.gd", "res://scripts/World.gd", "res://scripts/WorldGeneration.gd"] +open_help=[] +script_split_offset=70 list_split_offset=0 diff --git a/.godot/editor/filesystem_cache8 b/.godot/editor/filesystem_cache8 index 4453bab..0c3def4 100644 --- a/.godot/editor/filesystem_cache8 +++ b/.godot/editor/filesystem_cache8 @@ -1,41 +1,43 @@ 2a60927148abd1d33b818b535e306557 -::res://::1677100541 -icon.png::CompressedTexture2D::4672001524465425285::1676574357::1676664790::1::::<><>:: -README.md::TextFile::-1::1676578345::0::1::::<><>:: -::res://assets/::1677084140 -environment.tres::Environment::8600195688495287911::1677084140::0::1::::<><>:: -water.gdshader::Shader::-1::1677015851::0::1::::<><>:: -::res://assets/blocs/::1677015905 -0_sides.glb::PackedScene::7036506600244808940::1677003366::1677015904::1::::<><>::uid://b53thhe2sa6x0 -0_sides_grass.png::CompressedTexture2D::4551055068461159203::1677003427::1677015904::1::::<><>:: -1_side.glb::PackedScene::5601417408597394875::1677003385::1677015904::1::::<><>::uid://cfr1s2lqng8eo -1_side_grass.png::CompressedTexture2D::5160492229365512154::1677003427::1677015904::1::::<><>:: -2_side_angle.glb::PackedScene::8081534368546731168::1677003412::1677015905::1::::<><>::uid://c0xxcgdm7s2ak -2_side_angle_grass.png::CompressedTexture2D::6576443529465065670::1677003428::1677015904::1::::<><>:: -2_side_opposite.glb::PackedScene::3205848216587541745::1677003400::1677015905::1::::<><>::uid://bffdt5if5pnda -2_side_opposite_grass.png::CompressedTexture2D::2747904460042865810::1677003428::1677015904::1::::<><>:: -3_side_angle.glb::PackedScene::4729157567058414100::1677003421::1677015905::1::::<><>::uid://kc4nqve8lx14 -3_side_angle_grass.png::CompressedTexture2D::707802073040230165::1677003428::1677015904::1::::<><>:: -4_sides.glb::PackedScene::139420628202576697::1677003373::1677015905::1::::<><>::uid://dlo0nmochxy4u -4_sides_grass.png::CompressedTexture2D::7961782411803042998::1677003428::1677015904::1::::<><>:: -blocs.meshlib::MeshLibrary::2672089234605318559::1677003618::0::1::::<><>::uid://b53thhe2sa6x0<>uid://cfr1s2lqng8eo<>uid://c0xxcgdm7s2ak<>uid://bffdt5if5pnda<>uid://kc4nqve8lx14<>uid://dlo0nmochxy4u -::res://assets/images/::1677081411 -colors.png::CompressedTexture2D::2558953172502239658::1671825732::1677081411::1::::<><>:: -grass_top.png::CompressedTexture2D::3263707750932711970::1676919772::1677078622::1::::<><>:: -::res://assets/tests/::1677018084 -blocs.meshlib::MeshLibrary::7399659330532602926::1677018084::0::1::::<><>::uid://ced8eb4jbj1v5 -bloc_complet.glb::PackedScene::4200726942972538951::1677017973::1677018069::1::::<><>::uid://ced8eb4jbj1v5 -bloc_complet_grass.png::CompressedTexture2D::5061800776870741768::1677018069::1677018069::1::::<><>:: -::res://scenes/::1677100278 -3DWorld.tscn::PackedScene::3599411568061770725::1677100278::0::1::::<><>::uid://becm6iybpdly2<>res://scripts/Chunks.gd<>res://scripts/Camera3D.gd<>res://assets/water.gdshader<>uid://dur874iy77jjr -Game.tscn::PackedScene::9075056520838281688::1677100278::0::1::::<><>::uid://brjt1u0dgbmi4<>uid://d1sd7pxywgunu -HUD.tscn::PackedScene::9021570906125339886::1677100278::0::1::::<><>::res://scripts/Map.gd -Map.tscn::PackedScene::4214730063588096553::1677100278::0::1::::<><>::uid://bcptt5eiydwq1<>res://scripts/Map.gd -WorldGeneration.tscn::PackedScene::1108513713840477990::1677100278::0::1::::<><>::res://scripts/WorldGeneration.gd -::res://scripts/::1677100526 -Camera3D.gd::GDScript::-1::1676664790::0::1::::<>Camera3D<>:: -Chunks.gd::GDScript::-1::1677092524::0::1::::<>GridMap<>:: -Global.gd::GDScript::-1::1677079629::0::1::::<>Node<>:: -Map.gd::GDScript::-1::1677100526::0::1::::<>TextureRect<>:: -World.gd::GDScript::-1::1677092596::0::1::::World<>Node<>:: -WorldGeneration.gd::GDScript::-1::1677093440::0::1::::<>Control<>:: +::res://::1677194650 +export_presets.cfg::TextFile::-1::1677194603::0::1::::<><>:: +icon.png::CompressedTexture2D::4672001524465425285::1676578483::1676582905::1::::<><>:: +README.md::TextFile::-1::1676578483::0::1::::<><>:: +::res://assets/::1677177540 +environment.tres::Environment::8600195688495287911::1677177540::0::1::::<><>:: +water.gdshader::Shader::-1::1677174532::0::1::::<><>:: +::res://assets/blocs/::1677174532 +0_sides.glb::PackedScene::7036506600244808940::1677174532::1677174532::1::::<><>:: +0_sides_grass.png::CompressedTexture2D::4551055068461159203::1677174532::1677174532::1::::<><>:: +1_side.glb::PackedScene::5601417408597394875::1677174532::1677174532::1::::<><>:: +1_side_grass.png::CompressedTexture2D::5160492229365512154::1677174532::1677174532::1::::<><>:: +2_side_angle.glb::PackedScene::8081534368546731168::1677174532::1677174532::1::::<><>:: +2_side_angle_grass.png::CompressedTexture2D::6576443529465065670::1677174532::1677174532::1::::<><>:: +2_side_opposite.glb::PackedScene::3205848216587541745::1677174532::1677174532::1::::<><>:: +2_side_opposite_grass.png::CompressedTexture2D::2747904460042865810::1677174532::1677174532::1::::<><>:: +3_side_angle.glb::PackedScene::4729157567058414100::1677174532::1677174532::1::::<><>:: +3_side_angle_grass.png::CompressedTexture2D::707802073040230165::1677174532::1677174532::1::::<><>:: +4_sides.glb::PackedScene::139420628202576697::1677174532::1677174532::1::::<><>:: +4_sides_grass.png::CompressedTexture2D::7961782411803042998::1677174532::1677174532::1::::<><>:: +blocs.meshlib::MeshLibrary::2672089234605318559::1677174532::0::1::::<><>::uid://b53thhe2sa6x0<>uid://cfr1s2lqng8eo<>uid://c0xxcgdm7s2ak<>uid://bffdt5if5pnda<>uid://kc4nqve8lx14<>uid://dlo0nmochxy4u +::res://assets/images/::1677174532 +colors.png::CompressedTexture2D::2558953172502239658::1677174532::1677174532::1::::<><>:: +grass_top.png::CompressedTexture2D::3263707750932711970::1677174532::1677174532::1::::<><>:: +::res://assets/test/::1677177509 +bloc_complet.glb::PackedScene::1436864023732800907::1677175567::1677177205::1::::<><>::uid://chgapiyga3x6o<>uid://cmoaaucso40hs +bloc_complet_albedo.png::CompressedTexture2D::5276576783821208744::1677177183::1677177210::1::::<><>:: +bloc_complet_normal.png::CompressedTexture2D::5644009833993754604::1677177183::1677177214::1::::<><>:: +cube.meshlib::MeshLibrary::1045877065266806205::1677177509::0::1::::<><>::uid://chgapiyga3x6o<>uid://cmoaaucso40hs +::res://scenes/::1677194529 +3DWorld.tscn::PackedScene::3599411568061770725::1677194529::0::1::::<><>::uid://becm6iybpdly2<>res://scripts/Chunks.gd<>res://scripts/Camera3D.gd<>res://assets/water.gdshader<>uid://dur874iy77jjr +Game.tscn::PackedScene::9075056520838281688::1677174532::0::1::::<><>::uid://brjt1u0dgbmi4<>uid://d1sd7pxywgunu +HUD.tscn::PackedScene::9021570906125339886::1677174532::0::1::::<><>::res://scripts/Map.gd +WorldGeneration.tscn::PackedScene::1108513713840477990::1677194529::0::1::::<><>::res://scripts/WorldGeneration.gd +::res://scripts/::1677194529 +Camera3D.gd::GDScript::-1::1677174532::0::1::::<>Camera3D<>:: +Chunks.gd::GDScript::-1::1677194529::0::1::::<>GridMap<>:: +Entity.gd::GDScript::-1::1677190734::0::1::::Entity<>Node<>:: +Global.gd::GDScript::-1::1677174532::0::1::::<>Node<>:: +Map.gd::GDScript::-1::1677190875::0::1::::<>TextureRect<>:: +World.gd::GDScript::-1::1677190705::0::1::::World<>Node<>:: +WorldGeneration.gd::GDScript::-1::1677193585::0::1::::<>Control<>:: diff --git a/.godot/editor/filesystem_update4 b/.godot/editor/filesystem_update4 index f99a2f4..b862ef1 100644 --- a/.godot/editor/filesystem_update4 +++ b/.godot/editor/filesystem_update4 @@ -1,8 +1,3 @@ -res://scenes/3DWorld.tscn -res://assets/environment.tres -res://scenes/Game.tscn -res://scenes/HUD.tscn -res://scenes/Map.tscn res://scenes/WorldGeneration.tscn -res://scripts/Map.gd -res://scripts/WorldGeneration.gd +res://assets/environment.tres +res://scenes/3DWorld.tscn diff --git a/.godot/editor/project_metadata.cfg b/.godot/editor/project_metadata.cfg index 5afdbb7..a614537 100644 --- a/.godot/editor/project_metadata.cfg +++ b/.godot/editor/project_metadata.cfg @@ -1,6 +1,6 @@ [editor_metadata] -executable_path="/home/valentin/Téléchargements/Godot_v4.0-rc3_linux.x86_64" +executable_path="/home/valentin/Téléchargements/Godot_v4.0-rc2_linux.x86_64" tile_source_sort=0 use_advanced_connections=false @@ -11,8 +11,8 @@ run_reload_scripts=true [recent_files] -scenes=["res://scenes/WorldGeneration.tscn", "res://scenes/Map.tscn", "res://scenes/HUD.tscn", "res://scenes/Game.tscn", "res://scenes/3DWorld.tscn", "res://scenes/world_generation.tscn", "res://MeshLib.tscn", "res://scenes/GridMap.tscn", "res://GridMap.tscn", "res://blocs/my_first_bloc.glb"] -scripts=["ImageTexture", "Texture2D", "TextureRect", "Image", "Object", "res://scripts/Map.gd", "res://scripts/Chunks.gd", "res://scripts/WorldGeneration.gd", "res://WorldGeneration.gd", "res://scripts/World.gd"] +scenes=["res://scenes/3DWorld.tscn", "res://scenes/WorldGeneration.tscn", "res://assets/test/bloc_complet.glb", "res://scenes/Character.tscn", "res://scenes/Map.tscn", "res://scenes/HUD.tscn", "res://scenes/Game.tscn", "res://scenes/world_generation.tscn", "res://MeshLib.tscn", "res://scenes/GridMap.tscn"] +scripts=["res://scripts/Camera3D.gd", "res://scripts/Map.gd", "res://scripts/Entity.gd", "res://scripts/Bloc.gd", "res://scripts/Chunks.gd", "res://scripts/World.gd", "res://scripts/Character.gd", "res://scripts/WorldGeneration.gd", "ImageTexture", "Texture2D"] [color_picker] @@ -22,7 +22,7 @@ recent_presets=PackedColorArray(1, 1, 1, 1, 0.72549, 0.74902, 0.0156863, 1, 0.74 project_settings=Rect2(830, 1124, 1531, 700) search_help=Rect2(684, 826, 1368, 912) -export=Rect2(468, 286, 1800, 1400) +export=Rect2(468, 69, 1800, 1011) [project_settings] diff --git a/.godot/editor/recent_dirs b/.godot/editor/recent_dirs index bf600fb..b333705 100644 --- a/.godot/editor/recent_dirs +++ b/.godot/editor/recent_dirs @@ -1,7 +1,7 @@ +/home/valentin/Documents/Gridmap/scripts res://scripts +res://assets/test res://scenes -res://assets/tests -/home/valentin/Documents/Gridmap/scripts res:// res://assets /home/valentin/Documents/Gridmap diff --git a/.godot/editor/script_editor_cache.cfg b/.godot/editor/script_editor_cache.cfg index 82c7c5f..610e99b 100644 --- a/.godot/editor/script_editor_cache.cfg +++ b/.godot/editor/script_editor_cache.cfg @@ -1,74 +1,78 @@ -[res://scripts/Global.gd] +[res://scripts/WorldGeneration.gd] state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 22, +"column": 0, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 31, -"scroll_position": 11.0, +"row": 14, +"scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" } -[res://scripts/Camera3D.gd] +[res://scripts/World.gd] state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 0, +"column": 12, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 0, -"scroll_position": 0.0, +"row": 63, +"scroll_position": 6.0, "selection": false, "syntax_highlighter": "GDScript" } -[res://scripts/World.gd] +[res://scripts/Chunks.gd] state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 0, +"column": 20, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 46, -"scroll_position": 28.0, -"selection": false, +"row": 110, +"scroll_position": 0.0, +"selection": true, +"selection_from_column": 20, +"selection_from_line": 110, +"selection_to_column": 67, +"selection_to_line": 114, "syntax_highlighter": "GDScript" } -[res://scripts/Map.gd] +[res://scripts/Entity.gd] state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 5, +"column": 25, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 8, +"row": 7, "scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" } -[res://scripts/WorldGeneration.gd] +[res://scripts/Map.gd] state={ "bookmarks": PackedInt32Array(), "breakpoints": PackedInt32Array(), -"column": 23, +"column": 26, "folded_lines": Array[int]([]), "h_scroll_position": 0, -"row": 18, -"scroll_position": 10.0, +"row": 12, +"scroll_position": 0.0, "selection": false, "syntax_highlighter": "GDScript" } -[res://scripts/Chunks.gd] +[res://scripts/Camera3D.gd] state={ "bookmarks": PackedInt32Array(), @@ -77,7 +81,7 @@ state={ "folded_lines": Array[int]([]), "h_scroll_position": 0, "row": 0, -"scroll_position": 0.0, +"scroll_position": 12.0, "selection": false, "syntax_highlighter": "GDScript" } diff --git a/.godot/global_script_class_cache.cfg b/.godot/global_script_class_cache.cfg index 5899640..f2827c4 100644 --- a/.godot/global_script_class_cache.cfg +++ b/.godot/global_script_class_cache.cfg @@ -6,6 +6,12 @@ list=Array[Dictionary]([{ "path": "res://utils/camera/CameraController.gd" }, { "base": &"Node", +"class": &"Entity", +"icon": "", +"language": &"GDScript", +"path": "res://scripts/Entity.gd" +}, { +"base": &"Node", "class": &"World", "icon": "", "language": &"GDScript", diff --git a/.godot/imported/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.md5 b/.godot/imported/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.md5 new file mode 100644 index 0000000..8d13488 --- /dev/null +++ b/.godot/imported/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.md5 @@ -0,0 +1,3 @@ +source_md5="dd6d69728f1e6cf0737febc43f78b625" +dest_md5="3eb390bfa3cdfe1b0a37de377fedf38d" + diff --git a/.godot/imported/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.scn b/.godot/imported/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.scn new file mode 100644 index 0000000..a81c642 Binary files /dev/null and b/.godot/imported/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.scn differ diff --git a/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.bptc.ctex b/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.bptc.ctex new file mode 100644 index 0000000..531d20d Binary files /dev/null and b/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.bptc.ctex differ diff --git a/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.ctex b/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.ctex new file mode 100644 index 0000000..2896f73 Binary files /dev/null and b/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.ctex differ diff --git a/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.md5 b/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.md5 new file mode 100644 index 0000000..2debc29 --- /dev/null +++ b/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.md5 @@ -0,0 +1,3 @@ +source_md5="663ed34c11220700fbd6e8a73c9b7b6a" +dest_md5="80f60927ff60435698b02edcd4085ac7" + diff --git a/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.s3tc.ctex b/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.s3tc.ctex new file mode 100644 index 0000000..3eb1809 Binary files /dev/null and b/.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.s3tc.ctex differ diff --git a/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.bptc.ctex b/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.bptc.ctex new file mode 100644 index 0000000..518d8fc Binary files /dev/null and b/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.bptc.ctex differ diff --git a/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.ctex b/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.ctex new file mode 100644 index 0000000..bbaeff1 Binary files /dev/null and b/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.ctex differ diff --git a/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.md5 b/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.md5 new file mode 100644 index 0000000..17f061a --- /dev/null +++ b/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.md5 @@ -0,0 +1,3 @@ +source_md5="d74e8f37219f33f95741c798386e625b" +dest_md5="489ed7520194a75f639053b1d11fc5be" + diff --git a/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.s3tc.ctex b/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.s3tc.ctex new file mode 100644 index 0000000..1b8e00c Binary files /dev/null and b/.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.s3tc.ctex differ diff --git a/.godot/shader_cache/SceneForwardClusteredShaderRD/01a9808236399f8ebd21e87d1a37f24fc50c8317697ad5d2c97d16b7efa43242/958fe242f7620728a7a7b9522267b92135768b58.cache b/.godot/shader_cache/SceneForwardClusteredShaderRD/01a9808236399f8ebd21e87d1a37f24fc50c8317697ad5d2c97d16b7efa43242/958fe242f7620728a7a7b9522267b92135768b58.cache new file mode 100644 index 0000000..1d618f3 Binary files /dev/null and b/.godot/shader_cache/SceneForwardClusteredShaderRD/01a9808236399f8ebd21e87d1a37f24fc50c8317697ad5d2c97d16b7efa43242/958fe242f7620728a7a7b9522267b92135768b58.cache differ diff --git a/.godot/shader_cache/SceneForwardClusteredShaderRD/01a9808236399f8ebd21e87d1a37f24fc50c8317697ad5d2c97d16b7efa43242/adcca0c58d18f052ff75ecdaa3dbb219f5d6cbc4.cache b/.godot/shader_cache/SceneForwardClusteredShaderRD/01a9808236399f8ebd21e87d1a37f24fc50c8317697ad5d2c97d16b7efa43242/adcca0c58d18f052ff75ecdaa3dbb219f5d6cbc4.cache new file mode 100644 index 0000000..ff5e729 Binary files /dev/null and b/.godot/shader_cache/SceneForwardClusteredShaderRD/01a9808236399f8ebd21e87d1a37f24fc50c8317697ad5d2c97d16b7efa43242/adcca0c58d18f052ff75ecdaa3dbb219f5d6cbc4.cache differ diff --git a/.godot/uid_cache.bin b/.godot/uid_cache.bin index 7e49a00..94e08f1 100644 Binary files a/.godot/uid_cache.bin and b/.godot/uid_cache.bin differ diff --git a/assets/test/bloc_complet.glb b/assets/test/bloc_complet.glb new file mode 100644 index 0000000..8f62af7 Binary files /dev/null and b/assets/test/bloc_complet.glb differ diff --git a/assets/test/bloc_complet.glb.import b/assets/test/bloc_complet.glb.import new file mode 100644 index 0000000..6ee86b2 --- /dev/null +++ b/assets/test/bloc_complet.glb.import @@ -0,0 +1,32 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://uqa68jcxs6tj" +path="res://.godot/imported/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.scn" + +[deps] + +source_file="res://assets/test/bloc_complet.glb" +dest_files=["res://.godot/imported/bloc_complet.glb-994aa1e23eb71978e33bad80f3deaabb.scn"] + +[params] + +nodes/root_type="Node3D" +nodes/root_name="Scene Root" +nodes/apply_root_scale=true +nodes/root_scale=1.0 +meshes/ensure_tangents=true +meshes/generate_lods=false +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +import_script/path="" +_subresources={} +gltf/embedded_image_handling=1 diff --git a/assets/test/bloc_complet_albedo.png b/assets/test/bloc_complet_albedo.png new file mode 100644 index 0000000..c17ec76 Binary files /dev/null and b/assets/test/bloc_complet_albedo.png differ diff --git a/assets/test/bloc_complet_albedo.png.import b/assets/test/bloc_complet_albedo.png.import new file mode 100644 index 0000000..3a09b0f --- /dev/null +++ b/assets/test/bloc_complet_albedo.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://chgapiyga3x6o" +path.bptc="res://.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.bptc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} +generator_parameters={} + +[deps] + +source_file="res://assets/test/bloc_complet_albedo.png" +dest_files=["res://.godot/imported/bloc_complet_albedo.png-d517f1262761d1fe31bd54f51927d7e2.bptc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=true +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/assets/test/bloc_complet_normal.png b/assets/test/bloc_complet_normal.png new file mode 100644 index 0000000..59d8ed7 Binary files /dev/null and b/assets/test/bloc_complet_normal.png differ diff --git a/assets/test/bloc_complet_normal.png.import b/assets/test/bloc_complet_normal.png.import new file mode 100644 index 0000000..2d90d8a --- /dev/null +++ b/assets/test/bloc_complet_normal.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cmoaaucso40hs" +path.bptc="res://.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.bptc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} +generator_parameters={} + +[deps] + +source_file="res://assets/test/bloc_complet_normal.png" +dest_files=["res://.godot/imported/bloc_complet_normal.png-cbf8a7e820fdc110c6faf4c702e03006.bptc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=true +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=1 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=1 +roughness/src_normal="res://assets/test/bloc_complet_normal.png" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0 diff --git a/assets/test/cube.meshlib b/assets/test/cube.meshlib new file mode 100644 index 0000000..4a43e12 Binary files /dev/null and b/assets/test/cube.meshlib differ diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..2d76d8a --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,41 @@ +[preset.0] + +name="Linux/X11" +platform="Linux/X11" +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.0.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_script=1 +binary_format/embed_pck=false +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" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="#!/usr/bin/env bash +export DISPLAY=:0 +unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\" +\"{temp_dir}/{exe_name}\" {cmd_args}" +ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash +kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\") +rm -rf \"{temp_dir}\"" diff --git a/scripts/Chunks.gd b/scripts/Chunks.gd index ca89c2b..f4c5bbb 100644 --- a/scripts/Chunks.gd +++ b/scripts/Chunks.gd @@ -7,17 +7,24 @@ extends GridMap @onready var camera = $Camera3D +@onready var multimeshInstances = [] + func _ready(): setGridChunk(0, ChunkWidth, 0, ChunkHeight) func generateGridChunk(cameraPos: Vector3) -> void: clear() + for instance in multimeshInstances: + remove_child(instance) + multimeshInstances = [] + var chunkCenter = local_to_map(cameraPos) var rowStart: float = chunkCenter.z - (ChunkHeight / 2) var rowEnd: float = chunkCenter.z + (ChunkHeight / 2) var columnStart: float = chunkCenter.x - (ChunkWidth / 2) var columnEnd: float = chunkCenter.x + (ChunkWidth / 2) setGridChunk(columnStart, columnEnd, rowStart, rowEnd) + setEntities(columnStart, columnEnd, rowStart, rowEnd) func setGridChunk(columnStart: float, columnEnd: float, rowStart: float, rowEnd: float) -> void: if columnStart < 0 : @@ -25,83 +32,101 @@ func setGridChunk(columnStart: float, columnEnd: float, rowStart: float, rowEnd: if rowStart < 0 : rowStart = 0 if columnEnd > Global.world.width - 1 : - columnEnd =Global. world.width - 2 + columnEnd =Global.world.width - 2 if rowEnd > Global.world.height - 1 : rowEnd = Global.world.height - 2 for mz in range(rowStart, rowEnd): for mx in range(columnStart, columnEnd): - var my: float = Global.world.find_elevation(Vector2(mx, mz)) + var bloc = Global.world.get_bloc(Vector2(mx, mz)) + var my: float = bloc.y var meshID var mesh_rotation - if my > 0: + if bloc.type != 0: var neighbours = Global.world.get_neighbours_4_at_same_height(Vector2(mx, mz)) - match neighbours: - Global.directions_4.RIGHT: - meshID = Global.bloc_sides_id.SIDE_3 - mesh_rotation = Global.GRID_ROTATION[3] - - Global.directions_4.LEFT: - meshID = Global.bloc_sides_id.SIDE_3 - mesh_rotation = Global.GRID_ROTATION[1] - - Global.directions_4.LEFT + Global.directions_4.RIGHT: - meshID = Global.bloc_sides_id.SIDE_2_OPPOSITE - mesh_rotation = Global.GRID_ROTATION[0] - - Global.directions_4.BOTTOM: - meshID = Global.bloc_sides_id.SIDE_3 - mesh_rotation = Global.GRID_ROTATION[0] - - Global.directions_4.BOTTOM + Global.directions_4.RIGHT: - meshID = Global.bloc_sides_id.SIDE_2_ANGLE - mesh_rotation = Global.GRID_ROTATION[3] - - Global.directions_4.BOTTOM + Global.directions_4.LEFT: - meshID = Global.bloc_sides_id.SIDE_2_ANGLE - mesh_rotation = Global.GRID_ROTATION[0] - - 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] - - Global.directions_4.TOP: - meshID = Global.bloc_sides_id.SIDE_3 - mesh_rotation = Global.GRID_ROTATION[2] - - Global.directions_4.TOP + Global.directions_4.RIGHT: - meshID = Global.bloc_sides_id.SIDE_2_ANGLE - mesh_rotation = Global.GRID_ROTATION[2] - - Global.directions_4.TOP + Global.directions_4.LEFT: - meshID = Global.bloc_sides_id.SIDE_2_ANGLE - mesh_rotation = Global.GRID_ROTATION[1] - - 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] - - Global.directions_4.TOP + Global.directions_4.BOTTOM: - meshID = Global.bloc_sides_id.SIDE_2_OPPOSITE - mesh_rotation = Global.GRID_ROTATION[1] - - 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] - - 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] - - 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] - - 0: - meshID = Global.bloc_sides_id.SIDE_4 - mesh_rotation = Global.GRID_ROTATION[0] + 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(columnStart: float, columnEnd: float, rowStart: float, rowEnd: float) -> void: + if columnStart < 0 : + columnStart = 0 + if rowStart < 0 : + rowStart = 0 + if columnEnd > Global.world.width - 1 : + columnEnd =Global.world.width - 2 + if rowEnd > Global.world.height - 1 : + rowEnd = Global.world.height - 2 + var multimesh = MultiMesh.new() + multimesh.mesh = CapsuleMesh.new() + multimesh.transform_format = MultiMesh.TRANSFORM_3D + var instances = [] + for mz in range(rowStart, rowEnd): + for mx in range(columnStart, columnEnd): + var bloc = Global.world.get_bloc(Vector2(mx, mz)) + if bloc.entity != -1: + instances.append(map_to_local(Vector3(bloc.x, bloc.y, bloc.z))) + + + multimesh.instance_count = instances.size() + for instance_index in multimesh.instance_count: + var transform := Transform3D() + transform.origin = instances[instance_index] + + multimesh.set_instance_transform(instance_index, transform) + + if instances.size(): + var multimesh_instance = MultiMeshInstance3D.new() + multimesh_instance.multimesh = multimesh + multimeshInstances.append(multimesh_instance) + add_child(multimeshInstances[multimeshInstances.size()-1]) + func _on_map_update_timer_timeout(): generateGridChunk(camera.global_transform.origin) diff --git a/scripts/Entity.gd b/scripts/Entity.gd new file mode 100644 index 0000000..f9784ec --- /dev/null +++ b/scripts/Entity.gd @@ -0,0 +1,8 @@ +extends Node + +class_name Entity + +var position: Vector2 + +func _init(position: Vector2): + self.position = position diff --git a/scripts/Map.gd b/scripts/Map.gd index 6ea614e..870038b 100644 --- a/scripts/Map.gd +++ b/scripts/Map.gd @@ -6,9 +6,11 @@ func _ready(): for x in Global.world.width: for z in Global.world.height: var pixel_color = Color("#00F") - var y = Global.world.find_elevation(Vector2(x, z)) - if y > 0: + var bloc = Global.world.get_bloc(Vector2(x, z)) + if bloc.type != 0: pixel_color = Color("#0F0") + if bloc.entity != -1: + pixel_color = Color("F00") img.set_pixel(x, z, pixel_color) texture = ImageTexture.create_from_image(img) diff --git a/scripts/World.gd b/scripts/World.gd index 472c3b5..673ea48 100644 --- a/scripts/World.gd +++ b/scripts/World.gd @@ -2,46 +2,64 @@ extends Node class_name World -var heightmap: Array +var heightMap: Array +var temperatureMap: Array +var moistureMap: Array + +var blocs: Array +var entities: Array + var width: int var height: int func get_neighbours_8_at_same_height(point: Vector2): var neighbours = 0 - var current_bloc = heightmap[point.x][point.y] - if heightmap[point.x-1][point.y-1] == current_bloc: + var current_bloc = heightMap[point.x][point.y] + if heightMap[point.x-1][point.y-1] == current_bloc: neighbours += Global.directions_8.TOP_LEFT - if heightmap[point.x][point.y-1] == current_bloc: + if heightMap[point.x][point.y-1] == current_bloc: neighbours += Global.directions_8.TOP - if heightmap[point.x+1][point.y-1] == current_bloc: + if heightMap[point.x+1][point.y-1] == current_bloc: neighbours += Global.directions_8.TOP_RIGHT - if heightmap[point.x+1][point.y] == current_bloc: + if heightMap[point.x+1][point.y] == current_bloc: neighbours += Global.directions_8.RIGHT - if heightmap[point.x+1][point.y+1] == current_bloc: + if heightMap[point.x+1][point.y+1] == current_bloc: neighbours += Global.directions_8.BOTTOM_RIGHT - if heightmap[point.x][point.y+1] == current_bloc: + if heightMap[point.x][point.y+1] == current_bloc: neighbours += Global.directions_8.BOTTOM - if heightmap[point.x-1][point.y+1] == current_bloc: + if heightMap[point.x-1][point.y+1] == current_bloc: neighbours += Global.directions_8.BOTTOM_LEFT - if heightmap[point.x-1][point.y] == current_bloc: + if heightMap[point.x-1][point.y] == current_bloc: neighbours += Global.directions_8.LEFT return neighbours func get_neighbours_4_at_same_height(point: Vector2): var neighbours = 0 - var current_bloc = heightmap[point.x][point.y] - if heightmap[point.x][point.y-1] == current_bloc: + var current_bloc = heightMap[point.x][point.y] + if heightMap[point.x][point.y-1] == current_bloc: neighbours += Global.directions_4.TOP - if heightmap[point.x+1][point.y] == current_bloc: + if heightMap[point.x+1][point.y] == current_bloc: neighbours += Global.directions_4.RIGHT - if heightmap[point.x][point.y+1] == current_bloc: + if heightMap[point.x][point.y+1] == current_bloc: neighbours += Global.directions_4.BOTTOM - if heightmap[point.x-1][point.y] == current_bloc: + if heightMap[point.x-1][point.y] == current_bloc: neighbours += Global.directions_4.LEFT return neighbours - -func find_elevation(point: Vector2): - return heightmap[point.x][point.y] +func get_bloc(point: Vector2): + var bloc = { + "x" = point.x, + "y" = heightMap[point.x][point.y], + "z" = point.y + } + for key in blocs[point.x][point.y].keys(): + bloc[key] = blocs[point.x][point.y][key] + + return bloc + +func add_entity(position: Vector2): + entities.append(Entity.new(position)) + blocs[position.x][position.y]["entity"] = entities.size() + pass diff --git a/scripts/WorldGeneration.gd b/scripts/WorldGeneration.gd index a27ee5e..6277b15 100644 --- a/scripts/WorldGeneration.gd +++ b/scripts/WorldGeneration.gd @@ -3,7 +3,11 @@ extends Control func _ready(): Global.world.width = 512 Global.world.height = 512 - Global.world.heightmap = generate_heightmap(Global.world.width, Global.world.height) + Global.world.heightMap = generate_heightmap(Global.world.width, Global.world.height) + Global.world.blocs = set_blocs(Global.world.width, Global.world.height, Global.world.heightMap) + + Global.world.add_entity(Vector2(10, 10)) + get_tree().change_scene_to_file("scenes/Game.tscn") func generate_heightmap(width, height): @@ -39,3 +43,20 @@ func generate_heightmap(width, height): # print(elevation) heightmap[x].append(floor(elevation)) return heightmap + +func set_blocs(width, height, heightmap): + var blocs = [] + for x in width: + blocs.append([]) + for y in height: + var bloc = { + "type": 0, + "entity": -1 + } + + if heightmap[x][y] > 0: + bloc.type = 1 + + blocs[x].append(bloc) + + return blocs