Merge branch 'main' into enreg-map

pull/55/head
Alain STARK 3 years ago committed by GitHub
commit c67fb43964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. BIN
      MainMenu0.bin
  2. 28
      menu/LoadWorld.tscn
  3. 30
      menu/MainMenu.tscn
  4. 40
      menu/NewWorld.tscn
  5. 1
      project.godot
  6. BIN
      theme/fonts/Kenney Blocks.ttf
  7. BIN
      theme/fonts/Kenney Bold.ttf
  8. BIN
      theme/fonts/Kenney Future Narrow.ttf
  9. BIN
      theme/fonts/Kenney Future Square.ttf
  10. BIN
      theme/fonts/Kenney Future.ttf
  11. BIN
      theme/fonts/Kenney High Square.ttf
  12. BIN
      theme/fonts/Kenney High.ttf
  13. BIN
      theme/fonts/Kenney Mini Square Mono.ttf
  14. BIN
      theme/fonts/Kenney Mini Square.ttf
  15. BIN
      theme/fonts/Kenney Mini.ttf
  16. BIN
      theme/fonts/Kenney Pixel Square.ttf
  17. BIN
      theme/fonts/Kenney Pixel.ttf
  18. BIN
      theme/fonts/Kenney Rocket Square.ttf
  19. BIN
      theme/fonts/Kenney Rocket.ttf
  20. BIN
      theme/fonts/Kenney Space.ttf
  21. BIN
      theme/fonts/Kenney Thick.ttf
  22. BIN
      theme/imgs/buttonLong_brown.png
  23. 35
      theme/imgs/buttonLong_brown.png.import
  24. BIN
      theme/imgs/buttonLong_brown_pressed.png
  25. 35
      theme/imgs/buttonLong_brown_pressed.png.import
  26. 114
      theme/theme.tres
  27. 8
      utils/terrain/Terrain.gd
  28. 3
      utils/terrain_mesh/TerrainMesh.gd
  29. 25
      utils/world_generation/WorldGeneration.gd
  30. 5
      world/World3d.gd
  31. 1
      world/default_env.tres
  32. 6
      world/game.tscn
  33. BIN
      world/materials/colors.png
  34. 3
      world/materials/materials.json

Binary file not shown.

@ -20,33 +20,33 @@ 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 = -240.0 margin_left = -375.0
margin_top = -131.5 margin_top = -156.0
margin_right = 240.0 margin_right = 375.0
margin_bottom = 131.5 margin_bottom = 156.0
[node name="Title" type="Label" parent="VBoxContainer"] [node name="Title" type="Label" parent="VBoxContainer"]
margin_right = 480.0 margin_right = 750.0
margin_bottom = 64.0 margin_bottom = 100.0
text = "Charger un monde" text = "Charger un monde"
align = 1 align = 1
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] [node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"]
margin_top = 68.0 margin_top = 104.0
margin_right = 480.0 margin_right = 750.0
margin_bottom = 218.0 margin_bottom = 254.0
rect_min_size = Vector2( 0, 150 ) rect_min_size = Vector2( 0, 150 )
[node name="WorldList" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"] [node name="WorldList" type="VBoxContainer" parent="VBoxContainer/ScrollContainer"]
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 222.0 margin_top = 258.0
margin_right = 480.0 margin_right = 750.0
margin_bottom = 263.0 margin_bottom = 312.0
[node name="CancelButton" type="Button" parent="VBoxContainer/HBoxContainer"] [node name="CancelButton" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_right = 480.0 margin_right = 750.0
margin_bottom = 41.0 margin_bottom = 54.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Annuler" text = "Annuler"

@ -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"
[connection signal="pressed" from="VBoxContainer/NewButton" to="." method="_on_NewButton_pressed"] [connection signal="pressed" from="VBoxContainer/NewButton" to="." method="_on_NewButton_pressed"]

@ -20,43 +20,43 @@ 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 = -195.0 margin_left = -320.0
margin_top = -85.0 margin_top = -109.5
margin_right = 195.0 margin_right = 320.0
margin_bottom = 85.0 margin_bottom = 109.5
[node name="Title" type="Label" parent="VBoxContainer"] [node name="Title" type="Label" parent="VBoxContainer"]
margin_right = 390.0 margin_right = 640.0
margin_bottom = 64.0 margin_bottom = 100.0
text = "Nouveau monde" text = "Nouveau monde"
align = 1 align = 1
[node name="Label" type="Label" parent="VBoxContainer"] [node name="Label" type="Label" parent="VBoxContainer"]
margin_top = 68.0 margin_top = 104.0
margin_right = 390.0 margin_right = 640.0
margin_bottom = 97.0 margin_bottom = 133.0
custom_fonts/font = SubResource( 1 ) custom_fonts/font = SubResource( 1 )
text = "Nom du monde :" text = "Nom du monde :"
[node name="LineEdit" type="LineEdit" parent="VBoxContainer"] [node name="LineEdit" type="LineEdit" parent="VBoxContainer"]
margin_top = 101.0 margin_top = 137.0
margin_right = 390.0 margin_right = 640.0
margin_bottom = 125.0 margin_bottom = 161.0
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 129.0 margin_top = 165.0
margin_right = 390.0 margin_right = 640.0
margin_bottom = 170.0 margin_bottom = 219.0
[node name="CreateButton" type="Button" parent="VBoxContainer/HBoxContainer"] [node name="CreateButton" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_right = 247.0 margin_right = 156.0
margin_bottom = 41.0 margin_bottom = 54.0
text = "Nouveau monde" text = "Nouveau monde"
[node name="CancelButton" type="Button" parent="VBoxContainer/HBoxContainer"] [node name="CancelButton" type="Button" parent="VBoxContainer/HBoxContainer"]
margin_left = 251.0 margin_left = 160.0
margin_right = 390.0 margin_right = 640.0
margin_bottom = 41.0 margin_bottom = 54.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Annuler" text = "Annuler"

@ -107,4 +107,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 )

@ -974,3 +974,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)

@ -48,6 +48,10 @@ 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))
center.set_data("moisture", find_moisture(center.point2d()))
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:
@ -70,6 +74,15 @@ func init_data():
center.set_data("material", "stone") center.set_data("material", "stone")
if center.get_data("coast"): if center.get_data("coast"):
center.set_data("material", "sand") center.set_data("material", "sand")
if (
not center.get_data("coast")
and not center.get_data("mountain")
and not center.get_data("ocean")
and center.get_data("moisture") > 0.3
):
center.set_data("forest", true)
if not center.get_data("water"): if not center.get_data("water"):
var voronoi = center.polygon() var voronoi = center.polygon()
center.set_data("voronoi",voronoi) center.set_data("voronoi",voronoi)
@ -245,6 +258,18 @@ func find_elevation(point):
elevation = (elevation * terraces) / terraces elevation = (elevation * terraces) / terraces
return elevation return elevation
func find_moisture(point):
var elevation = noise.get_noise_2d((point.x + 100) / wavelength * 2, (point.y + 100) / wavelength * 2)
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 = []

@ -29,9 +29,8 @@ func add_trees():
var poisson_disc_sampling: PoissonDiscSampling = PoissonDiscSampling.new() var poisson_disc_sampling: PoissonDiscSampling = PoissonDiscSampling.new()
for center in Global.terrain.get_centers(): for center in Global.terrain.get_centers():
if not center.get_data("water") and not center.get_data("coast") and not center.get_data("mountain"): var num = rng.randi_range(0,100)
var num = rng.randi_range(0,10) if center.get_data("forest") or num == 1:
if num == 1:
var points2d = poisson_disc_sampling.generate_points(3, center.polygon(), 2) var points2d = poisson_disc_sampling.generate_points(3, center.polygon(), 2)
for point in points2d: for point in points2d:
var tree = treescene.instance() var tree = treescene.instance()

@ -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]
@ -184,6 +185,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 )]
@ -196,7 +198,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