Compare commits

...

8 Commits

33 changed files with 688 additions and 40 deletions

2
.gitignore vendored
View File

@@ -1 +1,3 @@
game/.godot
result
*.blend1

View File

@@ -29,9 +29,50 @@
packages = with pkgs; [
godot
blender
krita
gimp
];
};
}
);
packages = forAllSystems (
{ pkgs }:
{
fmm = pkgs.stdenv.mkDerivation {
pname = "fmm";
version = "0.1.0";
src = ./.;
strictDeps = true;
nativeBuildInputs = with pkgs; [
godot
];
buildPhase = ''
runHook preBuild
export HOME=$(mktemp -d)
mkdir -p $HOME/.local/share/godot/
ln -s ${pkgs.godot.export-template}/share/godot/export_templates "$HOME/.local/share/godot/"
mkdir -p game/build
cd game
echo "godot --headless --export-debug Linux ./build/fmm"
godot --headless --export-release Linux ./build/fmm
runHook postBuild
'';
installPhase = ''
find .
install -D -m 755 -t $out/libexec ./build/fmm
install -D -m 644 -t $out/libexec ./build/fmm.pck
install -d -m 755 $out/bin
ln -s $out/libexec/fmm $out/bin/fmm
'';
};
}
);
};
}

View File

@@ -9,9 +9,12 @@ const FOV_LERP = 0.2
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
var bullet = load("res://bullet.tscn")
@onready var head = $Head
@onready var camera = $Head/PlayerCamera
@onready var player_debug = $Head/PlayerCamera/PlayerDebug
@onready var overlay_fps = $Head/PlayerCamera/OverlayFPS
@onready var player_stats = $PlayerStats
@onready var anim_player = $AnimationPlayer
@onready var muzzle_flash = $Head/PlayerCamera/pistol/MuzzleFlash
@@ -39,6 +42,13 @@ func _unhandled_input(event: InputEvent) -> void:
if Input.is_action_just_pressed("debug_overlay"):
player_debug.visible = !player_debug.visible
if Input.is_action_just_pressed("overlay_fps"):
if !overlay_fps.visible:
overlay_fps.visible = true
elif !overlay_fps.advanced_output:
overlay_fps.advanced_output = true
else:
overlay_fps.advanced_output = false
func _physics_process(delta: float) -> void:
if not is_on_floor():
@@ -86,10 +96,9 @@ func play_shoot_effect():
muzzle_flash.restart()
muzzle_flash.emitting = true
var collider = pistol_raycast.get_collider()
var col_point = pistol_raycast.get_collision_point()
if col_point and collider:
var b = bullet_decal.instantiate()
pistol_raycast.get_collider().add_child(b)
b.global_transform.origin = col_point
b.look_at(col_point + pistol_raycast.get_collision_normal(), Vector3.UP)
var parent = get_parent()
if parent:
var instance: Node3D = bullet.instantiate()
instance.position = pistol_raycast.global_position
instance.transform.basis = pistol_raycast.global_transform.basis
parent.add_child(instance)

