température

pull/50/head
Valentin Stark 3 years ago
parent 28779c4385
commit 345deddbf5
  1. 30
      menu/MainMenu.tscn
  2. 1
      project.godot
  3. BIN
      theme/fonts/Kenney Blocks.ttf
  4. BIN
      theme/fonts/Kenney Bold.ttf
  5. BIN
      theme/fonts/Kenney Future Narrow.ttf
  6. BIN
      theme/fonts/Kenney Future Square.ttf
  7. BIN
      theme/fonts/Kenney Future.ttf
  8. BIN
      theme/fonts/Kenney High Square.ttf
  9. BIN
      theme/fonts/Kenney High.ttf
  10. BIN
      theme/fonts/Kenney Mini Square Mono.ttf
  11. BIN
      theme/fonts/Kenney Mini Square.ttf
  12. BIN
      theme/fonts/Kenney Mini.ttf
  13. BIN
      theme/fonts/Kenney Pixel Square.ttf
  14. BIN
      theme/fonts/Kenney Pixel.ttf
  15. BIN
      theme/fonts/Kenney Rocket Square.ttf
  16. BIN
      theme/fonts/Kenney Rocket.ttf
  17. BIN
      theme/fonts/Kenney Space.ttf
  18. BIN
      theme/fonts/Kenney Thick.ttf
  19. BIN
      theme/imgs/buttonLong_brown.png
  20. 35
      theme/imgs/buttonLong_brown.png.import
  21. BIN
      theme/imgs/buttonLong_brown_pressed.png
  22. 35
      theme/imgs/buttonLong_brown_pressed.png.import
  23. 114
      theme/theme.tres
  24. 2
      ui/map/map.gd
  25. 8
      utils/terrain/Terrain.gd
  26. 3
      utils/terrain_mesh/TerrainMesh.gd
  27. 11
      utils/world_generation/WorldGeneration.gd
  28. 1
      world/default_env.tres
  29. 6
      world/game.tscn
  30. BIN
      world/materials/colors.png
  31. 3
      world/materials/materials.json

@ -16,35 +16,35 @@ anchor_left = 0.5
anchor_top = 0.5 anchor_top = 0.5
anchor_right = 0.5 anchor_right = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
margin_left = -158.0 margin_left = -159.0
margin_top = -74.5 margin_top = -226.0
margin_right = 158.0 margin_right = 159.0
margin_bottom = 74.5 margin_bottom = 226.0
[node name="Title" type="Label" parent="VBoxContainer"] [node name="Title" type="Label" parent="VBoxContainer"]
margin_right = 316.0 margin_right = 360.0
margin_bottom = 131.0 margin_bottom = 203.0
text = "Societer text = "Societer
" "
align = 1 align = 1
[node name="NewButton" type="Button" parent="VBoxContainer"] [node name="NewButton" type="Button" parent="VBoxContainer"]
margin_top = 135.0 margin_top = 207.0
margin_right = 316.0 margin_right = 360.0
margin_bottom = 176.0 margin_bottom = 261.0
theme = SubResource( 1 ) theme = SubResource( 1 )
text = "Nouveau monde" text = "Nouveau monde"
[node name="LoadButton" type="Button" parent="VBoxContainer"] [node name="LoadButton" type="Button" parent="VBoxContainer"]
margin_top = 180.0 margin_top = 265.0
margin_right = 316.0 margin_right = 360.0
margin_bottom = 221.0 margin_bottom = 319.0
text = "Charger un monde" text = "Charger un monde"
[node name="QuitButton" type="Button" parent="VBoxContainer"] [node name="QuitButton" type="Button" parent="VBoxContainer"]
margin_top = 225.0 margin_top = 323.0
margin_right = 316.0 margin_right = 360.0
margin_bottom = 266.0 margin_bottom = 377.0
text = "Quitter" text = "Quitter"
[node name="Viewport" type="Viewport" parent="."] [node name="Viewport" type="Viewport" parent="."]

@ -97,4 +97,5 @@ common/enable_pause_aware_picking=true
[rendering] [rendering]
2d/options/ninepatch_mode=0
environment/default_environment="res://world/default_env.tres" environment/default_environment="res://world/default_env.tres"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 959 B

@ -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

