Preliminary multiplayer capability (origin stuff disabled for now)
This commit is contained in:
parent
73baafbd6c
commit
f0c4263675
18 changed files with 704 additions and 99 deletions
106
demo/aircraft/fixed_wing_aircraft.tscn
Normal file
106
demo/aircraft/fixed_wing_aircraft.tscn
Normal file
|
@ -0,0 +1,106 @@
|
|||
[gd_scene load_steps=14 format=3 uid="uid://dcnk85lpgfq3t"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bddnsq0h2tpf" path="res://scripts/aircraft/nodes/fixed_wing_aircraft.gd" id="1_grgqm"]
|
||||
[ext_resource type="Resource" uid="uid://dpk3bgq54ajul" path="res://demo/airfoils/symmetric.tres" id="2_og0eu"]
|
||||
[ext_resource type="Resource" uid="uid://p2i7a806s6gs" path="res://demo/propulsion/electric_motor.tres" id="3_v3vjn"]
|
||||
[ext_resource type="Script" uid="uid://qjdma7j2qrns" path="res://scripts/aircraft/resources/fixed_wing_aircraft_performance.gd" id="4_8tl6d"]
|
||||
[ext_resource type="Script" uid="uid://pc3j1c6e1ra7" path="res://scripts/aircraft/nodes/flight_sim_controller.gd" id="5_g0q8o"]
|
||||
[ext_resource type="Script" uid="uid://ddh4omp23xc58" path="res://scripts/origin/region_transform.gd" id="6_f0486"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_s1s6j"]
|
||||
_limits = [0.0, 0.5, 0.0, 20.0]
|
||||
_data = [Vector2(0, 0.5), 0.0, 0.0, 0, 0, Vector2(20, 0), -0.082397, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Curve" id="Curve_onvmd"]
|
||||
_limits = [0.0, 2.0, 0.0, 30.0]
|
||||
_data = [Vector2(0, 2), 0.0, 0.0, 0, 0, Vector2(30, 0), -0.199316, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Curve" id="Curve_oeqrt"]
|
||||
_limits = [0.0, 0.202247, 0.0, 10.0]
|
||||
_data = [Vector2(0, 0.202247), 0.0, 0.0, 0, 0, Vector2(10, 0), -0.0393259, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Resource" id="Resource_onu7k"]
|
||||
script = ExtResource("4_8tl6d")
|
||||
horizontal_surface = ExtResource("2_og0eu")
|
||||
horizontal_area = 21.8
|
||||
horizontal_aspect_ratio = 5.83
|
||||
vertical_surface = ExtResource("2_og0eu")
|
||||
vertical_area = 5.0
|
||||
vertical_aspect_ratio = 5.0
|
||||
propultion = ExtResource("3_v3vjn")
|
||||
base_thrust = 100000.0
|
||||
empty_mass = 3463.0
|
||||
roll_axis = Vector3(0, 0.1, -1)
|
||||
pitch_power = SubResource("Curve_s1s6j")
|
||||
yaw_power = SubResource("Curve_oeqrt")
|
||||
roll_power = SubResource("Curve_onvmd")
|
||||
metadata/_custom_type_script = "uid://qjdma7j2qrns"
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_u10mr"]
|
||||
radius = 8.0
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_2wqbq"]
|
||||
properties/0/path = NodePath("FlightSimController:pitch")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 2
|
||||
properties/1/path = NodePath("FlightSimController:yaw")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 2
|
||||
properties/2/path = NodePath("FlightSimController:roll")
|
||||
properties/2/spawn = true
|
||||
properties/2/replication_mode = 2
|
||||
properties/3/path = NodePath("FlightSimController:throttle")
|
||||
properties/3/spawn = true
|
||||
properties/3/replication_mode = 2
|
||||
properties/4/path = NodePath("FlightSimController:brake")
|
||||
properties/4/spawn = true
|
||||
properties/4/replication_mode = 2
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_grgqm"]
|
||||
properties/0/path = NodePath(".:position")
|
||||
properties/0/spawn = true
|
||||
properties/0/replication_mode = 2
|
||||
properties/1/path = NodePath(".:rotation")
|
||||
properties/1/spawn = true
|
||||
properties/1/replication_mode = 2
|
||||
properties/2/path = NodePath(".:initial_speed")
|
||||
properties/2/spawn = true
|
||||
properties/2/replication_mode = 0
|
||||
properties/3/path = NodePath(".:multiplayer_authority")
|
||||
properties/3/spawn = true
|
||||
properties/3/replication_mode = 2
|
||||
properties/4/path = NodePath(".:velocity")
|
||||
properties/4/spawn = true
|
||||
properties/4/replication_mode = 1
|
||||
|
||||
[node name="FixedWingAircraft" type="CharacterBody3D" node_paths=PackedStringArray("controller")]
|
||||
script = ExtResource("1_grgqm")
|
||||
performance = SubResource("Resource_onu7k")
|
||||
controller = NodePath("FlightSimController")
|
||||
initial_speed = 100.0
|
||||
metadata/_custom_type_script = "uid://bddnsq0h2tpf"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("SphereShape3D_u10mr")
|
||||
|
||||
[node name="FlightSimController" type="Node" parent="."]
|
||||
script = ExtResource("5_g0q8o")
|
||||
pitch_speed = 4.0
|
||||
yaw_speed = 4.0
|
||||
roll_speed = 3.0
|
||||
throttle = 0.5
|
||||
metadata/_custom_type_script = "uid://pc3j1c6e1ra7"
|
||||
|
||||
[node name="RegionTransform" type="Node" parent="." node_paths=PackedStringArray("target")]
|
||||
script = ExtResource("6_f0486")
|
||||
target = NodePath("..")
|
||||
metadata/_custom_type_script = "uid://ddh4omp23xc58"
|
||||
|
||||
[node name="InputSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_2wqbq")
|
||||
|
||||
[node name="ServerSynchronizer" type="MultiplayerSynchronizer" parent="."]
|
||||
replication_config = SubResource("SceneReplicationConfig_grgqm")
|
71
demo/demo.gd
71
demo/demo.gd
|
@ -1,4 +1,73 @@
|
|||
extends Node3D
|
||||
|
||||
# Script stolen/modified from https://godotengine.org/article/multiplayer-in-godot-4-0-scene-replication
|
||||
|
||||
func _ready() -> void:
|
||||
RegionOrigin.anchor = $FixedWingAircraft/RegionTransform
|
||||
# We only need to spawn players on the server.
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
|
||||
multiplayer.peer_connected.connect(add_player)
|
||||
multiplayer.peer_disconnected.connect(del_player)
|
||||
|
||||
# Spawn already connected players.
|
||||
for id in multiplayer.get_peers():
|
||||
add_player(id)
|
||||
#set_up_remote_character(node: Node)
|
||||
|
||||
# Spawn the local player unless this is a dedicated server export.
|
||||
if not OS.has_feature("dedicated_server"):
|
||||
add_player(1)
|
||||
#set_up_local_character(1)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
multiplayer.peer_connected.disconnect(add_player)
|
||||
multiplayer.peer_disconnected.disconnect(del_player)
|
||||
|
||||
|
||||
func add_player(id: int) -> void:
|
||||
var character := preload("res://demo/aircraft/fixed_wing_aircraft.tscn").instantiate() as FixedWingAircraft
|
||||
# Set player id.
|
||||
character.multiplayer_authority = id
|
||||
#character.set_multiplayer_authority(id)
|
||||
# Randomize character position.
|
||||
#var pos := Vector2.from_angle(randf() * 2 * PI)
|
||||
character.position = Vector3(randf() * 10.0 - 5.0, 100.0, randf() * 10.0 - 5.0)
|
||||
character.name = str(id)
|
||||
$Players.add_child(character, true)
|
||||
if id == multiplayer.get_unique_id():
|
||||
set_up_local_character(id)
|
||||
else:
|
||||
set_up_remote_character(character)
|
||||
|
||||
|
||||
func del_player(id: int) -> void:
|
||||
if not $Players.has_node(str(id)):
|
||||
return
|
||||
$Players.get_node(str(id)).queue_free()
|
||||
|
||||
func set_up_local_character(id: int) -> void:
|
||||
if not $Players.has_node(str(id)):
|
||||
return
|
||||
var local_player := $Players.get_node(str(id)) as FixedWingAircraft
|
||||
# Tie the camera to it
|
||||
var remote := RemoteTransform3D.new()
|
||||
local_player.add_child(remote)
|
||||
remote.remote_path = remote.get_path_to($Camera3D)
|
||||
# Set up the HUD
|
||||
($CanvasLayer/HUD as HUD).source = local_player
|
||||
|
||||
func set_up_remote_character(node: Node3D) -> void:
|
||||
# Add the roc model
|
||||
var roc := preload("res://demo/models/roc.dae").instantiate() as Node3D
|
||||
roc.rotate(Vector3.UP, PI)
|
||||
node.add_child(roc)
|
||||
|
||||
func _on_multiplayer_spawner_spawned(node: Node) -> void:
|
||||
if node.name == str(multiplayer.get_unique_id()):
|
||||
set_up_local_character(multiplayer.get_unique_id())
|
||||
elif node is FixedWingAircraft:
|
||||
set_up_remote_character(node as Node3D)
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
[gd_scene load_steps=20 format=3 uid="uid://d20jwlre5rc5m"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://d20jwlre5rc5m"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cdk7y1rat3juk" path="res://demo/demo.gd" id="1_oeqrt"]
|
||||
[ext_resource type="Texture2D" uid="uid://bruwqvb6qrsfn" path="res://demo/textures/untexture.png" id="1_ytiva"]
|
||||
[ext_resource type="Script" uid="uid://bddnsq0h2tpf" path="res://scripts/aircraft/nodes/fixed_wing_aircraft.gd" id="2_dar0o"]
|
||||
[ext_resource type="Resource" uid="uid://dpk3bgq54ajul" path="res://demo/airfoils/symmetric.tres" id="3_u10mr"]
|
||||
[ext_resource type="Script" uid="uid://qjdma7j2qrns" path="res://scripts/aircraft/resources/fixed_wing_aircraft_performance.gd" id="4_onu7k"]
|
||||
[ext_resource type="Resource" uid="uid://p2i7a806s6gs" path="res://demo/propulsion/electric_motor.tres" id="4_s1s6j"]
|
||||
[ext_resource type="Script" uid="uid://pc3j1c6e1ra7" path="res://scripts/aircraft/nodes/flight_sim_controller.gd" id="5_s1s6j"]
|
||||
[ext_resource type="Script" uid="uid://tgj0rvn5wj8t" path="res://demo/hud.gd" id="6_onu7k"]
|
||||
[ext_resource type="Script" uid="uid://ddh4omp23xc58" path="res://scripts/origin/region_transform.gd" id="7_onvmd"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_j5lb4"]
|
||||
albedo_texture = ExtResource("1_ytiva")
|
||||
|
@ -16,52 +10,7 @@ uv1_scale = Vector3(100, 100, 100)
|
|||
|
||||
[sub_resource type="PlaneMesh" id="PlaneMesh_5hjng"]
|
||||
material = SubResource("StandardMaterial3D_j5lb4")
|
||||
size = Vector2(1000, 1000)
|
||||
center_offset = Vector3(500, 0, 500)
|
||||
|
||||
[sub_resource type="Curve" id="Curve_s1s6j"]
|
||||
_limits = [0.0, 0.5, 0.0, 20.0]
|
||||
_data = [Vector2(0, 0.5), 0.0, 0.0, 0, 0, Vector2(20, 0), -0.082397, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Curve" id="Curve_onvmd"]
|
||||
_limits = [0.0, 2.0, 0.0, 30.0]
|
||||
_data = [Vector2(0, 2), 0.0, 0.0, 0, 0, Vector2(30, 0), -0.199316, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Curve" id="Curve_oeqrt"]
|
||||
_limits = [0.0, 0.202247, 0.0, 10.0]
|
||||
_data = [Vector2(0, 0.202247), 0.0, 0.0, 0, 0, Vector2(10, 0), -0.0393259, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="Resource" id="Resource_onu7k"]
|
||||
script = ExtResource("4_onu7k")
|
||||
horizontal_surface = ExtResource("3_u10mr")
|
||||
horizontal_area = 21.8
|
||||
horizontal_aspect_ratio = 5.83
|
||||
horizontal_sweep = 0.0
|
||||
vertical_surface = ExtResource("3_u10mr")
|
||||
vertical_area = 5.0
|
||||
vertical_aspect_ratio = 5.0
|
||||
vertical_sweep = 0.0
|
||||
propultion = ExtResource("4_s1s6j")
|
||||
base_thrust = 100000.0
|
||||
base_drag = 0.0
|
||||
empty_mass = 3463.0
|
||||
yaw_axis = Vector3(0, -1, 0)
|
||||
roll_axis = Vector3(0, 0.1, -1)
|
||||
pitch_stability = 0.0
|
||||
yaw_stability = 0.0
|
||||
roll_stability = 0.0
|
||||
reference_ias_mps = 100.0
|
||||
braking_power = 0.0
|
||||
pitch_power = SubResource("Curve_s1s6j")
|
||||
yaw_power = SubResource("Curve_oeqrt")
|
||||
roll_power = SubResource("Curve_onvmd")
|
||||
metadata/_custom_type_script = "uid://qjdma7j2qrns"
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_u10mr"]
|
||||
radius = 8.0
|
||||
size = Vector2(2000, 2000)
|
||||
|
||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_onu7k"]
|
||||
|
||||
|
@ -80,34 +29,9 @@ script = ExtResource("1_oeqrt")
|
|||
[node name="Ground" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("PlaneMesh_5hjng")
|
||||
|
||||
[node name="FixedWingAircraft" type="CharacterBody3D" parent="." node_paths=PackedStringArray("controller")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 10, 0)
|
||||
script = ExtResource("2_dar0o")
|
||||
performance = SubResource("Resource_onu7k")
|
||||
controller = NodePath("FlightSimController")
|
||||
initial_speed = 100.0
|
||||
metadata/_custom_type_script = "uid://bddnsq0h2tpf"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="FixedWingAircraft"]
|
||||
shape = SubResource("SphereShape3D_u10mr")
|
||||
|
||||
[node name="FlightSimController" type="Node" parent="FixedWingAircraft"]
|
||||
script = ExtResource("5_s1s6j")
|
||||
pitch_speed = 4.0
|
||||
yaw_speed = 4.0
|
||||
roll_speed = 3.0
|
||||
metadata/_custom_type_script = "uid://pc3j1c6e1ra7"
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="FixedWingAircraft"]
|
||||
|
||||
[node name="RegionTransform" type="Node" parent="FixedWingAircraft" node_paths=PackedStringArray("target")]
|
||||
script = ExtResource("7_onvmd")
|
||||
target = NodePath("..")
|
||||
metadata/_custom_type_script = "uid://ddh4omp23xc58"
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="HUD" type="Control" parent="CanvasLayer" node_paths=PackedStringArray("source")]
|
||||
[node name="HUD" type="Control" parent="CanvasLayer"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -115,7 +39,6 @@ anchor_bottom = 1.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("6_onu7k")
|
||||
source = NodePath("../../FixedWingAircraft")
|
||||
|
||||
[node name="TAS_Label" type="Label" parent="CanvasLayer/HUD"]
|
||||
layout_mode = 0
|
||||
|
@ -145,3 +68,13 @@ environment = SubResource("Environment_onvmd")
|
|||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(-4.37114e-08, -0.984808, 0.173648, 0, 0.173648, 0.984808, -1, 4.30473e-08, -7.5904e-09, 0, 0, 0)
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("uid://dcnk85lpgfq3t")
|
||||
spawn_path = NodePath("../Players")
|
||||
|
||||
[node name="Players" type="Node3D" parent="."]
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
|
||||
[connection signal="spawned" from="MultiplayerSpawner" to="." method="_on_multiplayer_spawner_spawned"]
|
||||
|
|
|
@ -9,7 +9,8 @@ extends Control
|
|||
@onready var relative_velocity_label := $RelativeVelocityLabel as Label
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
tas_label.text = "TAS: %s" % source.m_tas
|
||||
aoa_label.text = "AOA: %s" % rad_to_deg(source.m_aoa)
|
||||
sideslip_label.text = "Sideslip: %s" % rad_to_deg(source.m_sideslip)
|
||||
relative_velocity_label.text = "V: %s" % source.m_relative_velocity
|
||||
if (source):
|
||||
tas_label.text = "TAS: %s" % source.m_tas
|
||||
aoa_label.text = "AOA: %s" % rad_to_deg(source.m_aoa)
|
||||
sideslip_label.text = "Sideslip: %s" % rad_to_deg(source.m_sideslip)
|
||||
relative_velocity_label.text = "V: %s" % source.m_relative_velocity
|
||||
|
|
117
demo/menu.gd
Normal file
117
demo/menu.gd
Normal file
|
@ -0,0 +1,117 @@
|
|||
extends Node
|
||||
|
||||
const PORT := 28002
|
||||
const MAX_CLIENTS := 2
|
||||
|
||||
@export
|
||||
var multiplayer_scene: PackedScene
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
PlayerData.player1_index = 1
|
||||
($Main/PlayButton as Button).grab_focus.call_deferred()
|
||||
|
||||
|
||||
func _on_play_button_pressed() -> void:
|
||||
multiplayer.multiplayer_peer = OfflineMultiplayerPeer.new()
|
||||
get_tree().change_scene_to_file("res://demo/demo.tscn")
|
||||
|
||||
|
||||
func _on_host_button_pressed() -> void:
|
||||
($Main as Control).hide()
|
||||
($Host as Control).show()
|
||||
var peer := ENetMultiplayerPeer.new()
|
||||
multiplayer.peer_connected.connect(_on_host_joined)
|
||||
multiplayer.peer_disconnected.connect(_on_host_left)
|
||||
peer.create_server(PORT, MAX_CLIENTS)
|
||||
multiplayer.multiplayer_peer = peer
|
||||
|
||||
|
||||
func _on_join_button_pressed() -> void:
|
||||
($Main as Control).hide()
|
||||
($Join as Control).show()
|
||||
|
||||
|
||||
func _on_exit_button_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_back_from_host_button_pressed() -> void:
|
||||
($Host as Control).hide()
|
||||
($Main as Control).show()
|
||||
PlayerData.player2_index = 0
|
||||
multiplayer.peer_connected.disconnect(_on_host_joined)
|
||||
multiplayer.peer_disconnected.disconnect(_on_host_left)
|
||||
_on_host_left(0)
|
||||
multiplayer.multiplayer_peer = OfflineMultiplayerPeer.new()
|
||||
|
||||
|
||||
func _on_back_from_join_button_pressed() -> void:
|
||||
($Join as Control).hide()
|
||||
($Main as Control).show()
|
||||
($Join/PlayerJoinedLabel as Label).text = ""
|
||||
PlayerData.player2_index = 0
|
||||
multiplayer.connected_to_server.disconnect(_on_client_joined)
|
||||
multiplayer.server_disconnected.disconnect(_on_client_left)
|
||||
multiplayer.connection_failed.disconnect(_on_client_failed_to_connect)
|
||||
multiplayer.multiplayer_peer = OfflineMultiplayerPeer.new()
|
||||
|
||||
|
||||
func _on_join_room_button_pressed() -> void:
|
||||
var peer := ENetMultiplayerPeer.new()
|
||||
var address := ($Join/AddressBar as LineEdit).text
|
||||
if (address == ""):
|
||||
address = "127.0.0.1"
|
||||
multiplayer.connected_to_server.connect(_on_client_joined)
|
||||
multiplayer.server_disconnected.connect(_on_client_left)
|
||||
multiplayer.connection_failed.connect(_on_client_failed_to_connect)
|
||||
peer.create_client(address, PORT)
|
||||
multiplayer.multiplayer_peer = peer
|
||||
|
||||
|
||||
func _on_host_joined(id: int) -> void:
|
||||
PlayerData.player2_index = id
|
||||
($Host/PlayerHostedLabel as Label).text = "Player has joined."
|
||||
($Host/PlayMultiplayerButton as Button).disabled = false
|
||||
|
||||
|
||||
func _on_host_left(_id: int) -> void:
|
||||
($Host/PlayerHostedLabel as Label).text = "Waiting for player to join..."
|
||||
($Host/PlayMultiplayerButton as Button).disabled = true
|
||||
|
||||
|
||||
func _on_client_joined() -> void:
|
||||
PlayerData.player2_index = multiplayer.get_unique_id()
|
||||
($Join/PlayerJoinedLabel as Label).text = "Player has joined."
|
||||
|
||||
|
||||
func _on_client_left() -> void:
|
||||
($Join/PlayerJoinedLabel as Label).text = "Server has closed."
|
||||
|
||||
|
||||
func _on_client_failed_to_connect() -> void:
|
||||
($Join/PlayerJoinedLabel as Label).text = "Connection failed."
|
||||
|
||||
|
||||
func _on_play_multiplayer_button_pressed() -> void:
|
||||
if multiplayer.is_server():
|
||||
_hide_menu.rpc()
|
||||
_play_multiplayer.call_deferred()
|
||||
|
||||
|
||||
func _play_multiplayer() -> void:
|
||||
var level := $Level
|
||||
for c in level.get_children():
|
||||
level.remove_child(c)
|
||||
c.queue_free()
|
||||
var mp := multiplayer_scene.instantiate()
|
||||
level.add_child(mp)
|
||||
|
||||
|
||||
@rpc("authority", "call_local", "reliable")
|
||||
func _hide_menu() -> void:
|
||||
($Join as Control).hide()
|
||||
($Main as Control).hide()
|
||||
($Host as Control).hide()
|
||||
($Background as Control).hide()
|
||||
($Title as Control).hide()
|
1
demo/menu.gd.uid
Normal file
1
demo/menu.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://cmt5cqjlcnpls
|
204
demo/menu.tscn
Normal file
204
demo/menu.tscn
Normal file
|
@ -0,0 +1,204 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b4luon6xvu53c"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cmt5cqjlcnpls" path="res://demo/menu.gd" id="1_ux1fr"]
|
||||
[ext_resource type="PackedScene" uid="uid://d20jwlre5rc5m" path="res://demo/demo.tscn" id="2_ouk20"]
|
||||
|
||||
[node name="Menu" type="Node"]
|
||||
script = ExtResource("1_ux1fr")
|
||||
multiplayer_scene = ExtResource("2_ouk20")
|
||||
|
||||
[node name="Level" type="Node" parent="."]
|
||||
|
||||
[node name="Background" type="ColorRect" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Title" type="Label" parent="."]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 64.0
|
||||
offset_bottom = -662.0
|
||||
grow_horizontal = 2
|
||||
theme_override_font_sizes/font_size = 30
|
||||
text = "SparkyGD"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Main" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PlayButton" type="Button" parent="Main"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 104.0
|
||||
offset_bottom = -512.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_neighbor_bottom = NodePath("../ExitButton")
|
||||
focus_next = NodePath("../ExitButton")
|
||||
text = "Play"
|
||||
|
||||
[node name="HostButton" type="Button" parent="Main"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 140.0
|
||||
offset_bottom = -477.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Host"
|
||||
|
||||
[node name="JoinButton" type="Button" parent="Main"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 1.0
|
||||
offset_top = 177.0
|
||||
offset_right = 1.0
|
||||
offset_bottom = -440.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Join"
|
||||
|
||||
[node name="ExitButton" type="Button" parent="Main"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 214.0
|
||||
offset_bottom = -403.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_neighbor_top = NodePath("../PlayButton")
|
||||
focus_previous = NodePath("../PlayButton")
|
||||
text = "Exit"
|
||||
|
||||
[node name="Host" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="PlayMultiplayerButton" type="Button" parent="Host"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 106.0
|
||||
offset_bottom = -630.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_neighbor_bottom = NodePath("../BackFromHostButton")
|
||||
focus_next = NodePath("../BackFromHostButton")
|
||||
disabled = true
|
||||
text = "Play"
|
||||
|
||||
[node name="BackFromHostButton" type="Button" parent="Host"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 138.0
|
||||
offset_bottom = -598.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_neighbor_top = NodePath("../PlayMultiplayerButton")
|
||||
focus_previous = NodePath("../PlayMultiplayerButton")
|
||||
text = "Back"
|
||||
|
||||
[node name="PlayerHostedLabel" type="Label" parent="Host"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 170.0
|
||||
offset_bottom = -566.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Waiting for player to join..."
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Join" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="AddressBar" type="LineEdit" parent="Join"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 106.0
|
||||
offset_bottom = -630.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
placeholder_text = "IP Address or Domain"
|
||||
alignment = 1
|
||||
|
||||
[node name="JoinRoomButton" type="Button" parent="Join"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 138.0
|
||||
offset_bottom = -598.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Join"
|
||||
|
||||
[node name="BackFromJoinButton" type="Button" parent="Join"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 170.0
|
||||
offset_bottom = -566.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
focus_neighbor_top = NodePath("../PlayButton")
|
||||
focus_previous = NodePath("../PlayButton")
|
||||
text = "Back"
|
||||
|
||||
[node name="PlayerJoinedLabel" type="Label" parent="Join"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 201.0
|
||||
offset_bottom = -535.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("uid://d20jwlre5rc5m")
|
||||
spawn_path = NodePath("../Level")
|
||||
|
||||
[connection signal="pressed" from="Main/PlayButton" to="." method="_on_play_button_pressed"]
|
||||
[connection signal="pressed" from="Main/HostButton" to="." method="_on_host_button_pressed"]
|
||||
[connection signal="pressed" from="Main/JoinButton" to="." method="_on_join_button_pressed"]
|
||||
[connection signal="pressed" from="Main/ExitButton" to="." method="_on_exit_button_pressed"]
|
||||
[connection signal="pressed" from="Host/PlayMultiplayerButton" to="." method="_on_play_multiplayer_button_pressed"]
|
||||
[connection signal="pressed" from="Host/BackFromHostButton" to="." method="_on_back_from_host_button_pressed"]
|
||||
[connection signal="pressed" from="Join/JoinRoomButton" to="." method="_on_join_room_button_pressed"]
|
||||
[connection signal="pressed" from="Join/BackFromJoinButton" to="." method="_on_back_from_join_button_pressed"]
|
26
demo/models/roc.dae
Normal file
26
demo/models/roc.dae
Normal file
File diff suppressed because one or more lines are too long
40
demo/models/roc.dae.import
Normal file
40
demo/models/roc.dae.import
Normal file
|
@ -0,0 +1,40 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://b02d3mh841kjo"
|
||||
path="res://.godot/imported/roc.dae-81d2b3a307e83b949f66b9a9007aae9e.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://demo/models/roc.dae"
|
||||
dest_files=["res://.godot/imported/roc.dae-81d2b3a307e83b949f66b9a9007aae9e.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type=""
|
||||
nodes/root_name=""
|
||||
nodes/root_script=null
|
||||
nodes/apply_root_scale=true
|
||||
nodes/root_scale=100.0
|
||||
nodes/import_as_skeleton_bones=false
|
||||
nodes/use_name_suffixes=true
|
||||
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=""
|
||||
materials/extract=0
|
||||
materials/extract_format=0
|
||||
materials/extract_path=""
|
||||
_subresources={}
|
BIN
demo/models/roc.png
Normal file
BIN
demo/models/roc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
41
demo/models/roc.png.import
Normal file
41
demo/models/roc.png.import
Normal file
|
@ -0,0 +1,41 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d0acg4tridswa"
|
||||
path.s3tc="res://.godot/imported/roc.png-9b877bc5e169ea6dd0f8e0216594f55a.s3tc.ctex"
|
||||
metadata={
|
||||
"imported_formats": ["s3tc_bptc"],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://demo/models/roc.png"
|
||||
dest_files=["res://.godot/imported/roc.png-9b877bc5e169ea6dd0f8e0216594f55a.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
|
6
demo/player_data.gd
Normal file
6
demo/player_data.gd
Normal file
|
@ -0,0 +1,6 @@
|
|||
extends Node
|
||||
|
||||
@export
|
||||
var player1_index := 1
|
||||
@export
|
||||
var player2_index := 0
|
1
demo/player_data.gd.uid
Normal file
1
demo/player_data.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://cuwoplv86o82q
|
Loading…
Add table
Add a link
Reference in a new issue