| … | … | @@ -12,6 +12,8 @@ onready var lGossipURL : Control = hyperdebugui.find_node("GossipURL_Value") |
| 12 | 12 | |
| 13 | 13 | onready var player_local : RigidBody = $Players/PlayerLocal |
| 14 | 14 | |
| 15 | onready var gossip_event_timer : Timer = $HyperGodot/GossipEventTimer | |
| 16 | ||
| 15 | 17 | const knownPlayers = {} |
| 16 | 18 | |
| 17 | 19 | const EVENT_PLAYER_POSITION = 'player_position' |
| … | … | @@ -61,11 +63,12 @@ func _on_HyperGateway_started_gateway(_pid : int): |
| 61 | 63 | updateGatewayStatus(_pid) |
| 62 | 64 | _perform_setup() |
| 63 | 65 | |
| 64 | func _on_PlayerLocalNetworkTimer_timeout(): | |
| 65 | _broadcast_player() | |
| 66 | ||
| 67 | 66 | func _on_HyperGateway_stopped_gateway(): |
| 68 | 67 | updateGatewayStatus(0) |
| 68 | ||
| 69 | func _on_GossipEventTimer_timeout(): | |
| 70 | if gateway.getIsGatewayRunning(): | |
| 71 | _broadcast_player() | |
| 69 | 72 | |
| 70 | 73 | func get_player_object(id): |
| 71 | 74 | if knownPlayers.has(id): return knownPlayers[id] |
| … | … | @@ -114,10 +117,10 @@ func _on_remote_player_moved(positionData, id): |
| 114 | 117 | # print('Moving player', id, " ", positionData) |
| 115 | 118 | var remotePlayer = get_player_object(id) |
| 116 | 119 | |
| 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) | |
| 121 | 124 | |
| 122 | 125 | remotePlayer.update_position( |
| 123 | 126 | translation, |
| … | … | @@ -128,3 +131,8 @@ func _on_remote_player_moved(positionData, id): |
| 128 | 131 | |
| 129 | 132 | func _on_PlayerLocal_moved(): |
| 130 | 133 | _broadcast_player() |
| 134 | ||
| 135 | ||
| 136 | func _on_HyperGodotDebugUI_position_update_rate_changed(seconds : float): | |
| 137 | gossip_event_timer.wait_time = seconds | |
| 138 | gossip_event_timer.start(seconds) |
| … | … | @@ -30,9 +30,6 @@ pause_mode = 2 |
| 30 | 30 | script = ExtResource( 8 ) |
| 31 | 31 | player_ball = NodePath("../PlayerLocal") |
| 32 | 32 | |
| 33 | [node name="PlayerLocalNetworkTimer" type="Timer" parent="Players"] | |
| 34 | autostart = true | |
| 35 | ||
| 36 | 33 | [node name="WorldEnvironment" type="WorldEnvironment" parent="."] |
| 37 | 34 | environment = ExtResource( 9 ) |
| 38 | 35 | |
| … | … | @@ -68,11 +65,13 @@ autoStart = false |
| 68 | 65 | [node name="HyperGossip" type="Node" parent="HyperGodot"] |
| 69 | 66 | script = ExtResource( 11 ) |
| 70 | 67 | |
| 68 | [node name="GossipEventTimer" type="Timer" parent="HyperGodot"] | |
| 69 | autostart = true | |
| 70 | ||
| 71 | 71 | [connection signal="moved" from="Players/PlayerLocal" to="." method="_on_PlayerLocal_moved"] |
| 72 | [connection signal="timeout" from="Players/PlayerLocalNetworkTimer" to="." method="_on_PlayerLocalNetworkTimer_timeout"] | |
| 73 | 72 | [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"] | |
| 75 | 73 | [connection signal="started_gateway" from="HyperGodot/HyperGateway" to="." method="_on_HyperGateway_started_gateway"] |
| 76 | 74 | [connection signal="stopped_gateway" from="HyperGodot/HyperGateway" to="." method="_on_HyperGateway_stopped_gateway"] |
| 77 | 75 | [connection signal="event" from="HyperGodot/HyperGossip" to="." method="_on_HyperGossip_event"] |
| 78 | 76 | [connection signal="listening" from="HyperGodot/HyperGossip" to="." method="_on_HyperGossip_listening"] |
| 77 | [connection signal="timeout" from="HyperGodot/GossipEventTimer" to="." method="_on_GossipEventTimer_timeout"] |
| … | … | @@ -1,6 +1,6 @@ |
| 1 | 1 | extends "res://player/ball/player_ball.gd" |
| 2 | 2 | |
| 3 | func update_position(new_translation, new_rotation, new_velocity_linear, new_velocity_angular): | |
| 3 | func update_position(new_translation : Vector3, new_rotation : Vector3, new_velocity_linear : Vector3, new_velocity_angular : Vector3): | |
| 4 | 4 | self.translation = new_translation |
| 5 | 5 | self.rotation = new_rotation |
| 6 | 6 | self.linear_velocity = new_velocity_linear |
| … | … | @@ -1,20 +1,17 @@ |
| 1 | 1 | extends Control |
| 2 | 2 | |
| 3 | signal toggle_hypergateway_startstop(start) | |
| 3 | signal gossip_update_rate_changed(seconds) | |
| 4 | ||
| 5 | onready var lGossipUpdateRate = $HypercoreDebugPanel/HypercoreDebugContainer/GossipUpdateRate | |
| 4 | 6 | |
| 5 | 7 | var hypergateway : HyperGateway |
| 6 | 8 | |
| 7 | 9 | |
| 8 | 10 | func _ready(): |
| 9 | # Find Potential HyperGateway Node | |
| 10 | hypergateway = get_tree().root.find_node("HyperGateway") | |
| 11 | if(hypergateway): | |
| 12 | hypergateway.start() | |
| 11 | pass | |
| 13 | 12 | |
| 14 | 13 | func _process(_delta): |
| 15 | hypergateway = get_tree().root.find_node("HyperGateway") | |
| 16 | if(hypergateway): | |
| 17 | hypergateway.start() | |
| 14 | pass | |
| 18 | 15 | |
| 19 | 16 | |
| 20 | 17 | func _on_GatewayStartStopButton_button_up(): |
| … | … | @@ -26,3 +23,7 @@ func _on_GatewayStartStopButton_button_up(): |
| 26 | 23 | hypergateway.stop() |
| 27 | 24 | else: |
| 28 | 25 | hypergateway.start() |
| 26 | ||
| 27 | func _on_GossipUpdateRate_Value_value_changed(value : float): | |
| 28 | lGossipUpdateRate.text = "Gossip in " + String(value) + " Seconds: " | |
| 29 | emit_signal("gossip_update_rate_changed", value) |
| … | … | @@ -34,7 +34,7 @@ __meta__ = { |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | [node name="GatewayStartStopButton" type="Button" parent="HypercoreDebugPanel/HypercoreDebugContainer"] |
| 37 | margin_right = 105.0 | |
| 37 | margin_right = 160.0 | |
| 38 | 38 | margin_bottom = 20.0 |
| 39 | 39 | text = "Start Gateway" |
| 40 | 40 | __meta__ = { |
| … | … | @@ -42,9 +42,9 @@ __meta__ = { |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | [node name="Label" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"] |
| 45 | margin_left = 109.0 | |
| 45 | margin_left = 164.0 | |
| 46 | 46 | margin_top = 3.0 |
| 47 | margin_right = 187.0 | |
| 47 | margin_right = 364.0 | |
| 48 | 48 | margin_bottom = 17.0 |
| 49 | 49 | __meta__ = { |
| 50 | 50 | "_edit_use_anchors_": false |
| … | … | @@ -52,7 +52,7 @@ __meta__ = { |
| 52 | 52 | |
| 53 | 53 | [node name="GatewayStatus" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"] |
| 54 | 54 | margin_top = 24.0 |
| 55 | margin_right = 105.0 | |
| 55 | margin_right = 160.0 | |
| 56 | 56 | margin_bottom = 38.0 |
| 57 | 57 | text = "Gateway Status :" |
| 58 | 58 | align = 2 |
| … | … | @@ -61,9 +61,9 @@ __meta__ = { |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | [node name="GatewayStatus_Value" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"] |
| 64 | margin_left = 109.0 | |
| 64 | margin_left = 164.0 | |
| 65 | 65 | margin_top = 24.0 |
| 66 | margin_right = 187.0 | |
| 66 | margin_right = 364.0 | |
| 67 | 67 | margin_bottom = 38.0 |
| 68 | 68 | text = "Not Running" |
| 69 | 69 | __meta__ = { |
| … | … | @@ -72,7 +72,7 @@ __meta__ = { |
| 72 | 72 | |
| 73 | 73 | [node name="GossipURL" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"] |
| 74 | 74 | margin_top = 42.0 |
| 75 | margin_right = 105.0 | |
| 75 | margin_right = 160.0 | |
| 76 | 76 | margin_bottom = 56.0 |
| 77 | 77 | text = "Gossip URL :" |
| 78 | 78 | align = 2 |
| … | … | @@ -81,10 +81,30 @@ __meta__ = { |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | [node name="GossipURL_Value" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"] |
| 84 | margin_left = 109.0 | |
| 84 | margin_left = 164.0 | |
| 85 | 85 | margin_top = 42.0 |
| 86 | margin_right = 187.0 | |
| 86 | margin_right = 364.0 | |
| 87 | 87 | margin_bottom = 56.0 |
| 88 | 88 | text = "N/A" |
| 89 | 89 | |
| 90 | [node name="GossipUpdateRate" type="Label" parent="HypercoreDebugPanel/HypercoreDebugContainer"] | |
| 91 | margin_top = 61.0 | |
| 92 | margin_right = 160.0 | |
| 93 | margin_bottom = 75.0 | |
| 94 | rect_min_size = Vector2( 160, 0 ) | |
| 95 | text = "Gossip in 1 Seconds :" | |
| 96 | align = 2 | |
| 97 | ||
| 98 | [node name="GossipUpdateRate_Value" type="HSlider" parent="HypercoreDebugPanel/HypercoreDebugContainer"] | |
| 99 | margin_left = 164.0 | |
| 100 | margin_top = 60.0 | |
| 101 | margin_right = 364.0 | |
| 102 | margin_bottom = 76.0 | |
| 103 | rect_min_size = Vector2( 200, 0 ) | |
| 104 | min_value = 0.25 | |
| 105 | max_value = 5.0 | |
| 106 | step = 0.25 | |
| 107 | value = 1.0 | |
| 108 | ||
| 90 | 109 | [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"] |