This commit is contained in:
2025-05-09 23:06:36 +02:00
parent f3d332f39c
commit dda8eac39a
135 changed files with 8297 additions and 186 deletions

4
src/Actions/Action.gd Normal file
View File

@@ -0,0 +1,4 @@
class_name Action extends Node
func perform_action():
pass

View File

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

View File

@@ -0,0 +1,4 @@
class_name SceneChangeAction extends Action
func perform_action():
SceneLoader.load_scene('res://scenes/th.tscn')

View File

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

View File

@@ -0,0 +1,6 @@
class_name TestEffect
extends CompositorEffect
func _render_callback(effect_callback_type: int, render_data: RenderData) -> void:
print("hi")
pass

View File

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

View File

@@ -1,4 +1,4 @@
extends Node3D
class_name PlayerCameraController extends Node3D
@export var target : Node3D
@onready var camera = $Camera3D
@@ -23,7 +23,7 @@ func _process(delta):
global_position = target.global_position
rotation.x = clamp(rotation.x - lookInput.x * delta * 0.3, PI*-0.48, PI*0.2)
rotation.x = clamp(rotation.x - lookInput.x * delta * 0.3, PI*-0.48, PI*0.48)
rotation.y -= lookInput.y * delta * 0.3
lookInput = Vector2.ZERO

View File

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

View File

@@ -0,0 +1,5 @@
class_name Character extends Node
var position: Vector3:
set(value):
$Physics.position = value

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
extends Node3D
class_name PhysicsInterpolator extends Node3D
@export var physicsObject : PhysicsBody3D

View File

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

View File

@@ -0,0 +1,26 @@
class_name PlayerInput extends Node
var camera : Camera3D
func getInputVector() -> Vector3 :
var cam_basis = camera.global_transform.basis
cam_basis.x.y = 0
cam_basis.x = cam_basis.x.normalized()
cam_basis.z.y = 0
cam_basis.z = cam_basis.z.normalized()
var input = Input.get_vector("move_left", "move_right", "move_up", "move_down")
var relativeInput = Vector3.ZERO
relativeInput += input.x * cam_basis.x
relativeInput += input.y * cam_basis.z
return relativeInput
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

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

View File

@@ -5,7 +5,16 @@ var pause_menu: PauseMenu
func _ready() -> void:
pause_menu = pause_menu_res.instantiate()
get_tree().root.add_child.call_deferred(pause_menu)
func load_menu(initial: bool = false):
if not initial: pause_game(false)
SceneLoader.load_scene('res://ui/main_menu.tscn')
func start_new_game() -> void:
SceneLoader.load_scene('res://scenes/world2.tscn')
func world_loaded(_world: World) -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed('ui_cancel'):
@@ -15,6 +24,6 @@ func quit_game():
get_tree().quit()
func pause_game(pause = true):
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE if pause else Input.MOUSE_MODE_CAPTURED
get_tree().paused = pause
pause_menu.visible = pause
if pause: get_tree().root.add_child(pause_menu)
else: pause_menu.get_parent().remove_child(pause_menu)

1
src/game_manager.gd.uid Normal file
View File

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

25
src/interactable.gd Normal file
View File

@@ -0,0 +1,25 @@
class_name Interactable extends PhysicsBody3D
signal interacted
@export_group('Interaction settings')
@export var action_label: String
@export var can_be_picked_up: bool = false
@export_group('Visual settings')
@export var visual_mesh: GeometryInstance3D
@export var highlight_material: Material
var highlighted: bool:
get: return highlighted
set(val):
highlighted = val
set_highlight_material(val)
func set_highlight_material(val: bool):
visual_mesh.material_overlay = highlight_material if val else null
func interact(interactor: Interactor):
interacted.emit()
if interactor and can_be_picked_up:
interactor.hold_object(self)

1
src/interactable.gd.uid Normal file
View File

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

52
src/interactor.gd Normal file
View File

@@ -0,0 +1,52 @@
class_name Interactor extends RayCast3D
@onready var action_label: Label = %ActionLabel
var selected: Interactable:
get: return selected
set(val):
if val == selected: return
if(selected):
selected.highlighted = false
action_label.visible = false
selected = val
if(selected):
selected.highlighted = true
action_label.text = selected.action_label
action_label.visible = true
var held_object: Interactable
func _physics_process(_delta: float) -> void:
if not is_colliding() or held_object:
selected = null
return
var obj = get_collider()
selected = obj if obj is Interactable else null
func _input(event: InputEvent) -> void:
if not event.is_action_pressed('interact'): return
if selected:
selected.interact(self)
return
if held_object:
drop_object()
func hold_object(obj: Interactable):
held_object = obj
obj.process_mode = Node.PROCESS_MODE_DISABLED
obj.reparent(self)
#obj.position = Vector3(0,0,-1.2)
func drop_object():
if not held_object: return
held_object.reparent(get_tree().root)
held_object.process_mode = Node.PROCESS_MODE_INHERIT
held_object = null

1
src/interactor.gd.uid Normal file
View File

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

47
src/loader/SceneLoader.gd Normal file
View File

@@ -0,0 +1,47 @@
extends Node
var loading_screen_scene: = preload('res://ui/loading_screen.tscn')
var loading_screen_instance: LoadingScreen
var _loading: String = ""
var progress: Array[float] = []
func _init() -> void:
process_mode = PROCESS_MODE_ALWAYS
func _ready() -> void:
loading_screen_instance = loading_screen_scene.instantiate()
func load_scene(path: String):
get_tree().paused = true
ResourceLoader.load_threaded_request(path, "", true)
var status := ResourceLoader.load_threaded_get_status(path, progress)
show_loading_screen()
if status != ResourceLoader.THREAD_LOAD_LOADED:
_loading = path
func show_loading_screen():
if not loading_screen_instance.get_parent(): add_child(loading_screen_instance)
func hide_loading_screen():
if not loading_screen_instance: return
await loading_screen_instance.fade_out()
if loading_screen_instance.get_parent(): loading_screen_instance.get_parent().remove_child(loading_screen_instance)
func _process(_delta: float) -> void:
if _loading == "": return
var status := ResourceLoader.load_threaded_get_status(_loading, progress)
if status != ResourceLoader.THREAD_LOAD_LOADED: return
var resource : PackedScene = ResourceLoader.load_threaded_get(_loading)
get_tree().change_scene_to_packed(resource)
hide_loading_screen()
get_tree().paused = false
_loading = ""

View File

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

37
src/npc.gd Normal file
View File

@@ -0,0 +1,37 @@
class_name NPC extends CharacterBody3D
@export var target : Node3D
@export var movement_speed: float = 4.0
@onready var navigation_agent: NavigationAgent3D = $NavigationAgent3D
@onready var label : Label = $Label
func _input(event: InputEvent) -> void:
if event.is_action_pressed('interact'):
set_movement_target(target.position)
func _ready() -> void:
navigation_agent.velocity_computed.connect(Callable(_on_velocity_computed))
func set_movement_target(movement_target: Vector3):
navigation_agent.set_target_position(movement_target)
func _physics_process(_delta):
if navigation_agent.is_navigation_finished():
return
var next_path_position: Vector3 = navigation_agent.get_next_path_position()
var new_velocity: Vector3 = global_position.direction_to(next_path_position) * movement_speed
if navigation_agent.avoidance_enabled:
navigation_agent.velocity = new_velocity
else:
_on_velocity_computed(new_velocity)
func _on_velocity_computed(safe_velocity: Vector3):
label.text = "x:%f y:%f z:%f" % [safe_velocity.x, safe_velocity.y, safe_velocity.z]
safe_velocity.y = 0
var direction := safe_velocity.normalized()
if direction:
velocity = direction * movement_speed
look_at(global_position - direction)
move_and_slide()

1
src/npc.gd.uid Normal file
View File

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

View File

@@ -0,0 +1,3 @@
shader_type spatial;
render_mode unshaded;
render_mode depth_draw_opaque;

View File

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

View File

