Add the night sky, night toggle, improve the README and other improvements

This commit is contained in:
Ribbon 2024-08-17 14:02:24 -03:00
parent ff43854c1b
commit 71b28324fc
13 changed files with 111 additions and 67 deletions

View file

@ -70,9 +70,12 @@ You can watch the demo video on [this](https://youtu.be/Z3Cd_NBYUfI?feature=shar
## Controls
- Arrow Keys/WASD - Move the player
- Z - Control the external car lights
- X - Control the internal car lights
- Z - Control the car headlights
- X - Control the internal car light
- Space - Play/Pause music
- = - Increase the music volume
- - - Decrease the music volume
- N - Enable the night
- F - Enable full-screen
## TODOs
@ -136,6 +139,7 @@ git clone https://github.com/FOSS-Supremacy/re3-gd
- Once ready, send a pull request (if you are adding commits on the PR branch, mark it as draft status)
- Send the link of your pull requests on the "Pull Requests" channel/room on [Discord](https://discord.gg/tk6Vnxv9Qt) or [Matrix](https://matrix.to/#/!vIwqjDewTZpciZqhEp:matrix.org?via=matrix.org).
- We don't accept C# code
- New assets needs to be licensed as Creative Commons
## Donate
@ -151,4 +155,3 @@ bc1qg9x5vzr4ppkm2ssw5k7ete4lu49wg7t02azkce
## Credits
We thank [atirut-w](https://github.com/atirut-w) a lot for writting the GTA3 loader and configuring the project scenes, this project wouldn't be possible without his work.

View file

@ -128,6 +128,11 @@ decrease_music_volume={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":45,"key_label":0,"unicode":45,"location":0,"echo":false,"script":null)
]
}
night_toggle={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":78,"key_label":0,"unicode":110,"location":0,"echo":false,"script":null)
]
}
[rendering]

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://cf6tomram4xup"]
[ext_resource type="PackedScene" uid="uid://1d8h7r1pvaps" path="res://scenes/world.tscn" id="1_qnmje"]
[ext_resource type="PackedScene" uid="uid://1d8h7r1pvaps" path="res://scenes/world/world.tscn" id="1_qnmje"]
[ext_resource type="PackedScene" uid="uid://bt041qrw0l2bm" path="res://prefabs/fly_camera/fly_camera.tscn" id="2_5jeq8"]
[node name="main" type="Node3D"]

View file

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://scripts/multiplayer.gd" id="1_i6dgd"]
[ext_resource type="PackedScene" uid="uid://ci2k4eganebbs" path="res://scenes/player.tscn" id="2_8rxc6"]
[ext_resource type="PackedScene" uid="uid://1d8h7r1pvaps" path="res://scenes/world.tscn" id="3_gow6c"]
[ext_resource type="PackedScene" uid="uid://1d8h7r1pvaps" path="res://scenes/world/world.tscn" id="3_gow6c"]
[node name="multiplayer" type="Node3D"]
script = ExtResource("1_i6dgd")

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://7kpoyini1lat"]
[ext_resource type="PackedScene" uid="uid://1d8h7r1pvaps" path="res://scenes/world.tscn" id="2_c7g1y"]
[ext_resource type="PackedScene" uid="uid://1d8h7r1pvaps" path="res://scenes/world/world.tscn" id="2_c7g1y"]
[ext_resource type="PackedScene" uid="uid://ci2k4eganebbs" path="res://scenes/player.tscn" id="3_rn43x"]
[node name="single_player" type="Node3D"]

View file

@ -1,31 +0,0 @@
[gd_scene load_steps=6 format=3 uid="uid://dnxwox43mmj07"]
[ext_resource type="PackedScene" uid="uid://1d8h7r1pvaps" path="res://scenes/world.tscn" id="1_cuf35"]
[ext_resource type="PackedScene" uid="uid://cf6tomram4xup" path="res://scenes/fly_camera.tscn" id="1_urr86"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_y1qc1"]
sky_top_color = Color(0.20109, 0.0758417, 0.790048, 1)
sky_horizon_color = Color(0.603964, 0.229694, 1, 1)
[sub_resource type="Sky" id="Sky_37lfr"]
sky_material = SubResource("ProceduralSkyMaterial_y1qc1")
[sub_resource type="Environment" id="Environment_jql02"]
background_mode = 2
sky = SubResource("Sky_37lfr")
ambient_light_source = 3
reflected_light_source = 2
tonemap_mode = 2
glow_enabled = true
fog_enabled = true
fog_light_color = Color(0.00431982, 0.000907986, 0.0422762, 1)
fog_light_energy = 3.02
[node name="main" type="Node3D"]
[node name="fly_camera" parent="." instance=ExtResource("1_urr86")]
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_jql02")
[node name="world" parent="." instance=ExtResource("1_cuf35")]

View file

@ -1,30 +0,0 @@
[gd_scene load_steps=5 format=3 uid="uid://1d8h7r1pvaps"]
[ext_resource type="Script" path="res://scripts/world.gd" id="1_s3ncu"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_eihtl"]
sky_top_color = Color(0, 0.134644, 0.285916, 1)
sky_horizon_color = Color(0.463838, 0.635312, 1, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
[sub_resource type="Sky" id="Sky_njxv5"]
sky_material = SubResource("ProceduralSkyMaterial_eihtl")
[sub_resource type="Environment" id="Environment_7d6in"]
background_mode = 2
sky = SubResource("Sky_njxv5")
tonemap_mode = 2
fog_light_color = Color(0.133196, 0.133196, 0.133196, 1)
fog_light_energy = 0.83
volumetric_fog_density = 0.01
[node name="world" type="Node3D"]
script = ExtResource("1_s3ncu")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_7d6in")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
shadow_enabled = true
directional_shadow_max_distance = 50.0

16
scenes/world/day.tres Normal file
View file

@ -0,0 +1,16 @@
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://cs0m1jhlpv3rp"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_eihtl"]
sky_top_color = Color(0, 0.134644, 0.285916, 1)
sky_horizon_color = Color(0.463838, 0.635312, 1, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
[sub_resource type="Sky" id="Sky_njxv5"]
sky_material = SubResource("ProceduralSkyMaterial_eihtl")
[resource]
background_mode = 2
sky = SubResource("Sky_njxv5")
tonemap_mode = 2
fog_light_color = Color(0.462745, 0.635294, 1, 1)
volumetric_fog_density = 0.01

17
scenes/world/night.tres Normal file
View file

@ -0,0 +1,17 @@
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://b2jtfqrhdnnx5"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_q5kod"]
sky_top_color = Color(0, 0.00318298, 0.0828058, 1)
sky_horizon_color = Color(0, 0.00392157, 0.0823529, 1)
ground_bottom_color = Color(0, 0.00392157, 0.0823529, 1)
ground_horizon_color = Color(0, 0.00392157, 0.0823529, 1)
[sub_resource type="Sky" id="Sky_qiixs"]
sky_material = SubResource("ProceduralSkyMaterial_q5kod")
[resource]
background_mode = 2
sky = SubResource("Sky_qiixs")
ambient_light_source = 3
reflected_light_source = 2
fog_light_color = Color(0.462745, 0.635294, 1, 1)

15
scenes/world/test.tres Normal file
View file

@ -0,0 +1,15 @@
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://ccr7xp2qxu2g3"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_eihtl"]
sky_top_color = Color(0, 0.134644, 0.285916, 1)
sky_horizon_color = Color(0.462745, 0.635294, 1, 1)
ground_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
[sub_resource type="Sky" id="Sky_njxv5"]
sky_material = SubResource("ProceduralSkyMaterial_eihtl")
[resource]
background_mode = 2
sky = SubResource("Sky_njxv5")
tonemap_mode = 2
volumetric_fog_density = 0.01

View file

@ -0,0 +1,20 @@
[gd_scene load_steps=4 format=3 uid="uid://dnxwox43mmj07"]
[ext_resource type="Environment" uid="uid://ccr7xp2qxu2g3" path="res://scenes/world/test.tres" id="1_2h2e7"]
[sub_resource type="BoxMesh" id="BoxMesh_aqhx6"]
size = Vector3(20, 1, 20)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_7rwwr"]
data = PackedVector3Array(-10, 0.5, 10, 10, 0.5, 10, -10, -0.5, 10, 10, 0.5, 10, 10, -0.5, 10, -10, -0.5, 10, 10, 0.5, -10, -10, 0.5, -10, 10, -0.5, -10, -10, 0.5, -10, -10, -0.5, -10, 10, -0.5, -10, 10, 0.5, 10, 10, 0.5, -10, 10, -0.5, 10, 10, 0.5, -10, 10, -0.5, -10, 10, -0.5, 10, -10, 0.5, -10, -10, 0.5, 10, -10, -0.5, -10, -10, 0.5, 10, -10, -0.5, 10, -10, -0.5, -10, 10, 0.5, 10, -10, 0.5, 10, 10, 0.5, -10, -10, 0.5, 10, -10, 0.5, -10, 10, 0.5, -10, -10, -0.5, 10, 10, -0.5, 10, -10, -0.5, -10, 10, -0.5, 10, 10, -0.5, -10, -10, -0.5, -10)
[node name="Node3D" type="Node3D"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_aqhx6")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("ConcavePolygonShape3D_7rwwr")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource("1_2h2e7")

18
scenes/world/world.tscn Normal file
View file

@ -0,0 +1,18 @@
[gd_scene load_steps=2 format=3 uid="uid://1d8h7r1pvaps"]
[ext_resource type="Script" path="res://scripts/world.gd" id="1_s3ncu"]
[node name="world" type="Node3D"]
script = ExtResource("1_s3ncu")
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
[node name="sun" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866023, -0.433016, 0.250001, 0, 0.499998, 0.866027, -0.500003, 0.749999, -0.43301, 0, 0, 0)
shadow_enabled = true
directional_shadow_max_distance = 50.0
[node name="moon" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.866025, 0.433013, -0.25, 0, 0.5, 0.866025, 0.5, 0.75, -0.433013, 0, 0, 0)
light_color = Color(0, 0.243591, 0.243591, 1)
shadow_enabled = true

View file

@ -1,6 +1,9 @@
extends Node
@onready var world := Node3D.new()
@onready var sun = $sun
@onready var moon = $moon
@onready var sky = $WorldEnvironment
var car := preload("res://scenes/car.tscn")
func _ready() -> void:
@ -19,6 +22,8 @@ func _ready() -> void:
await get_tree().physics_frame
print("Map load completed in %f seconds" % ((Time.get_ticks_msec() - start_t) / 1000))
add_child(world)
sky.environment = load("res://scenes/world/day.tres")
moon.visible = not moon.visible
func _unhandled_input(event: InputEvent) -> void:
if Input.is_action_pressed("spawn"):
@ -31,3 +36,9 @@ func _input(event):
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
#else:
#DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
if Input.is_action_just_pressed("night_toggle"):
sky.environment = load("res://scenes/world/night.tres")
sun.visible = not sun.visible
moon.visible = not moon.visible
#if sun.visible = true
#sky.environment = load("res://scenes/world/day.tres")