Improved html5 performance
This commit is contained in:
parent
1aff15069a
commit
af41271af2
9 changed files with 63 additions and 54 deletions
|
|
@ -277,6 +277,7 @@ func place_insect_tile(resource_path: String, is_black: bool, pos: Vector4i) ->
|
||||||
tile_copy.set_multiplayer_authority(sender_id)
|
tile_copy.set_multiplayer_authority(sender_id)
|
||||||
|
|
||||||
add_child(tile_copy)
|
add_child(tile_copy)
|
||||||
|
tile_copy.reset_physics_interpolation()
|
||||||
|
|
||||||
GameEvents.insect_tile_created.emit(tile_copy, pos)
|
GameEvents.insect_tile_created.emit(tile_copy, pos)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ var map_reference: HexGrid
|
||||||
|
|
||||||
var is_active: bool = true
|
var is_active: bool = true
|
||||||
|
|
||||||
const BUILD_GHOST = preload("res://InsectTiles/BuildGhost.tscn")
|
const BUILD_GHOST: PackedScene = preload("res://InsectTiles/BuildGhost.tscn")
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
if insect_resource == null:
|
if insect_resource == null:
|
||||||
|
|
@ -28,6 +28,14 @@ func _ready():
|
||||||
GameEvents.insect_tile_moved.connect(_on_insect_tile_moved)
|
GameEvents.insect_tile_moved.connect(_on_insect_tile_moved)
|
||||||
else:
|
else:
|
||||||
GameEvents.insect_placed.connect(_on_insect_placed)
|
GameEvents.insect_placed.connect(_on_insect_placed)
|
||||||
|
|
||||||
|
tile = BUILD_GHOST.instantiate()
|
||||||
|
tile.resource = insect_resource
|
||||||
|
tile.is_black = is_black
|
||||||
|
tile.map_reference = map_reference
|
||||||
|
|
||||||
|
add_child(tile)
|
||||||
|
tile.visible = false
|
||||||
|
|
||||||
func _on_insect_tile_moved(tile: InsectTile, to: Vector4i) -> void:
|
func _on_insect_tile_moved(tile: InsectTile, to: Vector4i) -> void:
|
||||||
is_active = false
|
is_active = false
|
||||||
|
|
@ -39,31 +47,23 @@ func _on_insect_placed(resource: TileResource, is_black: bool, pos: Vector4i) ->
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
#func _process(delta):
|
#func _process(delta):
|
||||||
func _input_event(camera, event, position, normal, shape_idx):
|
|
||||||
|
func _on_mouse_entered():
|
||||||
|
hovered = true
|
||||||
|
tile.visible = true
|
||||||
|
|
||||||
|
func _on_input_event(camera, event, position, normal, shape_idx):
|
||||||
if Input.is_action_just_pressed("place_tile") and is_active:
|
if Input.is_action_just_pressed("place_tile") and is_active:
|
||||||
if hovered:
|
if hovered:
|
||||||
if is_moving:
|
if is_moving:
|
||||||
GameEvents.insect_tile_moved.emit(insect_tile, coordinates)
|
GameEvents.insect_tile_moved.emit(insect_tile, coordinates)
|
||||||
else:
|
else:
|
||||||
GameEvents.insect_placed.emit(insect_resource, is_black, coordinates)
|
GameEvents.insect_placed.emit(insect_resource, is_black, coordinates)
|
||||||
|
|
||||||
func _on_mouse_entered():
|
|
||||||
hovered = true
|
|
||||||
|
|
||||||
tile = BUILD_GHOST.instantiate()
|
|
||||||
tile.resource = insect_resource
|
|
||||||
tile.is_black = is_black
|
|
||||||
tile.map_reference = map_reference
|
|
||||||
|
|
||||||
add_child(tile)
|
|
||||||
|
|
||||||
func _on_input_event(camera, event, position, normal, shape_idx):
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
func _on_mouse_exited():
|
func _on_mouse_exited():
|
||||||
hovered = false
|
hovered = false
|
||||||
|
tile.visible = false
|
||||||
if tile:
|
#if tile:
|
||||||
tile.queue_free()
|
#tile.queue_free()
|
||||||
tile = null
|
#tile = null
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
extends Area3D
|
extends Node3D
|
||||||
|
|
||||||
@export var coordinates: Vector4i
|
@export var coordinates: Vector4i
|
||||||
@export var is_black: bool = false
|
@export var is_black: bool = false
|
||||||
|
|
@ -10,13 +10,13 @@ var map_reference: HexGrid
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if is_black:
|
if is_black:
|
||||||
hexagon_small.set_surface_override_material(0, resource.material_black.duplicate())
|
hexagon_small.get_surface_override_material(0).albedo_texture = resource.material_black.albedo_texture
|
||||||
else:
|
else:
|
||||||
hexagon_small.set_surface_override_material(0, resource.material_white.duplicate())
|
hexagon_small.get_surface_override_material(0).albedo_texture = resource.material_white.albedo_texture
|
||||||
|
|
||||||
if is_black:
|
if is_black:
|
||||||
hexagon_small.rotation.y = PI
|
hexagon_small.rotation.y = PI
|
||||||
|
|
||||||
var mat: StandardMaterial3D = hexagon_small.get_surface_override_material(0)
|
#var mat: StandardMaterial3D = hexagon_small.get_surface_override_material(0)
|
||||||
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
|
#mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
|
||||||
mat.albedo_color.a = 0.5
|
#mat.albedo_color.a = 0.5
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,11 +1,6 @@
|
||||||
extends MeshInstance3D
|
extends MeshInstance3D
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
scale.y = 1.0+sin(Time.get_ticks_msec() * 0.002)*0.1
|
scale.y = 1.0+sin(Time.get_ticks_msec() * 0.002)*0.1
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,10 @@ export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="../SwarmWeb/index.html"
|
export_path="../SwarmWeb/index.html"
|
||||||
|
patches=PackedStringArray()
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
|
seed=0
|
||||||
encrypt_pck=false
|
encrypt_pck=false
|
||||||
encrypt_directory=false
|
encrypt_directory=false
|
||||||
script_export_mode=2
|
script_export_mode=2
|
||||||
|
|
@ -52,8 +54,10 @@ export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="../SwarmWindows/Swarm.exe"
|
export_path="../SwarmWindows/Swarm.exe"
|
||||||
|
patches=PackedStringArray()
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
|
seed=0
|
||||||
encrypt_pck=false
|
encrypt_pck=false
|
||||||
encrypt_directory=false
|
encrypt_directory=false
|
||||||
script_export_mode=2
|
script_export_mode=2
|
||||||
|
|
@ -121,8 +125,10 @@ export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="../SwarmLinux/Swarm.x86_64"
|
export_path="../SwarmLinux/Swarm.x86_64"
|
||||||
|
patches=PackedStringArray()
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
|
seed=0
|
||||||
encrypt_pck=false
|
encrypt_pck=false
|
||||||
encrypt_directory=false
|
encrypt_directory=false
|
||||||
script_export_mode=2
|
script_export_mode=2
|
||||||
|
|
|
||||||
BIN
hex_outline.res
BIN
hex_outline.res
Binary file not shown.
|
|
@ -1,8 +1,9 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://y2t5rrkvs0c0"]
|
[gd_scene load_steps=8 format=3 uid="uid://y2t5rrkvs0c0"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://rbug8ibnb87v" path="res://HexOutline.gd" id="1_cbscl"]
|
[ext_resource type="Script" uid="uid://rbug8ibnb87v" path="res://HexOutline.gd" id="1_cbscl"]
|
||||||
[ext_resource type="ArrayMesh" uid="uid://cocujjycabbp3" path="res://hex_outline.res" id="2_hwabu"]
|
[ext_resource type="ArrayMesh" uid="uid://cocujjycabbp3" path="res://hex_outline.res" id="2_hwabu"]
|
||||||
[ext_resource type="Script" uid="uid://btn30al6m0cfa" path="res://MeshBreather.gd" id="3_6b28p"]
|
[ext_resource type="Script" uid="uid://btn30al6m0cfa" path="res://MeshBreather.gd" id="3_6b28p"]
|
||||||
|
[ext_resource type="Material" uid="uid://bxwitvdpsoro6" path="res://hex_outline_material.tres" id="3_lvy2v"]
|
||||||
[ext_resource type="ArrayMesh" uid="uid://2hoclmeiswwf" path="res://hex_outline_bottom.res" id="4_lr4wm"]
|
[ext_resource type="ArrayMesh" uid="uid://2hoclmeiswwf" path="res://hex_outline_bottom.res" id="4_lr4wm"]
|
||||||
|
|
||||||
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_uta8s"]
|
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_uta8s"]
|
||||||
|
|
@ -13,6 +14,7 @@ transparency = 1
|
||||||
albedo_color = Color(0.133333, 0.592157, 0, 0.607843)
|
albedo_color = Color(0.133333, 0.592157, 0, 0.607843)
|
||||||
|
|
||||||
[node name="HexOutline" type="Area3D"]
|
[node name="HexOutline" type="Area3D"]
|
||||||
|
collision_mask = 0
|
||||||
monitoring = false
|
monitoring = false
|
||||||
script = ExtResource("1_cbscl")
|
script = ExtResource("1_cbscl")
|
||||||
|
|
||||||
|
|
@ -21,12 +23,13 @@ shape = SubResource("ConcavePolygonShape3D_uta8s")
|
||||||
|
|
||||||
[node name="Mesh" type="MeshInstance3D" parent="."]
|
[node name="Mesh" type="MeshInstance3D" parent="."]
|
||||||
mesh = ExtResource("2_hwabu")
|
mesh = ExtResource("2_hwabu")
|
||||||
skeleton = NodePath("../../..")
|
skeleton = NodePath("")
|
||||||
|
surface_material_override/0 = ExtResource("3_lvy2v")
|
||||||
script = ExtResource("3_6b28p")
|
script = ExtResource("3_6b28p")
|
||||||
|
|
||||||
[node name="HexOutlineBottom" type="MeshInstance3D" parent="Mesh"]
|
[node name="HexOutlineBottom" type="MeshInstance3D" parent="Mesh"]
|
||||||
mesh = ExtResource("4_lr4wm")
|
mesh = ExtResource("4_lr4wm")
|
||||||
skeleton = NodePath("../../../..")
|
skeleton = NodePath("")
|
||||||
surface_material_override/0 = SubResource("StandardMaterial3D_tu70t")
|
surface_material_override/0 = SubResource("StandardMaterial3D_tu70t")
|
||||||
|
|
||||||
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ run/main_scene="res://UI/main_menu.tscn"
|
||||||
config/features=PackedStringArray("4.4", "Mobile")
|
config/features=PackedStringArray("4.4", "Mobile")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[audio]
|
||||||
|
|
||||||
|
driver/driver="Dummy"
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
GameEvents="*res://Globals/GameEvents.gd"
|
GameEvents="*res://Globals/GameEvents.gd"
|
||||||
|
|
@ -85,6 +89,14 @@ toggle_controls={
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[physics]
|
||||||
|
|
||||||
|
common/physics_ticks_per_second=30
|
||||||
|
common/physics_jitter_fix=0.0
|
||||||
|
3d/physics_engine="Jolt Physics"
|
||||||
|
jolt_physics_3d/simulation/areas_detect_static_bodies=true
|
||||||
|
common/physics_interpolation=true
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
textures/vram_compression/import_etc2_astc=true
|
textures/vram_compression/import_etc2_astc=true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue