Skip to content

Commit

Permalink
IMPROVEMENT: Many tweaks, reworked univers for testing log depth.
Browse files Browse the repository at this point in the history
  • Loading branch information
roalyr committed Feb 23, 2022
1 parent 2e3b43d commit 04da4d3
Show file tree
Hide file tree
Showing 14 changed files with 729 additions and 231 deletions.
2 changes: 1 addition & 1 deletion Assets/Shaders/Solid_no_cull_no_shade.gdshader
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
shader_type spatial;

render_mode unshaded, depth_draw_opaque;
render_mode unshaded, cull_disabled, depth_draw_opaque;

uniform vec4 albedo : hint_color;

Expand Down
3 changes: 2 additions & 1 deletion Default_env.tres
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ background_sky = SubResource( 1 )
background_sky_orientation = Basis( 0.513608, -0.748734, -0.419051, -0.00874038, 0.483799, -0.875135, 0.85798, 0.453139, 0.241939 )
background_sky_rotation = Vector3( 1.06572, -1.0472, -0.0180642 )
background_sky_rotation_degrees = Vector3( 61.061, -60, -1.035 )
background_color = Color( 0.0823529, 0.0823529, 0.0901961, 1 )
background_color = Color( 0.709804, 0.709804, 0.709804, 1 )
background_energy = 0.0
tonemap_mode = 4
glow_bicubic_upscale = true
580 changes: 527 additions & 53 deletions Scenes/Main.tscn

Large diffs are not rendered by default.

