diff --git a/menu/LoadWorld.tscn b/menu/LoadWorld.tscn index 49e59ce..b886a3e 100644 --- a/menu/LoadWorld.tscn +++ b/menu/LoadWorld.tscn @@ -20,33 +20,33 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -margin_left = -240.0 -margin_top = -131.5 -margin_right = 240.0 -margin_bottom = 131.5 +margin_left = -375.0 +margin_top = -156.0 +margin_right = 375.0 +margin_bottom = 156.0 [node name="Title" type="Label" parent="VBoxContainer"] -margin_right = 480.0 -margin_bottom = 64.0 +margin_right = 750.0 +margin_bottom = 100.0 text = "Charger un monde" align = 1 [node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] -margin_top = 68.0 -margin_right = 480.0 -margin_bottom = 218.0 +margin_top = 104.0 +margin_right = 750.0 +margin_bottom = 254.0 rect_min_size = Vector2( 0, 150 ) [node name="WorldList" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 222.0 -margin_right = 480.0 -margin_bottom = 263.0 +margin_top = 258.0 +margin_right = 750.0 +margin_bottom = 312.0 [node name="CancelButton" type="Button" parent="VBoxContainer/HBoxContainer"] -margin_right = 480.0 -margin_bottom = 41.0 +margin_right = 750.0 +margin_bottom = 54.0 size_flags_horizontal = 3 text = "Annuler" diff --git a/menu/MainMenu.tscn b/menu/MainMenu.tscn index 1193b0f..cc63e15 100644 --- a/menu/MainMenu.tscn +++ b/menu/MainMenu.tscn @@ -16,35 +16,35 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -margin_left = -158.0 -margin_top = -74.5 -margin_right = 158.0 -margin_bottom = 74.5 +margin_left = -159.0 +margin_top = -226.0 +margin_right = 159.0 +margin_bottom = 226.0 [node name="Title" type="Label" parent="VBoxContainer"] -margin_right = 316.0 -margin_bottom = 131.0 +margin_right = 360.0 +margin_bottom = 203.0 text = "Societer " align = 1 [node name="NewButton" type="Button" parent="VBoxContainer"] -margin_top = 135.0 -margin_right = 316.0 -margin_bottom = 176.0 +margin_top = 207.0 +margin_right = 360.0 +margin_bottom = 261.0 theme = SubResource( 1 ) text = "Nouveau monde" [node name="LoadButton" type="Button" parent="VBoxContainer"] -margin_top = 180.0 -margin_right = 316.0 -margin_bottom = 221.0 +margin_top = 265.0 +margin_right = 360.0 +margin_bottom = 319.0 text = "Charger un monde" [node name="QuitButton" type="Button" parent="VBoxContainer"] -margin_top = 225.0 -margin_right = 316.0 -margin_bottom = 266.0 +margin_top = 323.0 +margin_right = 360.0 +margin_bottom = 377.0 text = "Quitter" [node name="Viewport" type="Viewport" parent="."] diff --git a/menu/NewWorld.tscn b/menu/NewWorld.tscn index 6486cc1..fcbdffe 100644 --- a/menu/NewWorld.tscn +++ b/menu/NewWorld.tscn @@ -20,43 +20,43 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -margin_left = -195.0 -margin_top = -85.0 -margin_right = 195.0 -margin_bottom = 85.0 +margin_left = -320.0 +margin_top = -109.5 +margin_right = 320.0 +margin_bottom = 109.5 [node name="Title" type="Label" parent="VBoxContainer"] -margin_right = 390.0 -margin_bottom = 64.0 +margin_right = 640.0 +margin_bottom = 100.0 text = "Nouveau monde" align = 1 [node name="Label" type="Label" parent="VBoxContainer"] -margin_top = 68.0 -margin_right = 390.0 -margin_bottom = 97.0 +margin_top = 104.0 +margin_right = 640.0 +margin_bottom = 133.0 custom_fonts/font = SubResource( 1 ) text = "Nom du monde :" [node name="LineEdit" type="LineEdit" parent="VBoxContainer"] -margin_top = 101.0 -margin_right = 390.0 -margin_bottom = 125.0 +margin_top = 137.0 +margin_right = 640.0 +margin_bottom = 161.0 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] -margin_top = 129.0 -margin_right = 390.0 -margin_bottom = 170.0 +margin_top = 165.0 +margin_right = 640.0 +margin_bottom = 219.0 [node name="CreateButton" type="Button" parent="VBoxContainer/HBoxContainer"] -margin_right = 247.0 -margin_bottom = 41.0 +margin_right = 156.0 +margin_bottom = 54.0 text = "Nouveau monde" [node name="CancelButton" type="Button" parent="VBoxContainer/HBoxContainer"] -margin_left = 251.0 -margin_right = 390.0 -margin_bottom = 41.0 +margin_left = 160.0 +margin_right = 640.0 +margin_bottom = 54.0 size_flags_horizontal = 3 text = "Annuler" diff --git a/project.godot b/project.godot index 3ec1e5c..f7a4337 100644 --- a/project.godot +++ b/project.godot @@ -97,4 +97,5 @@ common/enable_pause_aware_picking=true [rendering] +2d/options/ninepatch_mode=0 environment/default_environment="res://world/default_env.tres" diff --git a/theme/fonts/Kenney Blocks.ttf b/theme/fonts/Kenney Blocks.ttf new file mode 100644 index 0000000..d3aa6b5 Binary files /dev/null and b/theme/fonts/Kenney Blocks.ttf differ diff --git a/theme/fonts/Kenney Bold.ttf b/theme/fonts/Kenney Bold.ttf new file mode 100644 index 0000000..ece4612 Binary files /dev/null and b/theme/fonts/Kenney Bold.ttf differ diff --git a/theme/fonts/Kenney Future Narrow.ttf b/theme/fonts/Kenney Future Narrow.ttf new file mode 100644 index 0000000..c4cc8a0 Binary files /dev/null and b/theme/fonts/Kenney Future Narrow.ttf differ diff --git a/theme/fonts/Kenney Future Square.ttf b/theme/fonts/Kenney Future Square.ttf new file mode 100644 index 0000000..ced44b7 Binary files /dev/null and b/theme/fonts/Kenney Future Square.ttf differ diff --git a/theme/fonts/Kenney Future.ttf b/theme/fonts/Kenney Future.ttf new file mode 100644 index 0000000..17e2b6c Binary files /dev/null and b/theme/fonts/Kenney Future.ttf differ diff --git a/theme/fonts/Kenney High Square.ttf b/theme/fonts/Kenney High Square.ttf new file mode 100644 index 0000000..da7cd3f Binary files /dev/null and b/theme/fonts/Kenney High Square.ttf differ diff --git a/theme/fonts/Kenney High.ttf b/theme/fonts/Kenney High.ttf new file mode 100644 index 0000000..e8509bd Binary files /dev/null and b/theme/fonts/Kenney High.ttf differ diff --git a/theme/fonts/Kenney Mini Square Mono.ttf b/theme/fonts/Kenney Mini Square Mono.ttf new file mode 100644 index 0000000..33c1fd6 Binary files /dev/null and b/theme/fonts/Kenney Mini Square Mono.ttf differ diff --git a/theme/fonts/Kenney Mini Square.ttf b/theme/fonts/Kenney Mini Square.ttf new file mode 100644 index 0000000..d0d9c2f Binary files /dev/null and b/theme/fonts/Kenney Mini Square.ttf differ diff --git a/theme/fonts/Kenney Mini.ttf b/theme/fonts/Kenney Mini.ttf new file mode 100644 index 0000000..baa81b5 Binary files /dev/null and b/theme/fonts/Kenney Mini.ttf differ diff --git a/theme/fonts/Kenney Pixel Square.ttf b/theme/fonts/Kenney Pixel Square.ttf new file mode 100644 index 0000000..d84d78a Binary files /dev/null and b/theme/fonts/Kenney Pixel Square.ttf differ diff --git a/theme/fonts/Kenney Pixel.ttf b/theme/fonts/Kenney Pixel.ttf new file mode 100644 index 0000000..0020733 Binary files /dev/null and b/theme/fonts/Kenney Pixel.ttf differ diff --git a/theme/fonts/Kenney Rocket Square.ttf b/theme/fonts/Kenney Rocket Square.ttf new file mode 100644 index 0000000..8a033f4 Binary files /dev/null and b/theme/fonts/Kenney Rocket Square.ttf differ diff --git a/theme/fonts/Kenney Rocket.ttf b/theme/fonts/Kenney Rocket.ttf new file mode 100644 index 0000000..e7d8feb Binary files /dev/null and b/theme/fonts/Kenney Rocket.ttf differ diff --git a/theme/fonts/Kenney Space.ttf b/theme/fonts/Kenney Space.ttf new file mode 100644 index 0000000..0616cad Binary files /dev/null and b/theme/fonts/Kenney Space.ttf differ diff --git a/theme/fonts/Kenney Thick.ttf b/theme/fonts/Kenney Thick.ttf new file mode 100644 index 0000000..e5fa438 Binary files /dev/null and b/theme/fonts/Kenney Thick.ttf differ diff --git a/theme/imgs/buttonLong_brown.png b/theme/imgs/buttonLong_brown.png new file mode 100644 index 0000000..c93e6c2 Binary files /dev/null and b/theme/imgs/buttonLong_brown.png differ diff --git a/theme/imgs/buttonLong_brown.png.import b/theme/imgs/buttonLong_brown.png.import new file mode 100644 index 0000000..e80205b --- /dev/null +++ b/theme/imgs/buttonLong_brown.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/buttonLong_brown.png-5be1a5944a1232da168d403ed320e33e.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://theme/imgs/buttonLong_brown.png" +dest_files=[ "res://.import/buttonLong_brown.png-5be1a5944a1232da168d403ed320e33e.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/theme/imgs/buttonLong_brown_pressed.png b/theme/imgs/buttonLong_brown_pressed.png new file mode 100644 index 0000000..7785d99 Binary files /dev/null and b/theme/imgs/buttonLong_brown_pressed.png differ diff --git a/theme/imgs/buttonLong_brown_pressed.png.import b/theme/imgs/buttonLong_brown_pressed.png.import new file mode 100644 index 0000000..3f5b4d0 --- /dev/null +++ b/theme/imgs/buttonLong_brown_pressed.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/buttonLong_brown_pressed.png-7d31ee21a8928f9212d666cf81b88bac.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://theme/imgs/buttonLong_brown_pressed.png" +dest_files=[ "res://.import/buttonLong_brown_pressed.png-7d31ee21a8928f9212d666cf81b88bac.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/theme/theme.tres b/theme/theme.tres index 6941bd0..a5d588a 100644 --- a/theme/theme.tres +++ b/theme/theme.tres @@ -1,82 +1,56 @@ -[gd_resource type="Theme" load_steps=21 format=2] +[gd_resource type="Theme" load_steps=11 format=2] -[ext_resource path="res://theme/fonts/monogram.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://theme/imgs/buttonLong_brown_pressed.png" type="Texture" id=2] +[ext_resource path="res://theme/fonts/Kenney Mini Square.ttf" type="DynamicFontData" id=3] +[ext_resource path="res://theme/imgs/buttonLong_brown.png" type="Texture" id=4] -[sub_resource type="DynamicFontData" id=1] -font_path = "res://theme/fonts/monogram.ttf" - -[sub_resource type="DynamicFont" id=2] -size = 50 -font_data = SubResource( 1 ) - -[sub_resource type="Gradient" id=12] -interpolation_mode = 1 -colors = PoolColorArray( 0.596078, 0.596078, 0.596078, 1, 1, 1, 1, 1 ) - -[sub_resource type="GradientTexture" id=13] -gradient = SubResource( 12 ) - -[sub_resource type="GradientTexture" id=14] +[sub_resource type="DynamicFont" id=16] +font_data = ExtResource( 3 ) [sub_resource type="StyleBoxTexture" id=15] -texture = SubResource( 14 ) -normal_map = SubResource( 13 ) -region_rect = Rect2( 0, 0, 2048, 1 ) - -[sub_resource type="Gradient" id=16] -interpolation_mode = 1 -colors = PoolColorArray( 0.47451, 0.47451, 0.47451, 1, 1, 1, 1, 1 ) - -[sub_resource type="GradientTexture" id=17] -gradient = SubResource( 16 ) - -[sub_resource type="StyleBoxTexture" id=18] -texture = SubResource( 17 ) -region_rect = Rect2( 0, 0, 2048, 1 ) - -[sub_resource type="Gradient" id=19] -interpolation_mode = 1 -colors = PoolColorArray( 0.266667, 0.266667, 0.266667, 1, 1, 1, 1, 1 ) - -[sub_resource type="GradientTexture" id=20] -gradient = SubResource( 19 ) - -[sub_resource type="StyleBoxTexture" id=21] -texture = SubResource( 20 ) -region_rect = Rect2( 0, 0, 2048, 1 ) - -[sub_resource type="Gradient" id=6] -interpolation_mode = 1 -colors = PoolColorArray( 0.47451, 0.47451, 0.47451, 1, 1, 1, 1, 1 ) - -[sub_resource type="GradientTexture" id=7] -gradient = SubResource( 6 ) - -[sub_resource type="StyleBoxTexture" id=5] -texture = SubResource( 7 ) -region_rect = Rect2( 0, 0, 2048, 1 ) - -[sub_resource type="Gradient" id=9] -interpolation_mode = 1 -colors = PoolColorArray( 0.239216, 0.239216, 0.239216, 1, 1, 1, 1, 1 ) - -[sub_resource type="GradientTexture" id=10] -gradient = SubResource( 9 ) -[sub_resource type="StyleBoxTexture" id=11] -texture = SubResource( 10 ) -region_rect = Rect2( 0, 0, 2048, 1 ) +[sub_resource type="StyleBoxTexture" id=12] +texture = ExtResource( 4 ) +region_rect = Rect2( 0, 0, 380, 98 ) +margin_left = 14.0 +margin_right = 14.0 +margin_top = 14.0 +margin_bottom = 20.0 +axis_stretch_horizontal = 1 +axis_stretch_vertical = 1 + +[sub_resource type="StyleBoxTexture" id=13] +texture = ExtResource( 4 ) +region_rect = Rect2( 0, 0, 380, 98 ) +margin_left = 14.0 +margin_right = 14.0 +margin_top = 14.0 +margin_bottom = 20.0 +axis_stretch_horizontal = 1 +axis_stretch_vertical = 1 + +[sub_resource type="StyleBoxTexture" id=14] +texture = ExtResource( 2 ) +region_rect = Rect2( 0, 0, 380, 98 ) +margin_left = 14.0 +margin_right = 14.0 +margin_top = 26.0 +margin_bottom = 14.0 +axis_stretch_horizontal = 1 +axis_stretch_vertical = 1 + +[sub_resource type="DynamicFont" id=11] [sub_resource type="DynamicFont" id=8] size = 80 -font_data = ExtResource( 1 ) +font_data = ExtResource( 3 ) [resource] Button/colors/font_color_hover = Color( 0.854902, 0.439216, 0.439216, 1 ) -Button/fonts/font = SubResource( 2 ) -Button/styles/disabled = SubResource( 15 ) -Button/styles/focus = SubResource( 18 ) -Button/styles/hover = SubResource( 21 ) -Button/styles/normal = SubResource( 5 ) -Button/styles/pressed = SubResource( 11 ) +Button/fonts/font = SubResource( 16 ) +Button/styles/focus = SubResource( 15 ) +Button/styles/hover = SubResource( 12 ) +Button/styles/normal = SubResource( 13 ) +Button/styles/pressed = SubResource( 14 ) +Fonts/fonts/normal = SubResource( 11 ) Label/fonts/font = SubResource( 8 ) diff --git a/ui/map/map.gd b/ui/map/map.gd index 177afc3..1e4de14 100644 --- a/ui/map/map.gd +++ b/ui/map/map.gd @@ -19,6 +19,8 @@ func heightmap(): if center.get_data("ocean"): # var factor = pow((center.get_elevation()+1.001), 10) / 5.0 color = Color("#5e4fa2") + if center.get_data("snow"): + color = Color.white # if center.get_data("coast"): # color = Color.black if center.polygon().size() > 2: diff --git a/utils/terrain/Terrain.gd b/utils/terrain/Terrain.gd index 62419ce..8b4767e 100644 --- a/utils/terrain/Terrain.gd +++ b/utils/terrain/Terrain.gd @@ -975,3 +975,11 @@ func get_chunk(vect): # print(idx) centers.append(get_center(idx)) return centers + +func get_parameters(): + return { + "name": _name, + "width": _width, + "height": _height, + "spacing": _spacing + } diff --git a/utils/terrain_mesh/TerrainMesh.gd b/utils/terrain_mesh/TerrainMesh.gd index e4bb3e7..f8a552d 100644 --- a/utils/terrain_mesh/TerrainMesh.gd +++ b/utils/terrain_mesh/TerrainMesh.gd @@ -19,6 +19,9 @@ func create_mesh(): var material_id = Global.materials[center.get_data("material")] var top_uv = Vector2(0, float(material_id) / (Global.materials.size()-1)) var border_uv = Vector2(1, float(material_id) / (Global.materials.size()-1)) + if center.get_data("snow"): + top_uv.y = float(Global.materials["snow"]) / (Global.materials.size()-1) + var corner_number = center.corner_count() for corner_count in corner_number: var current_corner = center.corner(corner_count) diff --git a/utils/world_generation/WorldGeneration.gd b/utils/world_generation/WorldGeneration.gd index 9465271..2543b7a 100644 --- a/utils/world_generation/WorldGeneration.gd +++ b/utils/world_generation/WorldGeneration.gd @@ -47,6 +47,9 @@ func init_data(): Global.loadings["world_creation"].new_phase("Generation des continents...", Global.terrain.get_centers().size()) for center in Global.terrain.get_centers(): center.set_elevation(find_elevation(center.point2d())) + center.set_data("temperature", find_temperature(center)) + if center.get_data("temperature") > 0.5: + center.set_data("snow", true) if center.get_elevation() <= 0.0: center.set_data("water", true) if center.get_elevation() >= mountain_height: @@ -238,6 +241,14 @@ func find_elevation(point): elevation = (elevation * terraces) / terraces return elevation +func find_temperature(center): + + var poles = 4 + var equator = -4 + var elevation = center.get_elevation() + var latitude = sin(PI * (float(center.point2d().y) / float(Global.terrain.get_parameters()["height"]))) + var temperature = 40*elevation*elevation + poles + (equator-poles) * latitude + return temperature func fill_oceans(): var stack = [] diff --git a/world/default_env.tres b/world/default_env.tres index 5489f73..e4b6056 100644 --- a/world/default_env.tres +++ b/world/default_env.tres @@ -1,6 +1,7 @@ [gd_resource type="Environment" load_steps=2 format=2] [sub_resource type="ProceduralSky" id=1] +sky_top_color = Color( 0.776471, 0.854902, 0.898039, 1 ) [resource] background_mode = 2 diff --git a/world/game.tscn b/world/game.tscn index f45efd5..7cf1029 100644 --- a/world/game.tscn +++ b/world/game.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=14 format=2] +[gd_scene load_steps=15 format=2] [ext_resource path="res://ui/ui.tscn" type="PackedScene" id=1] [ext_resource path="res://world/materials/outline.tres" type="Shader" id=2] +[ext_resource path="res://world/default_env.tres" type="Environment" id=3] [ext_resource path="res://world/World3d.gd" type="Script" id=4] [ext_resource path="res://utils/camera/CamBase.tscn" type="PackedScene" id=5] @@ -179,6 +180,7 @@ mesh = SubResource( 1 ) material/0 = SubResource( 3 ) [node name="WorldEnvironment" type="WorldEnvironment" parent="World3d"] +environment = ExtResource( 3 ) [node name="CamBase" parent="World3d" instance=ExtResource( 5 )] @@ -191,7 +193,7 @@ height = 5.0 [node name="DirectionalLight" type="DirectionalLight" parent="World3d"] transform = Transform( 0.971628, 0.168947, -0.16552, 0, 0.699825, 0.714314, 0.236516, -0.694047, 0.67997, 0, 1.41623, 14.8745 ) -light_energy = 0.1 +light_energy = 0.2 shadow_enabled = true [node name="Outline" type="MeshInstance" parent="World3d"] diff --git a/world/materials/colors.png b/world/materials/colors.png index 552593d..150e083 100644 Binary files a/world/materials/colors.png and b/world/materials/colors.png differ diff --git a/world/materials/materials.json b/world/materials/materials.json index fb6a7f9..9e1aa31 100644 --- a/world/materials/materials.json +++ b/world/materials/materials.json @@ -1,5 +1,6 @@ { "grass": 0, "stone": 1, - "sand": 2 + "sand": 2, + "snow": 3 }