Compare commits

..

3 Commits

Author SHA1 Message Date
Spencer Killen 539db63c44
Optimize platforms 2022-12-30 13:00:07 -07:00
Spencer Killen 2a65df8279
Add subtle bobbling to platforms 2022-12-30 12:49:08 -07:00
Spencer Killen 06542eed2c
Add debug tools for FPS 2022-12-30 11:56:41 -07:00
13 changed files with 217 additions and 18 deletions

9
godot/DebugTools.tscn Normal file
View File

@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://FPSLabel.gd" type="Script" id=1]
[node name="DebugTools" type="Spatial"]
[node name="CanvasLayer" type="CanvasLayer" parent="."]
layer = 128
script = ExtResource( 1 )

45
godot/FPSLabel.gd Normal file
View File

@ -0,0 +1,45 @@
# MIT License
# Copyright (c) 2019 Lupo Dharkael
class_name FpsLabel
extends CanvasLayer
enum Position {TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, NONE}
export (Position) var position = Position.TOP_LEFT
export(int) var margin : int = 5
var label : Label
func _ready() -> void:
label = Label.new()
add_child(label)
var _ignore = get_tree().get_root().connect("size_changed", self, "update_position")
update_position()
# pos should be of type Position
func set_position(pos : int):
position = pos
update_position()
func update_position():
var viewport_size : Vector2 = get_viewport().size
var label_size : Vector2 = label.rect_size
match position:
Position.TOP_LEFT:
offset = Vector2(margin, margin)
Position.BOTTOM_LEFT:
offset = Vector2(margin, viewport_size.y - margin - label_size.y)
Position.TOP_RIGHT:
offset = Vector2(viewport_size.x - margin - label_size.x, margin)
Position.BOTTOM_RIGHT:
offset = Vector2(viewport_size.x - margin - label_size.x, viewport_size.y - margin - label_size.y)
func _process(_delta : float) -> void:
label.text = "fps: " + str(Engine.get_frames_per_second()) + " " + str(Performance.get_monitor(Performance.TIME_FPS))

View File

@ -5,7 +5,7 @@ content_margin_left = 10.0
content_margin_right = 10.0 content_margin_right = 10.0
content_margin_top = 10.0 content_margin_top = 10.0
content_margin_bottom = 10.0 content_margin_bottom = 10.0
bg_color = Color( 0.03, 0.21, 0.26, 1 ) bg_color = Color( 0.2, 0.23, 0.31, 1 )
border_width_left = 1 border_width_left = 1
border_width_top = 1 border_width_top = 1
border_width_right = 1 border_width_right = 1

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://assets/meat_creek/creek_platform_arraymesh.tres" type="ArrayMesh" id=1]
[sub_resource type="CylinderShape" id=1]
[node name="meat_creek_platform" type="MeshInstance"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.000406906, 0 )
mesh = ExtResource( 1 )
[node name="StaticBody" type="StaticBody" parent="."]
[node name="CollisionShape" type="CollisionShape" parent="StaticBody"]
transform = Transform( 1.63708, 0, 0, 0, 1.02249, 0, 0, 0, 1.55754, 0, 0, 0 )
shape = SubResource( 1 )

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,79 @@
[gd_resource type="ShaderMaterial" load_steps=5 format=2]
[ext_resource path="res://assets/meat_creek/meat_platform_texture.tres" type="Texture" id=1]
[sub_resource type="Shader" id=1]
code = "// NOTE: Shader automatically converted from Godot Engine 3.5.1.stable.mono's SpatialMaterial.
shader_type spatial;
render_mode world_vertex_coords,async_visible,blend_mix,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
uniform float point_size : hint_range(0,128);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
uniform sampler2D bubble_curve;
uniform float bubble_speed : hint_range(0.0, 20.0, 0.1);
uniform float seed;
float random( vec2 p )
{
// e^pi (Gelfond's constant)
// 2^sqrt(2) (GelfondSchneider constant)
vec2 K1 = vec2( 23.14069263277926, 2.665144142690225 );
//return fract( cos( mod( 12345678., 256. * dot(p,K1) ) ) ); // ver1
//return fract(cos(dot(p,K1)) * 123456.); // ver2
return fract(cos(dot(p,K1)) * 12345.6789); // ver3
}
void vertex() {
UV=UV*uv1_scale.xy+uv1_offset.xy;
float x = mod(TIME+seed, bubble_speed) / bubble_speed;
float w = texture(bubble_curve, vec2(x, 0.0)).r;
VERTEX.y -= w;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
albedo_tex *= COLOR;
ALBEDO = albedo.rgb * albedo_tex.rgb;
METALLIC = metallic;
ROUGHNESS = roughness;
SPECULAR = specular;
}
"
[sub_resource type="Curve" id=2]
max_value = 0.3
_data = [ Vector2( 0, 0 ), 0.0, 0.0, 0, 0, Vector2( 0.505236, 0.0821591 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="CurveTexture" id=3]
curve = SubResource( 2 )
[resource]
resource_name = "creek_platform_material"
shader = SubResource( 1 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/specular = 0.5
shader_param/metallic = 0.0
shader_param/roughness = 0.0
shader_param/point_size = 1.0
shader_param/uv1_scale = Vector3( 1, 1, 1 )
shader_param/uv1_offset = Vector3( 0, 0, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 )
shader_param/bubble_speed = 3.0
shader_param/seed = null
shader_param/texture_albedo = ExtResource( 1 )
shader_param/bubble_curve = SubResource( 3 )

View File

@ -59,6 +59,11 @@ _global_script_classes=[ {
"language": "GDScript", "language": "GDScript",
"path": "res://addons/dialogic/Other/DialogicUtil.gd" "path": "res://addons/dialogic/Other/DialogicUtil.gd"
}, { }, {
"base": "CanvasLayer",
"class": "FpsLabel",
"language": "GDScript",
"path": "res://FPSLabel.gd"
}, {
"base": "PanelContainer", "base": "PanelContainer",
"class": "HistoryRow", "class": "HistoryRow",
"language": "GDScript", "language": "GDScript",
@ -75,6 +80,7 @@ _global_script_class_icons={
"DialogicParser": "", "DialogicParser": "",
"DialogicResources": "", "DialogicResources": "",
"DialogicUtil": "", "DialogicUtil": "",
"FpsLabel": "",
"HistoryRow": "" "HistoryRow": ""
} }
@ -88,6 +94,7 @@ config/icon="res://meat_madness_icon.png"
Util="*res://util.gd" Util="*res://util.gd"
GlobalEventBus="*res://global_event_bus.gd" GlobalEventBus="*res://global_event_bus.gd"
SavedDialogueProgress="*res://saved_dialogue_progress.gd" SavedDialogueProgress="*res://saved_dialogue_progress.gd"
DebugTools="*res://DebugTools.tscn"
[display] [display]