@@ -0,0 +1,35 @@
shader_type canvas_item;
render_mode blend_add;
#include "res://src/shaders/lib/clr.gdshaderinc"
uniform lowp sampler2D Screen_Sample : hint_screen_texture, filter_linear_mipmap_anisotropic;
uniform lowp sampler2D FlareMult;
uniform lowp sampler2D FlareMult2;
uniform float Blur = 2.5;
uniform float FlareThreshold;
uniform int Flares;
uniform float FlareSpacing;
uniform float Intensity;
uniform float Saturation_;
void fragment(){
vec2 FlippedUV = vec2(1.0) - SCREEN_UV;
vec2 FlareVector = (vec2(0.5) - SCREEN_UV) * FlareSpacing;
vec3 FinalFlare = vec3(0.0);
for (int i = 0; i < Flares; ++i){
vec2 SUV = fract(SCREEN_UV + FlareVector * vec2(float(i)));
float Dist = distance(SUV, vec2(0.5));
float Weight = 1.0 - smoothstep(0.0, 0.75, Dist);
vec3 BlurredScreen = texture(Screen_Sample, SUV, Blur).rgb;
BlurredScreen = ApplyThreshold(BlurredScreen, FlareThreshold);
FinalFlare += BlurredScreen * Weight;
}
FinalFlare *= texture(FlareMult, SCREEN_UV).rgb;
FinalFlare *= texture(FlareMult2, SCREEN_UV).rgb;
COLOR.rgb = FinalFlare * Intensity;
COLOR.rgb = Saturation(COLOR.rgb, Saturation_);
}

View File

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

View File

@@ -0,0 +1,7 @@
vec3 ApplyThreshold(vec3 CLR, float Threshold){
return max(CLR - vec3(Threshold), vec3(0.0));
}
vec3 Saturation(vec3 InputCLR, float Saturation){
return mix(vec3(dot(InputCLR.rgb, vec3(0.299, 0.587, 0.114))), InputCLR.rgb, Saturation);
}

View File

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

View File

@@ -0,0 +1,67 @@
shader_type spatial;
render_mode cull_back;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;
void vertex() {
// Called for every vertex the material is visible on.
}
varying vec2 _screen_pos;
varying vec2 _pixel_size;
varying mat4 _inv_pr_mat;
varying mat4 _pr_mat;
void fragment() {
_screen_pos = SCREEN_UV;
_pixel_size = vec2(1.0,1.0);
_inv_pr_mat = INV_PROJECTION_MATRIX;
_pr_mat = PROJECTION_MATRIX;
}
float get_depth(vec2 uv) {
return textureLod(DEPTH_TEXTURE, uv, 0.0).r;
}
vec3 get_pos(vec2 uv) {
float depth = textureLod(DEPTH_TEXTURE, uv, 0.0).r;
vec4 upos = _inv_pr_mat * vec4(uv * 2.0 - 1.0, depth, 1.0);
return upos.xyz / upos.w;
}
const int MAX_STEPS = 1000;
float RayTrace(vec3 ro, vec3 rd, vec2 vp_size) {
vec2 step_dir = 1.0 * rd.xy / vp_size;
float step_len = length(step_dir);
ro.xy /= vp_size;
ro.z = get_depth(ro.xy);
vec3 od = get_pos(ro.xy);
float d = .0;
for (int i = 0; i < MAX_STEPS; i++) {
vec2 uv = ro.xy + step_dir * d;
vec3 pos = get_pos(uv);
if(normalize(pos - od).z > rd.z) return 0.0;
if(length(pos-od) > 0.05) return 1.0;
d += 1.0;
}
return 1.0;
}
float calculate_light(vec3 normal, vec3 light) {
return max(dot(normal, light),0);
}
float screen_shadows(vec3 normal, vec3 light, vec3 screen_pos, vec2 vp_size) {
// WHY????
light.y *= -1.0;
return RayTrace(screen_pos, light, vp_size);
}
void light() {
//DIFFUSE_LIGHT = vec3(get_pos(FRAGCOORD.xy / VIEWPORT_SIZE).z * -1.0);
DIFFUSE_LIGHT += screen_shadows(NORMAL, LIGHT, FRAGCOORD.xyz, VIEWPORT_SIZE) * calculate_light(NORMAL, LIGHT);
}

View File

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

View File

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

98
src/shaders/vhs.gdshader Normal file
View File

