From d947b3e11e32ac35d4a439de4ba49f8e44af7955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 19 Nov 2021 19:52:46 +0100 Subject: [PATCH] Make infinite loop infinitely more challenging --- scenes/infinite_loop_track_level.tscn | 10 +++++----- scenes/test_level.tscn | 6 +++--- scenes/tracks/track.gd | 2 +- vehicles/buggy.tscn | 1 - vehicles/vehicle.gd | 20 +++++--------------- 5 files changed, 14 insertions(+), 25 deletions(-) diff --git a/scenes/infinite_loop_track_level.tscn b/scenes/infinite_loop_track_level.tscn index e238ea4..98aeec6 100644 --- a/scenes/infinite_loop_track_level.tscn +++ b/scenes/infinite_loop_track_level.tscn @@ -5,8 +5,8 @@ [sub_resource type="Curve3D" id=4] _data = { -"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -2.93816, 32.5746, 79.8871, 0, 0, 0, 0, 0, 0, 48.497, 32.0944, 57.4446, 0, 0, 0, 0, 0, 0, 63.2095, 34.3302, 15.7474, 0, 0, 0, 0, 0, 0, 52.1399, 31.6108, -13.5262, 0, 0, 0, 0, 0, 0, 24.6326, 28.4639, -50.053, 0, 0, 0, 0, 0, 0, -27.2831, 20.865, -58.278, 0, 0, 0, 0, 0, 0, -51.0554, 17.038, -30.3413, 0, 0, 0, 0, 0, 0, -55.8672, 12.2, 4.13316, 0, 0, 0, 0, 0, 0, -43.3482, 10.9209, 32.963, 0, 0, 0, 0, 0, 0, -8.39052, 10.014, 49.1887, 0, 0, 0, 0, 0, 0, 21.4522, 8.65878, 34.7661, 0, 0, 0, 0, 0, 0, 40.2058, 0, 6.92621, 0, 0, 0, 0, 0, 0, 40.8815, 0, -14.6971, 0, 0, 0, 0, 0, 0, 23.3126, 0, -42.064, 0, 0, 0, 0, 0, 0, 10.4817, 0, -41.5338, 0, 0, 0, 0, 0, 0, -17.5689, 0, -40.3747, 0, 0, 0, 0, 0, 0, -34.1963, -9.99896, -28.4392, 0, 0, 0, 0, 0, 0, -35.0374, -17.5733, 0.755226, -25.1643, -4.15447, -7.00803, 25.1643, 4.15447, 7.00803, -25.3277, -17.0155, 35.5891, 0, 0, 0, 0, 0, 0, 30.9663, -31.3594, 41.4015, 25.1095, -0.168312, 40.6886, -25.1095, 0.168312, -40.6886, 74.4387, -42.4322, -34.9872, 24.8366, -1.73885, -2.57295, -24.8366, 1.73885, 2.57295, -18.0245, -47.6623, -77.0386, 12.9167, -19.1161, -39.5709, -12.9167, 19.1161, 39.5709, -70.8996, -35.9135, -10.4648, -18.5671, -3.54956, -12.2084, 18.5671, 3.54956, 12.2084, 3.23056, -46.2198, 38.3433, -7.34602, -0.837053, 9.12145, 7.34602, 0.837053, -9.12145, 20.9351, -29.8038, 7.50687, 0, 0, 0, 0, 0, 0, 26.4735, -17.5292, -28.661, 0, 0, 0, 0, 0, 0, 9.62503, -10.9842, -69.6461, 0, 0, 0, 0, 0, 0, -19.9905, -9.72571, -68.5394, 0, 0, 0, 0, 0, 0, -54.9526, -10.7115, -44.0475, 0, 0, 0, 0, 0, 0, -68.7456, 2.561, -7.1355, 0, 0, 0, 0, 0, 0, -73.1627, 5.26929, 22.8885, 0, 0, 0, 0, 0, 0, -71.8098, 8.6919, 52.5234, 0, 0, 0, 0, 0, 0, -51.5358, 8.57028, 72.9606, 0, 0, 0, 0, 0, 0, -14.1531, 12.9298, 80.3355, 0, 0, 0, 0, 0, 0, 30.0845, 16.7699, 78.7283, 0, 0, 0, 0, 0, 0, 60.5624, 16.4306, 67.9377, 0, 0, 0, 0, 0, 0, 86.4323, 23.8986, 22.6343, 0, 0, 0, 0, 0, 0, 85.6148, 33.9947, -16.8435, 0, 0, 0, 0, 0, 0, 59.5998, 39.7632, -56.7583, 0, 0, 0, 0, 0, 0, -16.8105, 77.966, -101.612, 0, 0, 0, 0, 0, 0, -92.7544, 76.6498, -73.9173, 0, 0, 0, 0, 0, 0, -103.525, 68.271, -15.5888, 0, 0, 0, 0, 0, 0, -98.0169, 53.956, 35.8501, 0, 0, 0, 0, 0, 0, -35.8837, 32.0277, 68.4275, 0, 0, 0, 0, 0, 0, -14.8362, 33.0891, 79.7792, 0, 0, 0, 0, 0, 0, -2.93816, 32.5746, 79.8871 ), -"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) +"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, 14.216, 39.4324, 71.6595, 0, 0, 0, 0, 0, 0, 48.497, 32.0944, 57.4446, 0, 0, 0, 0, 0, 0, 63.2095, 34.3302, 15.7474, 0, 0, 0, 0, 0, 0, 52.1399, 31.6108, -13.5262, 0, 0, 0, 0, 0, 0, 24.6326, 28.4639, -50.053, 23.6642, 2.81437, -11.3263, -23.6642, -2.81437, 11.3263, -27.2831, 20.865, -58.278, 13.9886, 2.61135, -22.1052, -13.9886, -2.61135, 22.1052, -57.3715, 19.9951, -34.0108, 0, 0, 0, 0, 0, 0, -55.8672, 12.2, 4.13316, 0, 0, 0, 0, 0, 0, -43.3482, 10.9209, 32.963, 0, 0, 0, 0, 0, 0, -8.39052, 10.014, 49.1887, 0, 0, 0, 0, 0, 0, 21.4522, 8.65878, 34.7661, 0, 0, 0, 0, 0, 0, 40.2058, 0, 6.92621, 0, 0, 0, 0, 0, 0, 40.8815, 0, -14.6971, 0, 0, 0, 0, 0, 0, 23.3126, 0, -42.064, 0, 0, 0, 0, 0, 0, 10.4817, 0, -41.5338, 0, 0, 0, 0, 0, 0, -17.5689, 0, -40.3747, 0, 0, 0, 0, 0, 0, -34.1963, -9.99896, -28.4392, 0, 0, 0, 0, 0, 0, -35.0374, -17.5733, 0.755226, -25.1643, -4.15447, -7.00803, 25.1643, 4.15447, 7.00803, -25.3277, -17.0155, 35.5891, -31.1923, 0.679697, 9.17976, 31.1923, -0.679697, -9.17976, 32.5606, -14.9507, 34.5135, 12.799, 2.25521, 21.396, -12.799, -2.25521, -21.396, 94.622, -21.5309, -8.64266, 22.7995, 6.03879, 7.95921, -22.7995, -6.03879, -7.95921, 48.1915, -51.2168, -78.3252, 19.6079, 3.36048, -7.09978, -19.6079, -3.36048, 7.09978, -9.52077, -51.4458, -96.3843, 0, 0, 0, 0, 0, 0, -75.738, -51.7315, -69.4881, -19.5447, 7.40563, -123.686, 19.5447, -7.40563, 123.686, -111.384, -52.9403, -0.640272, -20.5081, -7.15141, 4.13271, 20.5081, 7.15141, -4.13271, -0.272314, -41.7673, 38.5707, -6.85563, 1.04683, 8.9799, 6.85563, -1.04683, -8.9799, 25.8795, -40.0437, 1.30272, 0, 0, 0, 0, 0, 0, 25.7356, -35.7572, -35.2028, 24.8742, -2.83045, 4.38934, -24.8742, 2.83045, -4.38934, 10.7914, -19.7015, -72.2903, 0, 0, 0, 0, 0, 0, -36.1634, -18.286, -75.8325, 0, 0, 0, 0, 0, 0, -88.1544, -27.7213, -59.939, -4.80772, -11.8088, -46.0525, 4.80772, 11.8088, 46.0525, -125.849, -7.63193, -14.1127, 0, 0, 0, 0, 0, 0, -103.239, -7.89527, 49.2235, 0, 0, 0, 0, 0, 0, -56.7135, -9.16963, 78.2503, -19.945, -1.47294, -6.20989, 19.945, 1.47294, 6.20989, -17.1642, -3.8681, 98.5664, -17.4425, -7.26221, 0.510544, 17.4425, 7.26221, -0.510544, 40.278, -0.352409, 87.5018, -18.589, -11.2058, 5.2025, 18.589, 11.2058, -5.2025, 83.364, 7.04305, 73.1424, -15.6005, -1.56422, 29.2132, 15.6005, 1.56422, -29.2132, 127.511, 18.2447, 10.7672, 13.9779, -21.9478, 42.154, -13.9779, 21.9478, -42.154, 124.034, 29.2792, -82.4309, 35.0404, -1.58311, 22.4948, -35.0404, 1.58311, -22.4948, 74.3478, 58.2156, -162.005, 37.4588, 1.0821, -12.1337, -37.4588, -1.0821, 12.1337, -52.9686, 64.7964, -176.08, 56.0781, 4.44358, -54.6466, -56.0781, -4.44358, 54.6466, -150.169, 50.2784, -91.5872, 0, 0, 0, 0, 0, 0, -160.337, 46.2063, 19.0639, -28.4822, -5.91084, -24.8541, 28.4822, 5.91084, 24.8541, -103.293, 36.1836, 85.952, 0, 0, 0, 0, 0, 0, -51.992, 40.1074, 108.911, 0, 0, 0, 0, 0, 0, -20.3378, 34.0526, 93.3445, -22.3177, -2.73847, -8.35827, 22.3177, 2.73847, 8.35827, -3.68909, 39.4619, 74.5694 ), +"tilts": PoolRealArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) } [sub_resource type="Shader" id=5] @@ -82,15 +82,15 @@ extents = Vector3( 226.72, 25.6138, 197.933 ) [node name="Spatial" instance=ExtResource( 1 )] [node name="PlayerSpawnLocation" parent="." index="1"] -transform = Transform( -0.726143, 0, 0.687544, 0, 1, 0, -0.687544, 0, -0.726143, -14.0246, 40.6615, 83.417 ) +transform = Transform( -0.726143, 0, 0.687544, 0, 1, 0, -0.687544, 0, -0.726143, 3.26113, 52.1483, 95.1165 ) [node name="Track" parent="." index="2"] track_path = NodePath("../Path") checkpoint_count = 30 -checkpoint_dim = Vector2( 10, 20 ) +checkpoint_dim = Vector2( 25, 25 ) [node name="Path" type="Path" parent="." index="3"] -transform = Transform( 1.06734, 0, 0, 0, 1.06734, 0, 0, 0, 1.06734, 0, 0, 0 ) +transform = Transform( 1.06734, 0, 0, 0, 1.06734, 0, 0, 0, 1.06734, 8.02585, 1.25703, 17.8349 ) curve = SubResource( 4 ) [node name="Track" type="CSGPolygon" parent="Path" index="0"] diff --git a/scenes/test_level.tscn b/scenes/test_level.tscn index 19eb5d0..62fb07b 100644 --- a/scenes/test_level.tscn +++ b/scenes/test_level.tscn @@ -24,7 +24,7 @@ period = 10.0 persistence = 0.49 lacunarity = 2.04 -[sub_resource type="NoiseTexture" id=10] +[sub_resource type="NoiseTexture" id=17] flags = 39 seamless = true noise = SubResource( 15 ) @@ -32,9 +32,9 @@ noise_offset = Vector2( -1, -1 ) [sub_resource type="SpatialMaterial" id=16] albedo_color = Color( 0.4, 0.301961, 0.00784314, 1 ) -albedo_texture = SubResource( 10 ) +albedo_texture = SubResource( 17 ) -[node name="Spatial" instance=ExtResource( 1 )] +[node name="Spatial2" instance=ExtResource( 1 )] [node name="PlayerSpawnLocation" parent="." index="1"] transform = Transform( -0.951412, 0, -0.307921, 0, 1, 0, 0.307921, 0, -0.951412, -26.0175, 5.60708, 25.9637 ) diff --git a/scenes/tracks/track.gd b/scenes/tracks/track.gd index bc1bd27..3a3324e 100644 --- a/scenes/tracks/track.gd +++ b/scenes/tracks/track.gd @@ -32,7 +32,7 @@ func _ready() -> void: for _checkpoint_number in range(checkpoint_count): var new_checkpoint: Area = Area.new() new_checkpoint.add_child(_build_checkpoint_collision()) - new_checkpoint.transform.origin = path.curve.interpolate_baked(section, true) + new_checkpoint.transform.origin = path.curve.interpolate_baked(section) section += section_size checkpoints.add_child(new_checkpoint) if GlobalSettings.debug: diff --git a/vehicles/buggy.tscn b/vehicles/buggy.tscn index e1e27f9..cf4a571 100644 --- a/vehicles/buggy.tscn +++ b/vehicles/buggy.tscn @@ -43,7 +43,6 @@ rings = 3 [node name="buggy" groups=["car"] instance=ExtResource( 1 )] mass = 150.0 script = ExtResource( 3 ) -BASE_ENGINE_PITCH = 0.95 gear_ratios = [ 3.4, 2.5, 2.0, 1.5, 1.25, 1.0 ] power_curve = SubResource( 2 ) sound_curve = SubResource( 4 ) diff --git a/vehicles/vehicle.gd b/vehicles/vehicle.gd index f75c3d5..e9ed7f8 100644 --- a/vehicles/vehicle.gd +++ b/vehicles/vehicle.gd @@ -56,6 +56,8 @@ onready var max_steer_angle_rad: float = deg2rad(max_steer_angle) onready var speed_steer_angle_rad: float = deg2rad(speed_steer_angle) onready var max_steer_input_rad: float = deg2rad(max_steer_input) +onready var auto_clutch_rpm_limit = max_rpm * automatic_gear_down_threshold + func _ready(): for wheel in [frwheel, flwheel, rrwheel, rlwheel]: @@ -139,23 +141,11 @@ func _physics_process(delta: float): var wheel_rpm = traction_wheels[0].get_rpm() var speed = wheel_rpm * 2.0 * PI * rrwheel.wheel_radius / 60.0 * 3600.0 / 1000.0 - if ( - GlobalSettings.automatic_transmission - and speed >= 0 - and speed < 1 - and gear == 1 - and brake_input > 0.1 - ): + if GlobalSettings.automatic_transmission and speed < 1 and gear == 1 and brake_input > 0.1: _gear_down() _gear_down() - if ( - GlobalSettings.automatic_transmission - and speed <= 0 - and speed > -1 - and gear == -1 - and throttle > 0.1 - ): + if GlobalSettings.automatic_transmission and speed > -1 and gear == -1 and throttle > 0.1: _gear_up() _gear_up() @@ -165,7 +155,7 @@ func _physics_process(delta: float): brake_input = swap if GlobalSettings.auto_clutch or GlobalSettings.automatic_transmission: - clutch_position = 1 - min(rpm, 900) / 900.0 + clutch_position = 1 - min(rpm, auto_clutch_rpm_limit) / auto_clutch_rpm_limit if gear_timer > 0: clutch_position = 1