188 changes: 96 additions & 92 deletions Scenes/UI/UI.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="ColorRect2" type="ColorRect" parent="GUI_prompt"]
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0.168627, 0.168627, 0.168627, 0.729412 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Button_touchscreen_switch" type="Button" parent="GUI_prompt"]
anchor_left = 0.5
anchor_top = 0.5
Expand All @@ -52,7 +60,7 @@ margin_right = 196.0
margin_bottom = -44.0
theme = ExtResource( 10 )
keep_pressed_outside = true
text = "Touch GUI"
text = "Touchscreen"
__meta__ = {
"_edit_use_anchors_": false
}
Expand All @@ -68,7 +76,55 @@ margin_right = 196.0
margin_bottom = 44.0
theme = ExtResource( 10 )
keep_pressed_outside = true
text = "Computer GUI"
text = "Keyboard and mouse"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Slider_screen_res" type="HSlider" parent="GUI_prompt"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -360.0
margin_top = 76.0
margin_right = 456.0
margin_bottom = 124.0
theme = ExtResource( 10 )
min_value = 0.1
max_value = 1.0
step = 0.1
value = 1.0
tick_count = 10
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="GUI_prompt/Slider_screen_res"]
margin_left = -120.0
margin_top = 5.0
margin_right = -14.0
margin_bottom = 42.0
theme = ExtResource( 10 )
text = "Quality"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Button_screen_filter2" type="Button" parent="GUI_prompt"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -96.0
margin_top = 140.0
margin_right = 84.0
margin_bottom = 222.0
theme = ExtResource( 10 )
toggle_mode = true
keep_pressed_outside = true
text = "Scren filter"
__meta__ = {
"_edit_use_anchors_": false
}
Expand Down Expand Up @@ -102,12 +158,12 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="Current_zoom" type="Label" parent="Main3D/Debug"]
[node name="Accel_ticks" type="Label" parent="Main3D/Debug"]
margin_left = 16.0
margin_top = 96.0
margin_right = 119.0
margin_bottom = 110.0
text = "Current zoom: 0"
text = "Acceleration ticks: 0"
__meta__ = {
"_edit_use_anchors_": false
}
Expand Down Expand Up @@ -413,7 +469,7 @@ margin_bottom = 28.0
min_value = 0.1
max_value = 1.0
step = 0.1
value = 0.7
value = 1.0
tick_count = 10
ticks_on_borders = true
__meta__ = {
Expand All @@ -427,30 +483,8 @@ margin_right = -11.0
margin_bottom = 17.0
text = "Quality"

[node name="Slider_fov" type="HSlider" parent="Controls/Control_bar"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -320.0
margin_top = 40.0
margin_right = -192.0
margin_bottom = 60.0
min_value = 40.0
max_value = 70.0
value = 55.0
tick_count = 10
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="Controls/Control_bar/Slider_fov"]
margin_left = -57.0
margin_top = 3.0
margin_right = -11.0
margin_bottom = 17.0
text = "FOV"

[node name="Controls_touchscreen" type="Control" parent="."]
visible = false
material = SubResource( 3 )
anchor_right = 1.0
anchor_bottom = 1.0
Expand Down Expand Up @@ -492,67 +526,6 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="Slider_fov" type="HSlider" parent="Controls_touchscreen/Options_menu"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -352.0
margin_top = -16.0
margin_right = 464.0
margin_bottom = 36.0
theme = ExtResource( 10 )
min_value = 40.0
max_value = 70.0
value = 55.0
tick_count = 10
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="Controls_touchscreen/Options_menu/Slider_fov"]
margin_left = -96.0
margin_top = 4.0
margin_right = -33.0
margin_bottom = 41.0
theme = ExtResource( 10 )
text = "FOV"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Slider_screen_res" type="HSlider" parent="Controls_touchscreen/Options_menu"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -352.0
margin_top = 44.0
margin_right = 464.0
margin_bottom = 92.0
theme = ExtResource( 10 )
min_value = 0.1
max_value = 1.0
step = 0.1
value = 0.7
tick_count = 10
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="Controls_touchscreen/Options_menu/Slider_screen_res"]
margin_left = -120.0
margin_top = 5.0
margin_right = -14.0
margin_bottom = 42.0
theme = ExtResource( 10 )
text = "Quality"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Button_quit" type="Button" parent="Controls_touchscreen/Options_menu"]
anchor_left = 0.5
anchor_top = 0.5
Expand Down Expand Up @@ -622,6 +595,37 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="Slider_screen_res2" type="HSlider" parent="Controls_touchscreen/Options_menu"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -368.0
margin_top = -4.0
margin_right = 448.0
margin_bottom = 44.0
theme = ExtResource( 10 )
min_value = 0.1
max_value = 1.0
step = 0.1
value = 1.0
tick_count = 10
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="Controls_touchscreen/Options_menu/Slider_screen_res2"]
margin_left = -120.0
margin_top = 5.0
margin_right = -14.0
margin_bottom = 42.0
theme = ExtResource( 10 )
text = "Quality"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Main_controls" type="Control" parent="Controls_touchscreen"]
anchor_right = 1.0
anchor_bottom = 1.0
Expand Down Expand Up @@ -765,6 +769,8 @@ __meta__ = {

[connection signal="pressed" from="GUI_prompt/Button_touchscreen_switch" to="." method="_on_Button_touchscreen_switch_pressed"]
[connection signal="pressed" from="GUI_prompt/Button_cumputer_gui_switch" to="." method="_on_Button_cumputer_gui_switch_pressed"]
[connection signal="value_changed" from="GUI_prompt/Slider_screen_res" to="." method="_on_Slider_screen_res_value_changed"]
[connection signal="toggled" from="GUI_prompt/Button_screen_filter2" to="." method="_on_Button_screen_filter_toggled"]
[connection signal="resized" from="Main3D" to="." method="_on_Viewport_main_resized"]
[connection signal="mouse_entered" from="Controls/Mouse_area" to="." method="_on_Mouse_area_mouse_entered"]
[connection signal="mouse_exited" from="Controls/Mouse_area" to="." method="_on_Mouse_area_mouse_exited"]
Expand All @@ -776,14 +782,12 @@ __meta__ = {
[connection signal="pressed" from="Controls/Control_bar/Button_quit" to="." method="_on_Button_quit_pressed"]
[connection signal="toggled" from="Controls/Control_bar/Button_screen_filter" to="." method="_on_Button_screen_filter_toggled"]
[connection signal="value_changed" from="Controls/Control_bar/Slider_screen_res" to="." method="_on_Slider_screen_res_value_changed"]
[connection signal="value_changed" from="Controls/Control_bar/Slider_fov" to="." method="_on_Slider_fov_value_changed"]
[connection signal="toggled" from="Controls_touchscreen/Options_menu/Button_debug" to="." method="_on_Button_debug_toggled"]
[connection signal="value_changed" from="Controls_touchscreen/Options_menu/Slider_fov" to="." method="_on_Slider_fov_value_changed"]
[connection signal="value_changed" from="Controls_touchscreen/Options_menu/Slider_screen_res" to="." method="_on_Slider_screen_res_value_changed"]
[connection signal="pressed" from="Controls_touchscreen/Options_menu/Button_quit" to="." method="_on_Button_quit_pressed"]
[connection signal="toggled" from="Controls_touchscreen/Options_menu/Button_screen_filter" to="." method="_on_Button_screen_filter_toggled"]
[connection signal="toggled" from="Controls_touchscreen/Options_menu/Button_text_panel" to="." method="_on_Button_text_panel_toggled"]
[connection signal="pressed" from="Controls_touchscreen/Options_menu/Button_close_options" to="." method="_on_Button_close_options_pressed"]
[connection signal="value_changed" from="Controls_touchscreen/Options_menu/Slider_screen_res2" to="." method="_on_Slider_screen_res_value_changed"]
[connection signal="value_changed" from="Controls_touchscreen/Main_controls/Slider_zoom" to="." method="_on_Slider_zoom_value_changed"]
[connection signal="toggled" from="Controls_touchscreen/Main_controls/Button_turret" to="." method="_on_Button_turret_toggled"]
[connection signal="pressed" from="Controls_touchscreen/Main_controls/Button_options" to="." method="_on_Button_options_pressed"]
Expand Down
17 changes: 13 additions & 4 deletions Scripts/Camera_rig.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var mouse_vector = Vector2(0,0)

# Paths node.
onready var p = get_tree().get_root().get_node("Container/Paths")
onready var camera_fov_default = p.camera.fov

func _ready():
# ============================ Initialize nodes ===========================
Expand Down Expand Up @@ -81,6 +82,7 @@ func chase_camera(mv, delta):
# Initial and final camera position.
var init_tilt = Vector2($Camera.rotation.x, $Camera.rotation.y)
var init_push = Vector2(0.0, 0.0)
var init_fov = Vector2(0.0, 0.0)
# $Camera.rotation.x - vertical, $Camera.rotation.y - horizontal
# UP - DOWN
if mv.y < 0:
Expand All @@ -106,18 +108,25 @@ func chase_camera(mv, delta):

var fin_tilt = Vector2(vert, horiz)
var fin_push = Vector2(velocity_factor, 0.0)
var fin_fov = Vector2(velocity_factor, 0.0)

var tmp_tilt = init_tilt.linear_interpolate(fin_tilt, delta
* p.ship.camera_tilt_velocity_factor)
var tmp_push = init_push.linear_interpolate(fin_push, delta
* p.ship.camera_push_velocity_factor)

var tmp_push = init_push.linear_interpolate(fin_push, pow(delta
*p.ship.camera_push_velocity_factor,3))
var tmp_fov = init_fov.linear_interpolate(fin_fov, delta
* p.ship.camera_fov_velocity_factor)

# Prevent camera sliding forward
# if tmp_push.x < camera_min_zoom:
tmp_push.x = camera_min_zoom+tmp_push.x
$Camera.translation.z = clamp(tmp_push.x, 0.0, 100.0)
$Camera.translation.z = clamp(tmp_push.x, 0.0, p.ship.camera_push_max_factor)
#else:
# $Camera.translation.z = tmp_push.x

p.camera.fov = camera_fov_default + clamp(tmp_fov.x, 0.0, p.ship.camera_fov_max_delta)


# Tilt motion
$Camera.rotation.x = tmp_tilt.x
$Camera.rotation.y = tmp_tilt.y
Expand Down
6 changes: 3 additions & 3 deletions Scripts/Mesh_rotation.gd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
extends MeshInstance


export var rotation_speed_x = 0.0
export var rotation_speed_y = 0.0
export var rotation_speed_z = 0.0
var rotation_speed_x = 0.0
var rotation_speed_y = 0.0
var rotation_speed_z = 0.0


# Called every frame. 'delta' is the elapsed time since the previous frame.
Expand Down
20 changes: 11 additions & 9 deletions Scripts/Options/Camera.gd
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
extends Node

# TODO: make a function to cap values and pass those through it.
onready var camera_far = 1e9 # 1000000 is a hard cap.
onready var camera_near = 0.01 # 0.01 is a hard cap.
onready var camera_fov = 60 # Is added to bounding box axis value.
onready var camera_inertia_factor = 1.1 # 1.05 ... 1.5 Affects camera inertia.
onready var camera_sensitivity = 3 # 0.1 ... 0.5
onready var camera_turret_roll_vert_limit = 70 # Deg +\-
var camera_far = 1e9 # 1000000 is a hard cap.
var camera_near = 0.01 # 0.01 is a hard cap.

# TODO: make FOV constant and a function of velocity.
var camera_fov = 60 # Is added to bounding box axis value. (????)
var camera_inertia_factor = 1.1 # 1.05 ... 1.5 Affects camera inertia.
var camera_sensitivity = 3 # 0.1 ... 0.5
var camera_turret_roll_vert_limit = 70 # Deg +\-
# Zoom out times is multiplied by minimum ship camera distance to define maximum.
# Sync with touchscreen control slider (max_val = camera_zoom_out_times/camera_zoom_step).
onready var camera_zoom_out_times = 50
onready var camera_zoom_step = 0.1 # 0.05 ... 0.2
onready var velocity_factor_on_tilt = 0.1 # Should be more than one
var camera_zoom_out_times = 50
var camera_zoom_step = 0.1 # 0.05 ... 0.2
var velocity_factor_on_tilt = 0.1 # Should be more than one

# Paths node.
onready var p = get_tree().get_root().get_node("Container/Paths")
Expand Down
10 changes: 5 additions & 5 deletions Scripts/Options/Engine.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
extends Node

onready var physics_fps = 120
onready var graphic_fps = 60
onready var ship_linear_damp = 1
onready var ship_angular_damp = 5
onready var ship_linear_damp_ekill = 0.1
var physics_fps = 120
var graphic_fps = 60
var ship_linear_damp = 1
var ship_angular_damp = 5
var ship_linear_damp_ekill = 0.1

func _ready():
Engine.set_iterations_per_second(physics_fps)
Expand Down
Loading

0 comments on commit 04da4d3

Please sign in to comment.