@@ -0,0 +1,98 @@
shader_type canvas_item;
group_uniforms Wiggle;
uniform float wiggle : hint_range(0.0, 1.5, 0.01) = 0.03;
uniform float wiggle_speed : hint_range(0.0, 100.0, 1.0) = 25;
group_uniforms Smear;
uniform float smear : hint_range(0.0, 2.0) = 1.0;
uniform sampler2D Source : hint_screen_texture, filter_linear_mipmap, repeat_disable;
group_uniforms Blur;
uniform int blur_samples : hint_range(3, 15, 1) = 15;
float onOff(float a, float b, float c, float framecount) {
return step(c, sin((framecount * 0.001) + a * cos((framecount * 0.001) * b)));
}
vec2 jumpy(vec2 uv, float framecount) {
vec2 look = uv;
float window = 1.0 / (1.0 + 80.0 * (look.y - mod(framecount / 4.0, 1.0)) * (look.y - mod(framecount / 4.0, 1.0)));
look.x += 0.05 * sin(look.y * 10.0 + framecount) / 20.0 * onOff(4.0, 4.0, 0.3, framecount) * (0.5 + cos(framecount * 20.0)) * window;
float vShift = (0.1 * wiggle) * 0.4 * onOff(2.0, 3.0, 0.9, framecount) * (sin(framecount) * sin(framecount * 20.0) + (0.5 + 0.1 * sin(framecount * 200.0) * cos(framecount)));
look.y = mod(look.y - 0.01 * vShift, 1.0);
return look;
}
vec2 Circle(float Start, float Points, float Point) {
float Rad = (3.141592 * 2.0 * (1.0 / Points)) * (Point + Start);
return vec2(-(.3 + Rad), cos(Rad));
}
vec3 rgb2yiq(vec3 c) {
return vec3(
(0.2989 * c.x + 0.5959 * c.y + 0.2115 * c.z),
(0.5870 * c.x - 0.2744 * c.y - 0.5229 * c.z),
(0.1140 * c.x - 0.3216 * c.y + 0.3114 * c.z)
);
}
vec3 yiq2rgb(vec3 c) {
return vec3(
(1.0 * c.x + 1.0 * c.y + 1.0 * c.z),
(0.956 * c.x - 0.2720 * c.y - 1.1060 * c.z),
(0.6210 * c.x - 0.6474 * c.y + 1.7046 * c.z)
);
}
vec3 Blur(vec2 uv, float d, int samples) {
vec3 sum = vec3(0.0);
float W = 1.0 / float(samples);
for (int i = 0; i < samples; ++i) {
float t = (sin(TIME * 5.0 + uv.y * 5.0)) / 10.0;
t = 0.0;
vec2 PixelOffset = vec2(d + 0.0005 * t, 0);
float Start = 2.0 / float(samples);
vec2 Scale = 0.66 * 4.0 * 2.0 * PixelOffset.xy;
vec3 N = texture(Source, uv + Circle(Start, float(samples), float(i)) * Scale).rgb;
sum += N * W;
}
return sum;
}
void fragment() {
vec2 uv = UV;
float d=0.1-round(mod(TIME/3.0,1.0))*.1;;
uv = jumpy(uv, mod(TIME * wiggle_speed, 7.0));
float s = 0.0001 * -d + 0.0001 * wiggle *(sin(TIME * wiggle_speed));
float e = min(.30,pow(max(0.0,cos(uv.y*4.0+.3)-.75)*(s+0.5)*1.0,3.0))*25.0;
float r = (TIME*(2.0*s));
uv.x += abs(r*pow(min(.003,(-uv.y+(.01*mod(TIME, 5.0))))*3.0,2.0)) * wiggle;
d = 0.051+abs(sin(s/4.0));
float c = max(0.0001,.002*d) * smear;
vec4 final;
final.rgb = Blur(uv, c + c * uv.x, blur_samples);
float y = rgb2yiq(final.rgb).r;
uv.x += 0.01 * d;
c *= 6.0;
final.rgb = Blur(uv, c, blur_samples);
float i = rgb2yiq(final.rgb).g;
uv.x += 0.005 * d;
c *= 2.50;
final.rgb = Blur(uv, c, blur_samples);
float q = rgb2yiq(final.rgb).b;
final.rgb = yiq2rgb(vec3(y, i, q)) - pow(s + e * 2.0, 3.0);
final.a = 1.0;
COLOR = final;
}

View File

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

View File

@@ -9,4 +9,5 @@ func _ready() -> void:
func spawn() -> void:
var object = object_to_spawn.instantiate()
object.position = position
get_parent_node_3d().add_child(object)

1
src/spawner.gd.uid Normal file
View File

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

6
src/world.gd Normal file
View File

@@ -0,0 +1,6 @@
class_name World extends Node3D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
GameManager.world_loaded(self)

1
src/world.gd.uid Normal file
View File

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