@ -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] [sub_resource type="DynamicFont" id=16]
font_path = "res://theme/fonts/monogram.ttf" font_data = ExtResource( 3 )
[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="StyleBoxTexture" id=15] [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] [sub_resource type="StyleBoxTexture" id=12]
texture = SubResource( 10 ) texture = ExtResource( 4 )
region_rect = Rect2( 0, 0, 2048, 1 ) 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] [sub_resource type="DynamicFont" id=8]
size = 80 size = 80
font_data = ExtResource( 1 ) font_data = ExtResource( 3 )
[resource] [resource]
Button/colors/font_color_hover = Color( 0.854902, 0.439216, 0.439216, 1 ) Button/colors/font_color_hover = Color( 0.854902, 0.439216, 0.439216, 1 )
Button/fonts/font = SubResource( 2 ) Button/fonts/font = SubResource( 16 )
Button/styles/disabled = SubResource( 15 ) Button/styles/focus = SubResource( 15 )
Button/styles/focus = SubResource( 18 ) Button/styles/hover = SubResource( 12 )
Button/styles/hover = SubResource( 21 ) Button/styles/normal = SubResource( 13 )
Button/styles/normal = SubResource( 5 ) Button/styles/pressed = SubResource( 14 )
Button/styles/pressed = SubResource( 11 ) Fonts/fonts/normal = SubResource( 11 )
Label/fonts/font = SubResource( 8 ) Label/fonts/font = SubResource( 8 )

@ -19,6 +19,8 @@ func heightmap():
if center.get_data("ocean"): if center.get_data("ocean"):
# var factor = pow((center.get_elevation()+1.001), 10) / 5.0 # var factor = pow((center.get_elevation()+1.001), 10) / 5.0
color = Color("#5e4fa2") color = Color("#5e4fa2")
if center.get_data("snow"):
color = Color.white
# if center.get_data("coast"): # if center.get_data("coast"):
# color = Color.black # color = Color.black
if center.polygon().size() > 2: if center.polygon().size() > 2:

@ -975,3 +975,11 @@ func get_chunk(vect):
# print(idx) # print(idx)
centers.append(get_center(idx)) centers.append(get_center(idx))
return centers return centers
func get_parameters():
return {
"name": _name,
"width": _width,
"height": _height,
"spacing": _spacing
}

@ -19,6 +19,9 @@ func create_mesh():
var material_id = Global.materials[center.get_data("material")] var material_id = Global.materials[center.get_data("material")]
var top_uv = Vector2(0, float(material_id) / (Global.materials.size()-1)) var top_uv = Vector2(0, float(material_id) / (Global.materials.size()-1))
var border_uv = Vector2(1, 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() var corner_number = center.corner_count()
for corner_count in corner_number: for corner_count in corner_number:
var current_corner = center.corner(corner_count) var current_corner = center.corner(corner_count)

@ -47,6 +47,9 @@ func init_data():
Global.loadings["world_creation"].new_phase("Generation des continents...", Global.terrain.get_centers().size()) Global.loadings["world_creation"].new_phase("Generation des continents...", Global.terrain.get_centers().size())
for center in Global.terrain.get_centers(): for center in Global.terrain.get_centers():
center.set_elevation(find_elevation(center.point2d())) 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: if center.get_elevation() <= 0.0:
center.set_data("water", true) center.set_data("water", true)
if center.get_elevation() >= mountain_height: if center.get_elevation() >= mountain_height:
@ -238,6 +241,14 @@ func find_elevation(point):
elevation = (elevation * terraces) / terraces elevation = (elevation * terraces) / terraces
return elevation 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(): func fill_oceans():
var stack = [] var stack = []

@ -1,6 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2] [gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1] [sub_resource type="ProceduralSky" id=1]
sky_top_color = Color( 0.776471, 0.854902, 0.898039, 1 )
[resource] [resource]
background_mode = 2 background_mode = 2

@ -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://ui/ui.tscn" type="PackedScene" id=1]
[ext_resource path="res://world/materials/outline.tres" type="Shader" id=2] [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://world/World3d.gd" type="Script" id=4]
[ext_resource path="res://utils/camera/CamBase.tscn" type="PackedScene" id=5] [ext_resource path="res://utils/camera/CamBase.tscn" type="PackedScene" id=5]
@ -179,6 +180,7 @@ mesh = SubResource( 1 )
material/0 = SubResource( 3 ) material/0 = SubResource( 3 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="World3d"] [node name="WorldEnvironment" type="WorldEnvironment" parent="World3d"]
environment = ExtResource( 3 )
[node name="CamBase" parent="World3d" instance=ExtResource( 5 )] [node name="CamBase" parent="World3d" instance=ExtResource( 5 )]
@ -191,7 +193,7 @@ height = 5.0
[node name="DirectionalLight" type="DirectionalLight" parent="World3d"] [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 ) 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 shadow_enabled = true
[node name="Outline" type="MeshInstance" parent="World3d"] [node name="Outline" type="MeshInstance" parent="World3d"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

After

Width:  |  Height:  |  Size: 4.7 KiB

@ -1,5 +1,6 @@
{ {
"grass": 0, "grass": 0,
"stone": 1, "stone": 1,
"sand": 2 "sand": 2,
"snow": 3
} }

Loading…
Cancel
Save