feat: implement water shader and environment for free mode arena

This commit is contained in:
Yogi Wiguna
2026-03-31 15:59:00 +08:00
parent 3454710f2c
commit 1e6da89fff
16 changed files with 337 additions and 116 deletions
+90 -90
View File
@@ -6,7 +6,7 @@
[ext_resource type="Texture2D" uid="uid://b3yv677a4qidp" path="res://assets/graphics/vfx/effects/30sec_sprite.png" id="2_jmlpd"]
[ext_resource type="Texture2D" uid="uid://lykg7d54qrof" path="res://assets/graphics/vfx/effects/ghost.png" id="3_hg3tj"]
[ext_resource type="Texture2D" uid="uid://45twcoribm0b" path="res://assets/graphics/vfx/effects/speed.png" id="4_8bjou"]
[ext_resource type="Texture2D" uid="uid://bcyyxropbam50" path="res://assets/graphics/vfx/spawn_tiles_bottom.png" id="4_xd54h"]
[ext_resource type="Texture2D" uid="uid://d2lxk788w2cdw" path="res://assets/graphics/vfx/spawn_floor.png" id="4_iiy2r"]
[ext_resource type="Texture2D" uid="uid://c718e7y7qm03x" path="res://assets/graphics/vfx/effects/bullrun_ui.png" id="5_gsxsy"]
[ext_resource type="Texture2D" uid="uid://dun5j8mrxpumo" path="res://assets/graphics/vfx/effects/stunned.png" id="5_jmlpd"]
[ext_resource type="Texture2D" uid="uid://cjhatl26dafxx" path="res://assets/graphics/vfx/spawn_tiles_top.png" id="5_xd54h"]
@@ -527,148 +527,148 @@ atlas = ExtResource("1_gjs0m")
region = Rect2(2751, 0, 393, 408)
[sub_resource type="AtlasTexture" id="AtlasTexture_pfjl8"]
atlas = ExtResource("4_xd54h")
atlas = ExtResource("4_iiy2r")
region = Rect2(0, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_6xsib"]
atlas = ExtResource("4_xd54h")
atlas = ExtResource("4_iiy2r")
region = Rect2(500, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_vbb07"]
atlas = ExtResource("4_xd54h")
atlas = ExtResource("4_iiy2r")
region = Rect2(1000, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_l8xtn"]
atlas = ExtResource("4_xd54h")
atlas = ExtResource("4_iiy2r")
region = Rect2(1500, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_r8bp5"]
atlas = ExtResource("4_xd54h")
atlas = ExtResource("4_iiy2r")
region = Rect2(2000, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_mlbks"]
atlas = ExtResource("4_xd54h")
atlas = ExtResource("4_iiy2r")
region = Rect2(2500, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_dwn2k"]
atlas = ExtResource("4_xd54h")
region = Rect2(3000, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_86ba4"]
atlas = ExtResource("4_xd54h")
region = Rect2(3500, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_rfe3p"]
atlas = ExtResource("4_xd54h")
region = Rect2(4000, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_fgkky"]
atlas = ExtResource("4_xd54h")
region = Rect2(4500, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_yk5ks"]
atlas = ExtResource("4_xd54h")
region = Rect2(5000, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_tt1sy"]
atlas = ExtResource("4_xd54h")
region = Rect2(5500, 0, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_ihxs7"]
atlas = ExtResource("4_xd54h")
atlas = ExtResource("4_iiy2r")
region = Rect2(0, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_u6diu"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_86ba4"]
atlas = ExtResource("4_iiy2r")
region = Rect2(500, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_xvgj3"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_rfe3p"]
atlas = ExtResource("4_iiy2r")
region = Rect2(1000, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_nn6v3"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_fgkky"]
atlas = ExtResource("4_iiy2r")
region = Rect2(1500, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_1qja4"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_yk5ks"]
atlas = ExtResource("4_iiy2r")
region = Rect2(2000, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_s1ih8"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_tt1sy"]
atlas = ExtResource("4_iiy2r")
region = Rect2(2500, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_1lb4f"]
atlas = ExtResource("4_xd54h")
region = Rect2(3000, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_1evi6"]
atlas = ExtResource("4_xd54h")
region = Rect2(3500, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_etlyi"]
atlas = ExtResource("4_xd54h")
region = Rect2(4000, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_c3uep"]
atlas = ExtResource("4_xd54h")
region = Rect2(4500, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_hchqc"]
atlas = ExtResource("4_xd54h")
region = Rect2(5000, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_k6s2b"]
atlas = ExtResource("4_xd54h")
region = Rect2(5500, 500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_wwuof"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_ihxs7"]
atlas = ExtResource("4_iiy2r")
region = Rect2(0, 1000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_vqenf"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_u6diu"]
atlas = ExtResource("4_iiy2r")
region = Rect2(500, 1000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_hehw1"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_xvgj3"]
atlas = ExtResource("4_iiy2r")
region = Rect2(1000, 1000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_wmjgt"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_nn6v3"]
atlas = ExtResource("4_iiy2r")
region = Rect2(1500, 1000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_euieq"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_1qja4"]
atlas = ExtResource("4_iiy2r")
region = Rect2(2000, 1000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_r7q5m"]
atlas = ExtResource("4_xd54h")
[sub_resource type="AtlasTexture" id="AtlasTexture_s1ih8"]
atlas = ExtResource("4_iiy2r")
region = Rect2(2500, 1000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_1lb4f"]
atlas = ExtResource("4_iiy2r")
region = Rect2(0, 1500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_1evi6"]
atlas = ExtResource("4_iiy2r")
region = Rect2(500, 1500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_etlyi"]
atlas = ExtResource("4_iiy2r")
region = Rect2(1000, 1500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_c3uep"]
atlas = ExtResource("4_iiy2r")
region = Rect2(1500, 1500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_hchqc"]
atlas = ExtResource("4_iiy2r")
region = Rect2(2000, 1500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_k6s2b"]
atlas = ExtResource("4_iiy2r")
region = Rect2(2500, 1500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_wwuof"]
atlas = ExtResource("4_iiy2r")
region = Rect2(0, 2000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_vqenf"]
atlas = ExtResource("4_iiy2r")
region = Rect2(500, 2000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_hehw1"]
atlas = ExtResource("4_iiy2r")
region = Rect2(1000, 2000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_wmjgt"]
atlas = ExtResource("4_iiy2r")
region = Rect2(1500, 2000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_euieq"]
atlas = ExtResource("4_iiy2r")
region = Rect2(2000, 2000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_r7q5m"]
atlas = ExtResource("4_iiy2r")
region = Rect2(2500, 2000, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_4dgeb"]
atlas = ExtResource("4_xd54h")
region = Rect2(3000, 1000, 500, 500)
atlas = ExtResource("4_iiy2r")
region = Rect2(0, 2500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_u3dcn"]
atlas = ExtResource("4_xd54h")
region = Rect2(3500, 1000, 500, 500)
atlas = ExtResource("4_iiy2r")
region = Rect2(500, 2500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_che85"]
atlas = ExtResource("4_xd54h")
region = Rect2(4000, 1000, 500, 500)
atlas = ExtResource("4_iiy2r")
region = Rect2(1000, 2500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_gijbg"]
atlas = ExtResource("4_xd54h")
region = Rect2(4500, 1000, 500, 500)
atlas = ExtResource("4_iiy2r")
region = Rect2(1500, 2500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_bh7f8"]
atlas = ExtResource("4_xd54h")
region = Rect2(5000, 1000, 500, 500)
atlas = ExtResource("4_iiy2r")
region = Rect2(2000, 2500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_faulb"]
atlas = ExtResource("4_xd54h")
region = Rect2(5500, 1000, 500, 500)
atlas = ExtResource("4_iiy2r")
region = Rect2(2500, 2500, 500, 500)
[sub_resource type="AtlasTexture" id="AtlasTexture_un3dc"]
atlas = ExtResource("5_xd54h")
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

@@ -2,8 +2,8 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bcyyxropbam50"
path.s3tc="res://.godot/imported/spawn_tiles_bottom.png-bf5af9b1f572105fde872edff38e8188.s3tc.ctex"
uid="uid://d2lxk788w2cdw"
path.s3tc="res://.godot/imported/spawn_floor.png-932d516dabe821d5ec59606ca0d25279.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
source_file="res://assets/graphics/vfx/spawn_tiles_bottom.png"
dest_files=["res://.godot/imported/spawn_tiles_bottom.png-bf5af9b1f572105fde872edff38e8188.s3tc.ctex"]
source_file="res://assets/graphics/vfx/spawn_floor.png"
dest_files=["res://.godot/imported/spawn_floor.png-932d516dabe821d5ec59606ca0d25279.s3tc.ctex"]
[params]
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

@@ -0,0 +1,83 @@
shader_type spatial;
render_mode cull_disabled;
uniform vec3 albedo : source_color;
uniform vec3 albedo2 : source_color;
uniform float metallic : hint_range(0.0, 1.0) = 0;
uniform float roughness : hint_range(0.0, 1.0) = 0.02;
uniform sampler2D wave;
uniform sampler2D texture_normal;
uniform sampler2D texture_normal2;
uniform vec2 wave_direction = vec2(2.0,0.0); // Direction of wave 1
uniform vec2 wave_direction2 = vec2(0.0,1.0); // Direction of wave 2
uniform float time_scale : hint_range(0.0, 0.2, 0.005) = 0.025; // Rate of movement multiplied by TIME
uniform float noise_scale = 10.0;
uniform float height_scale = 0.15;
uniform vec4 color_deep : source_color; // Deep depth color
uniform vec4 color_shallow : source_color; // Shallow depth color
uniform float beers_law = 2.0; // Beer's law application
uniform float depth_offset = -0.75; // Offset
uniform float edge_scale = 0.1;
uniform float near = 1.0;
uniform float far = 100.0;
uniform vec3 edge_color : source_color;
uniform sampler2D DEPTH_TEXTURE : hint_depth_texture, filter_linear_mipmap;
uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;
// Varying variables
varying float height;
varying vec3 world_pos;
float fresnel(float amount, vec3 normal, vec3 view)
{
return pow((1.0 - clamp(dot(normalize(normal), normalize(view)), 0.0, 1.0 )), amount);
}
float edge(float depth){
depth = 2.0 * depth - 1.0;
return near * far / (far + depth * (near - far));
}
void vertex() {
world_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
height = texture(wave, world_pos.xz / noise_scale + TIME * time_scale).r;
VERTEX.y += height * height_scale;
}
void fragment() {
// Depth variables and calc
float depth_texture = texture(DEPTH_TEXTURE, SCREEN_UV).r * 2.0 - 1.0;
float depth = PROJECTION_MATRIX[3][2] / (depth_texture + PROJECTION_MATRIX[2][2]);
float depth_blend = exp((depth+VERTEX.z + depth_offset) * -beers_law);
depth_blend = clamp(1.0 - depth_blend, 0.0, 1.0);
float depth_blend_power = clamp(pow(depth_blend, 2.5), 0.0, 1.0);
// Retrieving depth color and applying the deep and shallow colors
vec3 screen_color = textureLod(SCREEN_TEXTURE, SCREEN_UV, depth_blend_power * 2.5).rgb;
vec3 depth_color = mix(color_shallow.rgb, color_deep.rgb, depth_blend_power);
vec3 color = mix(screen_color * depth_color, depth_color * 0.25, depth_blend_power * 0.5);
// Getting edge depth calc
float z_depth = edge(texture(DEPTH_TEXTURE, SCREEN_UV).x);
float z_pos = edge(FRAGCOORD.z);
float z_dif = z_depth - z_pos;
// Time calculations for wave (normal map) movement
vec2 time = (TIME * wave_direction) * time_scale; // Movement rate of first wave
vec2 time2 = (TIME * wave_direction2) * time_scale; // Movement rate of second wave
// Blend normal maps into one
vec3 normal_blend = mix(texture(texture_normal,world_pos.xz + time).rgb, texture(texture_normal2,world_pos.xz + time2).rgb, 0.5);
// Calculate Fresnel
float fresnel = fresnel(5.0, NORMAL, VIEW);
vec3 surface_color = mix(albedo, albedo2, fresnel); // Interpolate albedo values by frensel
vec3 depth_color_adj = mix(edge_color, color, step(edge_scale, z_dif));
ALBEDO = clamp(surface_color + depth_color_adj,vec3(0.0),vec3(1.0));
METALLIC = metallic;
ROUGHNESS = roughness;
NORMAL_MAP = normal_blend;
}
@@ -0,0 +1 @@
uid://chabrdico7377
@@ -0,0 +1,6 @@
[gd_resource type="PanoramaSkyMaterial" format=3 uid="uid://bdwxlbar41mxw"]
[ext_resource type="Texture2D" uid="uid://didk5l287jms7" path="res://assets/levels/level_water/sky_sea_01.png" id="1_f0k4a"]
[resource]
panorama = ExtResource("1_f0k4a")
@@ -0,0 +1,13 @@
[gd_resource type="Environment" format=3 uid="uid://d07fd5dsr0xv"]
[ext_resource type="Material" uid="uid://bdwxlbar41mxw" path="res://assets/levels/level_water/level_water.tres" id="1_gsk4i"]
[sub_resource type="Sky" id="Sky_u7obs"]
sky_material = ExtResource("1_gsk4i")
[resource]
background_mode = 2
sky = SubResource("Sky_u7obs")
ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)
reflected_light_source = 2
Binary file not shown.

After

Width:  |  Height:  |  Size: 542 KiB

@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dep1ng3aqb2jw"
path.s3tc="res://.godot/imported/sky_sea_01.png-02f4e2484e4bcee94a60ae25a0ef8549.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/models/arena/free_mode/sky_sea_01.png"
dest_files=["res://.godot/imported/sky_sea_01.png-02f4e2484e4bcee94a60ae25a0ef8549.s3tc.ctex"]
[params]
compress/mode=2
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=true
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=0
@@ -0,0 +1,38 @@
[gd_resource type="ShaderMaterial" format=3 uid="uid://xifgjdr8285d"]
[ext_resource type="Shader" uid="uid://chabrdico7377" path="res://assets/models/arena/free_mode/level_water.gdshader" id="1_nuaxy"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_s0tpp"]
noise_type = 0
seed = 5
frequency = 0.0166
metadata/_preview_in_3d_space_ = true
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_6vard"]
noise = SubResource("FastNoiseLite_s0tpp")
seamless = true
as_normal_map = true
seamless_blend_skirt = 1.0
bump_strength = 25.6
[resource]
render_priority = 0
shader = ExtResource("1_nuaxy")
shader_parameter/albedo = Color(0.14, 0.382667, 0.7, 1)
shader_parameter/albedo2 = Color(0.54, 0.77, 1, 1)
shader_parameter/metallic = 0.0
shader_parameter/roughness = 0.02
shader_parameter/texture_normal = SubResource("NoiseTexture2D_6vard")
shader_parameter/wave_direction = Vector2(2, 0)
shader_parameter/wave_direction2 = Vector2(0, 1)
shader_parameter/time_scale = 0.025
shader_parameter/noise_scale = 10.0
shader_parameter/height_scale = 0.15
shader_parameter/color_deep = Color(0.513233, 0.513233, 0.513233, 1)
shader_parameter/color_shallow = Color(0.716296, 0.716296, 0.716296, 1)
shader_parameter/beers_law = 2.0
shader_parameter/depth_offset = -0.75
shader_parameter/edge_scale = 0.1
shader_parameter/near = 1.0
shader_parameter/far = 100.0
shader_parameter/edge_color = Color(0.215902, 0.215902, 0.215902, 1)
+33
View File
@@ -1,8 +1,41 @@
[gd_scene format=3 uid="uid://nwpaqt6drdkr"]
[ext_resource type="PackedScene" uid="uid://b1l0x4yf3lbx8" path="res://assets/models/arena/free_mode/Terrainv2.gltf" id="1_37t6b"]
[ext_resource type="Material" uid="uid://xifgjdr8285d" path="res://assets/models/arena/free_mode/water_shader.tres" id="2_bw67x"]
[ext_resource type="Texture2D" uid="uid://dep1ng3aqb2jw" path="res://assets/models/arena/free_mode/sky_sea_01.png" id="3_8esiu"]
[sub_resource type="PlaneMesh" id="PlaneMesh_8esiu"]
material = ExtResource("2_bw67x")
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_xj13a"]
panorama = ExtResource("3_8esiu")
[sub_resource type="Sky" id="Sky_p4wg4"]
sky_material = SubResource("PanoramaSkyMaterial_xj13a")
[sub_resource type="Environment" id="Environment_8v6kw"]
background_mode = 2
sky = SubResource("Sky_p4wg4")
ambient_light_source = 3
ambient_light_color = Color(1, 1, 1, 1)
ambient_light_sky_contribution = 0.5
reflected_light_source = 2
[node name="Freemode" type="Node3D" unique_id=355029811]
transform = Transform3D(100, 0, 0, 0, 100, 0, 0, 0, 100, 10.565, -0.57, 8.139)
[node name="Terrainv2" parent="." unique_id=1519605696 instance=ExtResource("1_37t6b")]
[node name="Water" type="MeshInstance3D" parent="." unique_id=289309951]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.14561673, 0)
mesh = SubResource("PlaneMesh_8esiu")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=831804132]
transform = Transform3D(0.23387258, -0.9458177, 0.2252387, -0.400554, 0.11736052, 0.90872604, -0.88592327, -0.30274636, -0.35140368, 0.1, 0.1, 0.13)
light_color = Color(0.98039216, 0.83137256, 0.70980394, 1)
shadow_enabled = true
shadow_bias = 0.2
shadow_normal_bias = 5.0
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=936572897]
environment = SubResource("Environment_8v6kw")
+21 -16
View File
@@ -123,19 +123,11 @@ func _apply_arena_background():
"Stop N Go Arena":
texture_path = "res://assets/graphics/level_bg/placeholder_stop_n_go.jpg"
_instantiate_3d_arena("res://scenes/arena/stop_n_go.scn")
# Make normal, non-walkable, and Tekton floors invisible
# by shrinking their scale to 0. This hides them visually while
# avoiding "Parameter 'mesh' is null" or material override errors.
var em = $EnhancedGridMap
if em and em.mesh_library:
var ml = em.mesh_library.duplicate()
for id in [0, 4, 6]:
# Scale to 0 to hide it without triggering invalid mesh errors
ml.set_item_mesh_transform(id, Transform3D().scaled(Vector3.ZERO))
em.mesh_library = ml
print("[Main] Hide tiles 0, 4, 6 via zero-scale transform.")
_hide_ground_tiles()
"Freemode Arena":
texture_path = "res://assets/graphics/level_bg/placeholder_classic.jpg" # Fallback texture
_instantiate_3d_arena("res://scenes/arena/freemode.tscn")
_hide_ground_tiles()
"Tekton Doors Arena":
texture_path = "res://assets/graphics/level_bg/placeholder_tekton_doors.jpg"
"Classic", _:
@@ -159,6 +151,20 @@ func _instantiate_3d_arena(scene_path: String):
move_child(arena_instance, 0)
print("Instantiated 3D Arena: ", scene_path)
func _hide_ground_tiles():
# Make normal, non-walkable, and Tekton floors invisible
# by shrinking their scale to 0. This hides them visually while
# avoiding "Parameter 'mesh' is null" or material override errors.
var em = $EnhancedGridMap
if em and em.mesh_library:
var ml = em.mesh_library.duplicate()
for id in [0, 4, 6]:
# Scale to 0 to hide it without triggering invalid mesh errors
ml.set_item_mesh_transform(id, Transform3D().scaled(Vector3.ZERO))
em.mesh_library = ml
print("[Main] Hide tiles 0, 4, 6 via zero-scale transform.")
@rpc("any_peer", "call_local", "reliable")
func sync_portal_configs(configs: Array):
if portal_mode_manager:
@@ -849,11 +855,10 @@ func _assign_random_spawn_positions():
var pos = Vector2i(x, z)
# SAFETY CHECK: Is this reserved for a Static Tekton Stand?
# Stand clears 3x3, we use a strictly >= 1 check (so abs <= 1 is EXACTLY the 3x3 stand)
# Let's use a 3x3 check (1 radius) to avoid strictly the stand itself, plus 1 buffer = radius 2.
# Stand clears exactly 3x3 area
var is_safe = true
for reserved in reserved_static_positions:
if abs(x - reserved.x) <= 2 and abs(z - reserved.y) <= 2:
if abs(x - reserved.x) <= 1 and abs(z - reserved.y) <= 1:
is_safe = false
break
+3 -4
View File
@@ -1345,18 +1345,17 @@ func is_position_occupied(pos: Vector2i) -> bool:
if p.is_player_moving and p.target_position == pos:
return true
# Prevent overlap with Static Tekton Stands (3x3 area, with 1-tile buffer = 5x5 checked)
# Prevent overlap with Static Tekton Stands (Exactly the 3x3 area)
if enhanced_gridmap:
for stand in get_tree().get_nodes_in_group("StaticTektonStands"):
var local_pos = enhanced_gridmap.to_local(stand.global_position)
var stand_map_pos = enhanced_gridmap.local_to_map(local_pos)
if abs(pos.x - stand_map_pos.x) <= 2 and abs(pos.y - stand_map_pos.z) <= 2:
if abs(pos.x - stand_map_pos.x) <= 1 and abs(pos.y - stand_map_pos.z) <= 1:
return true
var main_node = get_tree().get_root().get_node_or_null("Main")
if main_node and "reserved_static_positions" in main_node:
for reserved in main_node.reserved_static_positions:
if abs(pos.x - reserved.x) <= 2 and abs(pos.y - reserved.y) <= 2:
if abs(pos.x - reserved.x) <= 1 and abs(pos.y - reserved.y) <= 1:
return true
return false
+2
View File
@@ -167,6 +167,8 @@ transform = Transform3D(1.2, 0, 0, 0, -5.2453668e-08, -1.2, 0, 1.2, -5.2453668e-
visible = false
sprite_frames = ExtResource("10_y4r1p")
animation = &"floor_spawn_bot"
frame = 35
frame_progress = 1.0
[node name="receiver_skill_stunned" type="AnimatedSprite3D" parent="." unique_id=56953581]
transform = Transform3D(0.5, 0, 0, 0, -2.1855694e-08, -0.5, 0, 0.5, -2.1855694e-08, 0, 1.5653763, 0)
+2 -2
View File
@@ -78,7 +78,7 @@ var rematch_votes: Array = [] # [player_id, ...]
var available_characters: Array[String] = ["Copper", "Dabro", "Gatot", "Pip", "Random"]
var available_areas: Array[String] = []
var available_game_modes: Array[String] = ["Freemode", "Stop n Go"]
var selected_area: String = "Classic" # Host-controlled
var selected_area: String = "Freemode Arena" # Host-controlled
var game_mode: String = "Freemode" # Host-controlled
var local_character_index: int = 0 # Local player's character index
@@ -129,7 +129,7 @@ func _listen_for_lan_discovery():
func _update_available_areas(mode: String) -> void:
match mode:
"Freemode":
available_areas = ["Classic", "Colloseum"]
available_areas = ["Freemode Arena", "Classic", "Colloseum"]
"Stop n Go":
available_areas = ["Stop N Go Arena"]
_: