OverviewFilesCommitsIssuesDocsReleasesPeers

godot-marble_madness_demo commits / 50dccaf

kermudgeon
50dccaf4a141406dd856d4305c342781d5d8a40f
by Dresk Spidflisk <dreskspidflisk@gmail.com> · 2022-02-03T22:30:33.000Z

Changed files (5) +58 -30

levels/level_script.gd +15 -7
……@@ -12,6 +12,8 @@ onready var lGossipURL : Control = hyperdebugui.find_node("GossipURL_Value")
1212
1313onready var player_local : RigidBody = $Players/PlayerLocal
1414
15onready var gossip_event_timer : Timer = $HyperGodot/GossipEventTimer
16
1517const knownPlayers = {}
1618
1719const EVENT_PLAYER_POSITION = 'player_position'
……@@ -61,11 +63,12 @@ func _on_HyperGateway_started_gateway(_pid : int):
6163 updateGatewayStatus(_pid)
6264 _perform_setup()
6365
64func _on_PlayerLocalNetworkTimer_timeout():
65 _broadcast_player()
66
6766func _on_HyperGateway_stopped_gateway():
6867 updateGatewayStatus(0)
68
69func _on_GossipEventTimer_timeout():
70 if gateway.getIsGatewayRunning():
71 _broadcast_player()
6972
7073func get_player_object(id):
7174 if knownPlayers.has(id): return knownPlayers[id]
……@@ -114,10 +117,10 @@ func _on_remote_player_moved(positionData, id):
114117 # print('Moving player', id, " ", positionData)
115118 var remotePlayer = get_player_object(id)
116119
117 var translation = positionData.translation
118 var rotation = positionData.rotation
119 var velocity_linear = positionData.velocity_linear
120 var velocity_angular = positionData.velocity_angular
120 var translation : Vector3 = Vector3(positionData.translation.x, positionData.translation.y, positionData.translation.z)
121 var rotation : Vector3 = Vector3(positionData.rotation.x, positionData.rotation.y, positionData.rotation.z)
122 var velocity_linear : Vector3 = Vector3(positionData.velocity_linear.x, positionData.velocity_linear.y, positionData.velocity_linear.z)
123 var velocity_angular : Vector3 = Vector3(positionData.velocity_angular.x, positionData.velocity_angular.y, positionData.velocity_angular.z)
121124
122125 remotePlayer.update_position(
123126 translation,
……@@ -128,3 +131,8 @@ func _on_remote_player_moved(positionData, id):
128131
129132func _on_PlayerLocal_moved():
130133 _broadcast_player()
134
135
136func _on_HyperGodotDebugUI_position_update_rate_changed(seconds : float):
137 gossip_event_timer.wait_time = seconds
138 gossip_event_timer.start(seconds)
levels/scenes/level_0.tscn +4 -5
……@@ -30,9 +30,6 @@ pause_mode = 2
3030script = ExtResource( 8 )
3131player_ball = NodePath("../PlayerLocal")
3232
33[node name="PlayerLocalNetworkTimer" type="Timer" parent="Players"]
34autostart = true
35
3633[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
3734environment = ExtResource( 9 )
3835
……@@ -68,11 +65,13 @@ autoStart = false
6865[node name="HyperGossip" type="Node" parent="HyperGodot"]
6966script = ExtResource( 11 )
7067
68[node name="GossipEventTimer" type="Timer" parent="HyperGodot"]
69autostart = true
70
7171[connection signal="moved" from="Players/PlayerLocal" to="." method="_on_PlayerLocal_moved"]
72[connection signal="timeout" from="Players/PlayerLocalNetworkTimer" to="." method="_on_PlayerLocalNetworkTimer_timeout"]
7372[connection signal="reset_ball" from="special_input" to="Players/PlayerLocal" method="_on_special_input_reset_ball"]
74[connection signal="toggle_hypergateway_startstop" from="HyperGodotDebugUI" to="HyperGodot/HyperGateway" method="_on_HyperGodotDebugUI_toggle_hypergateway_startstop"]
7573[connection signal="started_gateway" from="HyperGodot/HyperGateway" to="." method="_on_HyperGateway_started_gateway"]
7674[connection signal="stopped_gateway" from="HyperGodot/HyperGateway" to="." method="_on_HyperGateway_stopped_gateway"]
7775[connection signal="event" from="HyperGodot/HyperGossip" to="." method="_on_HyperGossip_event"]
7876[connection signal="listening" from="HyperGodot/HyperGossip" to="." method="_on_HyperGossip_listening"]
77[connection signal="timeout" from="HyperGodot/GossipEventTimer" to="." method="_on_GossipEventTimer_timeout"]
player/ball/player_ball_remote.gd +1 -1
……@@ -1,6 +1,6 @@
11extends "res://player/ball/player_ball.gd"
22
3func update_position(new_translation, new_rotation, new_velocity_linear, new_velocity_angular):
3func update_position(new_translation : Vector3, new_rotation : Vector3, new_velocity_linear : Vector3, new_velocity_angular : Vector3):
44 self.translation = new_translation
55 self.rotation = new_rotation
66 self.linear_velocity = new_velocity_linear
ui/debug/hypercore/ui_debug_hypercore.gd +9 -8
……@@ -1,20 +1,17 @@
11extends Control
22
3signal toggle_hypergateway_startstop(start)
3signal gossip_update_rate_changed(seconds)
4
5onready var lGossipUpdateRate = $HypercoreDebugPanel/HypercoreDebugContainer/GossipUpdateRate
46
57var hypergateway : HyperGateway
68
79
810func _ready():
9 # Find Potential HyperGateway Node
10 hypergateway = get_tree().root.find_node("HyperGateway")
11 if(hypergateway):
12 hypergateway.start()
11 pass
1312
1413func _process(_delta):
15 hypergateway = get_tree().root.find_node("HyperGateway")
16 if(hypergateway):
17 hypergateway.start()
14 pass
1815
1916
2017func _on_GatewayStartStopButton_button_up():
……@@ -26,3 +23,7 @@ func _on_GatewayStartStopButton_button_up():
2623 hypergateway.stop()
2724 else:
2825 hypergateway.start()
26
27func _on_GossipUpdateRate_Value_value_changed(value : float):
28 lGossipUpdateRate.text = "Gossip in " + String(value) + " Seconds: "
29 emit_signal("gossip_update_rate_changed", value)
ui/debug/hypercore/ui_debug_hypercore.tscn +29 -9
……@@ -34,7 +34,7 @@ __meta__ = {
3434}
3535
3636[node name="GatewayStartStopButton" type="Button" parent="HypercoreDebugPanel/HypercoreDebugContainer"]
37margin_right = 105.0
37margin_right = 160.0
3838margin_bottom = 20.0
3939text = "Start Gateway"
4040__meta__ = {
……@@ -42,9 +42,9 @@ __meta__ = {
4242}
4343
4444[node name="Label" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"]
45margin_left = 109.0
45margin_left = 164.0
4646margin_top = 3.0
47margin_right = 187.0
47margin_right = 364.0
4848margin_bottom = 17.0
4949__meta__ = {
5050"_edit_use_anchors_": false
……@@ -52,7 +52,7 @@ __meta__ = {
5252
5353[node name="GatewayStatus" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"]
5454margin_top = 24.0
55margin_right = 105.0
55margin_right = 160.0
5656margin_bottom = 38.0
5757text = "Gateway Status :"
5858align = 2
……@@ -61,9 +61,9 @@ __meta__ = {
6161}
6262
6363[node name="GatewayStatus_Value" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"]
64margin_left = 109.0
64margin_left = 164.0
6565margin_top = 24.0
66margin_right = 187.0
66margin_right = 364.0
6767margin_bottom = 38.0
6868text = "Not Running"
6969__meta__ = {
……@@ -72,7 +72,7 @@ __meta__ = {
7272
7373[node name="GossipURL" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"]
7474margin_top = 42.0
75margin_right = 105.0
75margin_right = 160.0
7676margin_bottom = 56.0
7777text = "Gossip URL :"
7878align = 2
……@@ -81,10 +81,30 @@ __meta__ = {
8181}
8282
8383[node name="GossipURL_Value" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"]
84margin_left = 109.0
84margin_left = 164.0
8585margin_top = 42.0
86margin_right = 187.0
86margin_right = 364.0
8787margin_bottom = 56.0
8888text = "N/A"
8989
90[node name="GossipUpdateRate" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"]
91margin_top = 61.0
92margin_right = 160.0
93margin_bottom = 75.0
94rect_min_size = Vector2( 160, 0 )
95text = "Gossip in 1 Seconds :"
96align = 2
97
98[node name="GossipUpdateRate_Value" type="HSlider" parent="HypercoreDebugPanel/HypercoreDebugContainer"]
99margin_left = 164.0
100margin_top = 60.0
101margin_right = 364.0
102margin_bottom = 76.0
103rect_min_size = Vector2( 200, 0 )
104min_value = 0.25
105max_value = 5.0
106step = 0.25
107value = 1.0
108
90109[connection signal="button_up" from="HypercoreDebugPanel/HypercoreDebugContainer/GatewayStartStopButton" to="." method="_on_GatewayStartStopButton_button_up"]
110[connection signal="value_changed" from="HypercoreDebugPanel/HypercoreDebugContainer/GossipUpdateRate_Value" to="." method="_on_GossipUpdateRate_Value_value_changed"]