BIN
game/assets/textures/circle_mask.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7n43gk3vc0cm"
path.s3tc="res://.godot/imported/circle_mask.png-cd67d89c80f71e333d9b72d12bb3dfb4.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/circle_mask.png"
dest_files=["res://.godot/imported/circle_mask.png-cd67d89c80f71e333d9b72d12bb3dfb4.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=0

BIN
game/assets/textures/cloud_noise.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://exuvqvppvyre"
path.s3tc="res://.godot/imported/cloud_noise.png-65ba324dbb61c2827eb3b66fb0445ac2.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/cloud_noise.png"
dest_files=["res://.godot/imported/cloud_noise.png-65ba324dbb61c2827eb3b66fb0445ac2.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=0

BIN
game/assets/textures/solid_noise.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bs83wip0gghsc"
path.s3tc="res://.godot/imported/solid_noise.png-ea31f28dd51b66a6a0e60730a106aab8.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/solid_noise.png"
dest_files=["res://.godot/imported/solid_noise.png-ea31f28dd51b66a6a0e60730a106aab8.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=0

29
game/bullet.gd Normal file
View File

@@ -0,0 +1,29 @@
extends Node3D
const SPEED = 80.0
@onready var raycast = $bullet/RayCast3D
@onready var bullet_decal = preload("res://bullet_decal.tscn")
func _ready() -> void:
pass
func _process(delta: float) -> void:
var next_pos = position + transform.basis * Vector3(0,0,-SPEED) * delta
raycast.visible = true
raycast.target_position = raycast.position + raycast.transform.basis * Vector3(0,0,SPEED) * delta * 1.5
position = next_pos
var collider = raycast.get_collider()
var col_point = raycast.get_collision_point()
if col_point and collider:
var b = bullet_decal.instantiate()
raycast.get_collider().add_child(b)
b.global_transform.origin = col_point
b.look_at(col_point + raycast.get_collision_normal(), Vector3.UP)
b.particles.emitting = true
b.smoke.emitting = true
queue_free()
func _on_timer_timeout() -> void:
queue_free()

1
game/bullet.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://j5k8dvghgsf4

20
game/bullet.tscn Normal file
View File

@@ -0,0 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://c603t5do5rnqk"]
[ext_resource type="Script" uid="uid://j5k8dvghgsf4" path="res://bullet.gd" id="1_v8qja"]
[ext_resource type="PackedScene" uid="uid://bg1q0xweaefoq" path="res://models/bullet.glb" id="2_t4vbm"]
[node name="Bullet" type="Node3D"]
script = ExtResource("1_v8qja")
[node name="bullet" parent="." instance=ExtResource("2_t4vbm")]
[node name="RayCast3D" type="RayCast3D" parent="bullet"]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
target_position = Vector3(0, -0.2, 0)
[node name="Timer" type="Timer" parent="bullet"]
wait_time = 10.0
one_shot = true
autostart = true
[connection signal="timeout" from="bullet/Timer" to="." method="_on_timer_timeout"]

4
game/bullet_decal.gd Normal file
View File

@@ -0,0 +1,4 @@
extends Node3D
@onready var particles = $MeshInstance3D/GPUParticles3D
@onready var smoke = $MeshInstance3D/GPUParticles3D2

1
game/bullet_decal.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://rqqeb4ls4tgf

View File

@@ -1,4 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://5dqpmmbur7v6"]
[gd_scene load_steps=15 format=3 uid="uid://5dqpmmbur7v6"]
[ext_resource type="Script" uid="uid://rqqeb4ls4tgf" path="res://bullet_decal.gd" id="1_mfh3f"]
[ext_resource type="Shader" uid="uid://d4ml3kj8ympbf" path="res://bullet_decal_smoke.tres" id="2_nqa4f"]
[sub_resource type="PlaneMesh" id="PlaneMesh_q27hx"]
size = Vector2(0.05, 0.05)
@@ -7,9 +10,77 @@ orientation = 2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_mfh3f"]
albedo_color = Color(0, 0, 0, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_q27hx"]
albedo_color = Color(0, 0, 0, 1)
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_mfh3f"]
direction = Vector3(0, 0, -1)
initial_velocity_min = 5.0
initial_velocity_max = 5.0
[sub_resource type="BoxMesh" id="BoxMesh_nqa4f"]
size = Vector3(0.05, 0.05, 0.05)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_6cwkj"]
render_priority = 0
shader = ExtResource("2_nqa4f")
[sub_resource type="Curve" id="Curve_nqa4f"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.60628, 0.717391), -1.24468, -1.24468, 0, 0, Vector2(0.978261, 0), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_6cwkj"]
curve = SubResource("Curve_nqa4f")
[sub_resource type="Gradient" id="Gradient_mp8ng"]
[sub_resource type="GradientTexture1D" id="GradientTexture1D_mi8h0"]
gradient = SubResource("Gradient_mp8ng")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_nqa4f"]
particle_flag_align_y = true
particle_flag_rotate_y = true
angle_min = -180.0
angle_max = 180.0
direction = Vector3(0, -1, 1)
spread = 0.0
initial_velocity_min = 1.8
initial_velocity_max = 2.3
angular_velocity_min = -50.0
angular_velocity_max = 50.0
gravity = Vector3(0, 0, 0)
color_ramp = SubResource("GradientTexture1D_mi8h0")
alpha_curve = SubResource("CurveTexture_6cwkj")
[sub_resource type="QuadMesh" id="QuadMesh_8hcic"]
[node name="BulletDecal" type="Node3D"]
script = ExtResource("1_mfh3f")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -1, -8.74228e-08, 0, 8.74228e-08, -1, 0, 0, -0.00702295)
mesh = SubResource("PlaneMesh_q27hx")
surface_material_override/0 = SubResource("StandardMaterial3D_mfh3f")
[node name="GPUParticles3D" type="GPUParticles3D" parent="MeshInstance3D"]
transform = Transform3D(1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 5.15351e-11, -0.000589493)
visible = false
material_override = SubResource("StandardMaterial3D_q27hx")
emitting = false
amount = 16
lifetime = 1.5
one_shot = true
explosiveness = 1.0
process_material = SubResource("ParticleProcessMaterial_mfh3f")
draw_pass_1 = SubResource("BoxMesh_nqa4f")
[node name="GPUParticles3D2" type="GPUParticles3D" parent="MeshInstance3D"]
material_override = SubResource("ShaderMaterial_6cwkj")
emitting = false
amount = 16
lifetime = 0.5
one_shot = true
explosiveness = 0.86
fixed_fps = 60
process_material = SubResource("ParticleProcessMaterial_nqa4f")
draw_pass_1 = SubResource("QuadMesh_8hcic")

View File

@@ -0,0 +1,14 @@
shader_type spatial;
void vertex() {
// Called for every vertex the material is visible on.
}
void fragment() {
// Called for every pixel the material is visible on.
}
//void light() {
// // Called for every pixel for every light affecting the material.
// // Uncomment to replace the default light processing function with this one.
//}

View File

@@ -0,0 +1 @@
uid://buhpmxsxpx5iv

View File

@@ -0,0 +1,105 @@
[gd_resource type="VisualShader" load_steps=10 format=3 uid="uid://d4ml3kj8ympbf"]
[ext_resource type="Texture2D" uid="uid://exuvqvppvyre" path="res://assets/textures/cloud_noise.png" id="1_exml1"]
[ext_resource type="Texture2D" uid="uid://b7n43gk3vc0cm" path="res://assets/textures/circle_mask.png" id="2_3sobh"]
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_mjuxj"]
output_port_for_preview = 0
expanded_output_ports = [0]
texture = ExtResource("1_exml1")
[sub_resource type="VisualShaderNodeTexture" id="VisualShaderNodeTexture_xamyu"]
expanded_output_ports = [0]
texture = ExtResource("2_3sobh")
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_qilve"]
expanded_output_ports = [0]
input_name = "color"
[sub_resource type="VisualShaderNodeRemap" id="VisualShaderNodeRemap_bocjt"]
default_input_values = [1, 0.0, 2, 1.0, 3, 0.0, 4, 8.0]
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_t3qas"]
operator = 2
[sub_resource type="VisualShaderNodeInput" id="VisualShaderNodeInput_586rk"]
expanded_output_ports = [0]
input_name = "color"
[sub_resource type="VisualShaderNodeFloatOp" id="VisualShaderNodeFloatOp_74lg2"]
operator = 2
[resource]
code = "shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_lambert, specular_schlick_ggx;
uniform sampler2D tex_frg_2;
uniform sampler2D tex_frg_3;
void fragment() {
// Input:4
vec4 n_out4p0 = COLOR;
float n_out4p1 = n_out4p0.r;
float n_out5p0;
// Remap:5
float n_in5p1 = 0.00000;
float n_in5p2 = 1.00000;
float n_in5p3 = 0.00000;
float n_in5p4 = 8.00000;
{
float __input_range = n_in5p2 - n_in5p1;
float __output_range = n_in5p4 - n_in5p3;
n_out5p0 = n_in5p3 + __output_range * ((n_out4p1 - n_in5p1) / __input_range);
}
// Texture2D:2
vec4 n_out2p0 = textureLod(tex_frg_2, UV, n_out5p0);
float n_out2p1 = n_out2p0.r;
// Texture2D:3
vec4 n_out3p0 = texture(tex_frg_3, UV);
float n_out3p1 = n_out3p0.r;
// FloatOp:6
float n_out6p0 = n_out2p1 * n_out3p1;
// Input:7
vec4 n_out7p0 = COLOR;
float n_out7p4 = n_out7p0.a;
// FloatOp:8
float n_out8p0 = n_out6p0 * n_out7p4;
// Output:0
ALPHA = n_out8p0;
}
"
graph_offset = Vector2(-547.271, 545.865)
nodes/fragment/0/position = Vector2(400, 900)
nodes/fragment/2/node = SubResource("VisualShaderNodeTexture_mjuxj")
nodes/fragment/2/position = Vector2(-360, 400)
nodes/fragment/3/node = SubResource("VisualShaderNodeTexture_xamyu")
nodes/fragment/3/position = Vector2(-1240, 1020)
nodes/fragment/4/node = SubResource("VisualShaderNodeInput_qilve")
nodes/fragment/4/position = Vector2(-1080, 360)
nodes/fragment/5/node = SubResource("VisualShaderNodeRemap_bocjt")
nodes/fragment/5/position = Vector2(-700, 500)
nodes/fragment/6/node = SubResource("VisualShaderNodeFloatOp_t3qas")
nodes/fragment/6/position = Vector2(-80, 900)
nodes/fragment/7/node = SubResource("VisualShaderNodeInput_586rk")
nodes/fragment/7/position = Vector2(-420, 1240)
nodes/fragment/8/node = SubResource("VisualShaderNodeFloatOp_74lg2")
nodes/fragment/8/position = Vector2(140, 1040)
nodes/fragment/connections = PackedInt32Array(4, 1, 5, 0, 5, 0, 2, 1, 2, 1, 6, 0, 3, 1, 6, 1, 7, 4, 8, 1, 6, 0, 8, 0, 8, 0, 0, 1)

41
game/export_presets.cfg Normal file
View File

@@ -0,0 +1,41 @@
[preset.0]
name="Linux"
platform="Linux"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path=""
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""
seed=0
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.0.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=1
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="x86_64"
ssh_remote_deploy/enabled=false
ssh_remote_deploy/host="user@host_ip"
ssh_remote_deploy/port="22"
ssh_remote_deploy/extra_args_ssh=""
ssh_remote_deploy/extra_args_scp=""
ssh_remote_deploy/run_script="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""

13
game/main_menu.gd Normal file
View File

@@ -0,0 +1,13 @@
extends Control
func _on_play_pressed() -> void:
get_tree().change_scene_to_file("res://world.tscn")
func _on_options_pressed() -> void:
get_tree().change_scene_to_file("res://options_menu.tscn")
func _on_quit_pressed() -> void:
get_tree().quit(0)

1
game/main_menu.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://bsx7nporxaoa6

36
game/main_menu.tscn Normal file
View File

@@ -0,0 +1,36 @@
[gd_scene load_steps=2 format=3 uid="uid://3pysj67x88uw"]
[ext_resource type="Script" uid="uid://bsx7nporxaoa6" path="res://main_menu.gd" id="1_06t4h"]
[node name="MainMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_06t4h")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
[node name="Play" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Play Game"
[node name="Options" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Options"
[node name="Quit" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Quit"
[connection signal="pressed" from="MarginContainer/VBoxContainer/Play" to="." method="_on_play_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/Options" to="." method="_on_options_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"]

BIN
game/models/bullet.glb (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,37 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bg1q0xweaefoq"
path="res://.godot/imported/bullet.glb-761cf96ec3ba072116e1903fca9d773a.scn"
[deps]
source_file="res://models/bullet.glb"
dest_files=["res://.godot/imported/bullet.glb-761cf96ec3ba072116e1903fca9d773a.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
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=""
_subresources={}
gltf/naming_version=1
gltf/embedded_image_handling=1

12
game/options_menu.gd Normal file
View File

@@ -0,0 +1,12 @@
extends Control
func _on_back_pressed() -> void:
get_tree().change_scene_to_file("res://main_menu.tscn")
func _on_check_button_toggled(toggled_on: bool) -> void:
if toggled_on:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)

1
game/options_menu.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://csr3f6vfeqim8

34
game/options_menu.tscn Normal file
View File

@@ -0,0 +1,34 @@
[gd_scene load_steps=2 format=3 uid="uid://gu2cm1ekgftu"]
[ext_resource type="Script" uid="uid://csr3f6vfeqim8" path="res://options_menu.gd" id="1_lbr8e"]
[node name="OptionsMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_lbr8e")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
[node name="Back" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Back"
[node name="CheckButton" type="CheckButton" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Fullscreen"
[connection signal="pressed" from="MarginContainer/VBoxContainer/Back" to="." method="_on_back_pressed"]
[connection signal="toggled" from="MarginContainer/VBoxContainer/CheckButton" to="." method="_on_check_button_toggled"]

25
game/overlay_fps.gd Normal file
View File

@@ -0,0 +1,25 @@
extends CanvasLayer
@onready var text = $RichTextLabel
@onready var timer = $Timer
var advanced_output: bool = false
func _ready() -> void:
visible = false
func _on_timer_timeout() -> void:
text.clear()
text.add_text("FPS: %s\n" % Engine.get_frames_per_second())
if advanced_output:
var res = DisplayServer.window_get_size()
text.add_text("res: %sx%s\n" % [res.x, res.y])
var device = RenderingServer.get_rendering_device()
text.add_text("rendering_device: %s\n" % device.get_device_name())
text.add_text("%s\n" % device.get_perf_report())
func _on_visibility_changed() -> void:
if visible:
timer.start()
else:
timer.stop()

1
game/overlay_fps.gd.uid Normal file
View File

@@ -0,0 +1 @@
uid://dfns2snn6qqpw

View File

@@ -1,10 +1,11 @@
[gd_scene load_steps=19 format=3 uid="uid://dkldpdufpl28x"]
[gd_scene load_steps=20 format=3 uid="uid://dkldpdufpl28x"]
[ext_resource type="Script" uid="uid://5vty5riyfef2" path="res://Player.gd" id="1_4flbx"]
[ext_resource type="Script" uid="uid://cad5seggccvp6" path="res://player_debug.gd" id="2_onrkg"]
[ext_resource type="PackedScene" uid="uid://ditco83gy03gm" path="res://models/pistol.glb" id="3_hqtel"]
[ext_resource type="Script" uid="uid://7ads6wescib" path="res://player_stats.gd" id="3_i3pqv"]
[ext_resource type="Texture2D" uid="uid://cmldtn5n8a7vr" path="res://assets/textures/star_01.png" id="4_sweqy"]
[ext_resource type="Script" uid="uid://dfns2snn6qqpw" path="res://overlay_fps.gd" id="5_2hs0m"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_fj7yv"]
@@ -42,6 +43,33 @@ material = SubResource("StandardMaterial3D_b26j0")
size = Vector2(0.4, 0.4)
orientation = 2
[sub_resource type="Animation" id="Animation_sweqy"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Head/PlayerCamera/pistol:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(0.492394, -0.353437, -0.607601)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Head/PlayerCamera/pistol:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(0, 0.0417832, 0)]
}
[sub_resource type="Animation" id="Animation_hqtel"]
resource_name = "idle"
length = 3.0
@@ -72,33 +100,6 @@ tracks/1/keys = {
"values": [Vector3(0, 0.0417832, 0), Vector3(-0.133121, 0.0421564, -0.00559862)]
}
[sub_resource type="Animation" id="Animation_sweqy"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Head/PlayerCamera/pistol:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(0.492394, -0.353437, -0.607601)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Head/PlayerCamera/pistol:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(0, 0.0417832, 0)]
}
[sub_resource type="Animation" id="Animation_2hs0m"]
resource_name = "move"
loop_mode = 1
@@ -187,6 +188,7 @@ skeleton = NodePath("../..")
[node name="PlayerCamera" type="Camera3D" parent="Head"]
[node name="PlayerDebug" type="CanvasLayer" parent="Head/PlayerCamera"]
visible = false
script = ExtResource("2_onrkg")
[node name="PlayerDebugText" type="RichTextLabel" parent="Head/PlayerCamera/PlayerDebug"]
@@ -207,8 +209,27 @@ process_material = SubResource("ParticleProcessMaterial_dw050")
draw_pass_1 = SubResource("PlaneMesh_n7ghd")
[node name="RayCast3D" type="RayCast3D" parent="Head/PlayerCamera/pistol"]
transform = Transform3D(0.998255, -0.041771, 0.0417346, 0.041771, -4.37114e-08, -0.999127, 0.0417346, 0.999127, 0.00174477, 0.000758827, 0.0641694, -0.246936)
target_position = Vector3(0, -50, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.000758827, 0.0641694, -0.246936)
target_position = Vector3(0, 0, -90)
[node name="OverlayFPS" type="CanvasLayer" parent="Head/PlayerCamera"]
script = ExtResource("5_2hs0m")
[node name="RichTextLabel" type="RichTextLabel" parent="Head/PlayerCamera/OverlayFPS"]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -1153.0
offset_bottom = 40.0
grow_horizontal = 0
size_flags_horizontal = 8
size_flags_vertical = 0
text = "FPS: 10.0"
fit_content = true
horizontal_alignment = 2
[node name="Timer" type="Timer" parent="Head/PlayerCamera/OverlayFPS"]
wait_time = 0.5
[node name="PlayerStats" type="Node" parent="."]
script = ExtResource("3_i3pqv")
@@ -219,3 +240,6 @@ libraries = {
}
autoplay = "move"
playback_default_blend_time = 0.05
[connection signal="visibility_changed" from="Head/PlayerCamera/OverlayFPS" to="Head/PlayerCamera/OverlayFPS" method="_on_visibility_changed"]
[connection signal="timeout" from="Head/PlayerCamera/OverlayFPS/Timer" to="Head/PlayerCamera/OverlayFPS" method="_on_timer_timeout"]

View File

@@ -57,3 +57,8 @@ shoot={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(204, 17),"global_position":Vector2(213, 65),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
overlay_fps={
"deadzone": 0.2,
"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":4194333,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

BIN
models/bullet.glb (Stored with Git LFS) Normal file

Binary file not shown.

BIN
models/pistol.blend (Stored with Git LFS)

Binary file not shown.