diff --git a/cars/datto_120y/car.glb b/cars/datto_120y/car.glb index fdc0e20..1f85c54 100644 Binary files a/cars/datto_120y/car.glb and b/cars/datto_120y/car.glb differ diff --git a/cars/datto_120y/stats.tres b/cars/datto_120y/stats.tres index ba81a7d..70d02f4 100644 --- a/cars/datto_120y/stats.tres +++ b/cars/datto_120y/stats.tres @@ -4,7 +4,7 @@ [resource] script = ExtResource("1") -display_name = "Datto 120Y" +display_name = "DADSON 420YO" model_path = "res://cars/datto_120y/car.glb" engine_power = 11.0 mass = 850.0 diff --git a/cars/floored_xd/car.glb b/cars/floored_xd/car.glb new file mode 100644 index 0000000..80a1d65 Binary files /dev/null and b/cars/floored_xd/car.glb differ diff --git a/cars/floored_xd/car.glb.import b/cars/floored_xd/car.glb.import new file mode 100644 index 0000000..62c3bf7 --- /dev/null +++ b/cars/floored_xd/car.glb.import @@ -0,0 +1,42 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://cxi104t18ug8x" +path="res://.godot/imported/car.glb-0a80c2c77b5fd88764c90110abc62a5c.scn" + +[deps] + +source_file="res://cars/floored_xd/car.glb" +dest_files=["res://.godot/imported/car.glb-0a80c2c77b5fd88764c90110abc62a5c.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={} +gltf/naming_version=2 +gltf/embedded_image_handling=1 diff --git a/cars/floored_xd/stats.tres b/cars/floored_xd/stats.tres new file mode 100644 index 0000000..e65cf79 --- /dev/null +++ b/cars/floored_xd/stats.tres @@ -0,0 +1,13 @@ +[gd_resource type="Resource" script_class="CarStats" load_steps=2 format=3] + +[ext_resource type="Script" path="res://src/car_stats.gd" id="1"] + +[resource] +script = ExtResource("1") +display_name = "FLOORED XD LOLTOP" +model_path = "res://cars/floored_xd/car.glb" +engine_power = 22.0 +mass = 1450.0 +grip = 5.2 +length = 4.85 +width = 1.91 diff --git a/cars/turdrunner_slur/car.glb b/cars/turdrunner_slur/car.glb new file mode 100644 index 0000000..6b21589 Binary files /dev/null and b/cars/turdrunner_slur/car.glb differ diff --git a/cars/turdrunner_slur/car.glb.import b/cars/turdrunner_slur/car.glb.import new file mode 100644 index 0000000..cc69edf --- /dev/null +++ b/cars/turdrunner_slur/car.glb.import @@ -0,0 +1,42 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://vplokepyfsqq" +path="res://.godot/imported/car.glb-82b38045503d6fb6d0c217ab3364162e.scn" + +[deps] + +source_file="res://cars/turdrunner_slur/car.glb" +dest_files=["res://.godot/imported/car.glb-82b38045503d6fb6d0c217ab3364162e.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={} +gltf/naming_version=2 +gltf/embedded_image_handling=1 diff --git a/cars/turdrunner_slur/stats.tres b/cars/turdrunner_slur/stats.tres new file mode 100644 index 0000000..07f5e35 --- /dev/null +++ b/cars/turdrunner_slur/stats.tres @@ -0,0 +1,13 @@ +[gd_resource type="Resource" script_class="CarStats" load_steps=2 format=3] + +[ext_resource type="Script" path="res://src/car_stats.gd" id="1"] + +[resource] +script = ExtResource("1") +display_name = "TURDRUNNER SLUR 500" +model_path = "res://cars/turdrunner_slur/car.glb" +engine_power = 21.0 +mass = 1200.0 +grip = 6.0 +length = 4.51 +width = 1.71 diff --git a/shot_crash.png.import b/shot_crash.png.import new file mode 100644 index 0000000..79517bd --- /dev/null +++ b/shot_crash.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://x0ap1xtqufy" +path="res://.godot/imported/shot_crash.png-0fd81ecc7f94fef4c0d6e80bfb3abf5a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://shot_crash.png" +dest_files=["res://.godot/imported/shot_crash.png-0fd81ecc7f94fef4c0d6e80bfb3abf5a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/tests/screenshot.gd b/tests/screenshot.gd index 6649fad..afd1651 100644 --- a/tests/screenshot.gd +++ b/tests/screenshot.gd @@ -16,12 +16,19 @@ func _run() -> void: Game.car_path = cars.get(opts.get("car", ""), cars.values()[0]) Game.level_path = Registry.levels().values()[0] Game.mode = opts.get("mode", "cruise") - root.add_child((load("res://src/game.tscn") as PackedScene).instantiate()) + var game: Game = (load("res://src/game.tscn") as PackedScene).instantiate() + root.add_child(game) await process_frame if opts.get("throttle", "1") == "1": Input.action_press("throttle") for i in int(opts.get("frames", "90")): await physics_frame + if opts.get("cam", "") == "front": + game.set_process(false) # stop the chase cam fighting us + game.cam.global_position = game.car.global_position + game.car.global_basis * Vector3(2.6, 1.6, -6.5) + game.cam.look_at(game.car.global_position + Vector3.UP * 0.4) + await process_frame + await process_frame root.get_texture().get_image().save_png("res://" + opts.get("out", "screenshot.png")) print("screenshot saved") quit(0) diff --git a/tools/build_cars.py b/tools/build_cars.py index 2f1d525..36c42bf 100644 --- a/tools/build_cars.py +++ b/tools/build_cars.py @@ -29,12 +29,24 @@ LIGHT_F = (0.95, 0.92, 0.75, 1) LIGHT_R = (0.7, 0.1, 0.08, 1) # L, W, heights: nose/belt/tail, lengths: bonnet/boot, roof height + rear roof end, -# axle overhangs, wheel radius, paint, chrome bumpers, hatch rear +# axle overhangs, wheel radius, paint, chrome bumpers, hatch rear. +# Optional: doors=2, bonnet_color (two-tone accent), roof_cap (vinyl roof), spoiler. CARS = { "datto_120y": dict(L=3.92, W=1.50, nose=0.62, belt=0.78, tail=0.72, bonnet=1.00, boot=0.85, roof=1.32, roof_rear=0.75, ohang_f=0.72, ohang_r=0.80, wheel=0.27, - paint=(0.78, 0.62, 0.16, 1), chrome_bumpers=True, hatch=False), + paint=(0.90, 0.45, 0.08, 1), chrome_bumpers=True, hatch=False, + roof_cap=(0.24, 0.23, 0.22, 1)), + "turdrunner_slur": dict(L=4.51, W=1.71, nose=0.64, belt=0.82, tail=0.76, + bonnet=1.35, boot=1.15, roof=1.34, roof_rear=0.85, + ohang_f=0.85, ohang_r=0.95, wheel=0.30, + paint=(0.95, 0.75, 0.05, 1), chrome_bumpers=False, hatch=False, + bonnet_color=(0.04, 0.04, 0.04, 1), spoiler=True), + "floored_xd": dict(L=4.85, W=1.91, nose=0.62, belt=0.86, tail=0.80, + bonnet=1.60, boot=1.00, roof=1.31, roof_rear=0.70, + ohang_f=0.95, ohang_r=1.00, wheel=0.31, + paint=(0.04, 0.04, 0.045, 1), chrome_bumpers=False, hatch=False, + doors=2), "gemmy_tx": dict(L=4.13, W=1.57, nose=0.60, belt=0.76, tail=0.70, bonnet=1.15, boot=0.95, roof=1.28, roof_rear=0.80, ohang_f=0.80, ohang_r=0.85, wheel=0.28, @@ -165,28 +177,40 @@ def build(car_id, s): door_z = (bottom + 0.3 + s["belt"]) / 2 door_h = s["belt"] - bottom - 0.32 span = (ws_base - 0.05) - (boot_y + 0.05) - half = span / 2 - parts.append(box("det_door_f%s" % side, (sx * hw, ws_base - 0.05 - half / 2, door_z), - (0.06, half - 0.06, door_h), paint_dk)) - parts.append(box("det_door_r%s" % side, (sx * hw, boot_y + 0.05 + half / 2, door_z), - (0.06, half - 0.06, door_h), paint_dk)) + if s.get("doors", 4) == 2: + parts.append(box("det_door_%s" % side, (sx * hw, ws_base - 0.05 - span * 0.35, door_z), + (0.06, span * 0.68, door_h), paint_dk)) + else: + half = span / 2 + parts.append(box("det_door_f%s" % side, (sx * hw, ws_base - 0.05 - half / 2, door_z), + (0.06, half - 0.06, door_h), paint_dk)) + parts.append(box("det_door_r%s" % side, (sx * hw, boot_y + 0.05 + half / 2, door_z), + (0.06, half - 0.06, door_h), paint_dk)) parts.append(box("det_mirror_%s" % side, (sx * (hw + 0.09), ws_base + 0.05, s["belt"] + 0.10), (0.14, 0.09, 0.12), dark)) parts.append(box("det_bumper_f", (0, f + 0.05, bottom + 0.16), (W + 0.06, 0.15, 0.16), bumper_mat)) parts.append(box("det_bumper_r", (0, r - 0.05, bottom + 0.16), (W + 0.06, 0.15, 0.16), bumper_mat)) - # bonnet plate follows the bonnet slope + # bonnet plate follows the bonnet slope; optional two-tone accent colour + bonnet_mat = material("bonnet", s["bonnet_color"], rough=0.35) if "bonnet_color" in s else paint_dk by1, bz1, by2, bz2 = f - 0.35, nose2, ws_base + 0.03, s["belt"] ang = math.atan2(bz2 - bz1, by2 - by1) parts.append(box("det_bonnet", ((0, (by1 + by2) / 2, (bz1 + bz2) / 2 + 0.02)), - (W * 0.7, math.hypot(by2 - by1, bz2 - bz1) - 0.1, 0.04), paint_dk, rot_x=-ang)) + (W * 0.7, math.hypot(by2 - by1, bz2 - bz1) - 0.1, 0.04), bonnet_mat, rot_x=-ang)) if not s["hatch"]: ty1, tz1, ty2, tz2 = boot_y - 0.03, s["belt"], r + 0.1, s["tail"] ang = math.atan2(tz2 - tz1, ty2 - ty1) parts.append(box("det_boot", ((0, (ty1 + ty2) / 2, (tz1 + tz2) / 2 + 0.02)), (W * 0.7, math.hypot(ty2 - ty1, tz2 - tz1) - 0.1, 0.04), paint_dk, rot_x=-ang)) - trim = [ + trim = [] + if "roof_cap" in s: # vinyl roof + cap_f, cap_r = ws_base - 0.55, boot_y + s["roof_rear"] + trim.append(box("trim_roof", (0, (cap_f + cap_r) / 2, s["roof"] + 0.012), + (W * 0.86, cap_f - cap_r + 0.1, 0.035), material("vinyl", s["roof_cap"], rough=0.9))) + if s.get("spoiler"): # bootlid ducktail + trim.append(box("trim_spoiler", (0, r + 0.22, s["tail"] + 0.05), (W * 0.8, 0.28, 0.09), paint)) + trim += [ box("trim_grille", (0, f + 0.01, s["nose"] - 0.14), (W * 0.5, 0.05, 0.12), dark), box("trim_light_fl", (-W * 0.33, f + 0.02, s["nose"] - 0.13), (0.24, 0.05, 0.13), material("lf", LIGHT_F)), box("trim_light_fr", (W * 0.33, f + 0.02, s["nose"] - 0.13), (0.24, 0.05, 0.13), material("lf2", LIGHT_F)),