changed World_test to test physics interactions

added a main menu scene/script
added a network manager script
added the network script to be autoloaded
added an export
master
Zachary Epps 5 years ago
parent 57840ab860
commit e9354f1d93

@ -13,6 +13,10 @@ config_version=3
config/name="RE_Multi"
config/icon="res://icon.png"
[autoload]
NetworkManager="*res://scripts/NetworkManager.gd"
[editor_plugins]
enabled=PoolStringArray( "alanscodelog.gimbalcontrol" )

@ -0,0 +1,364 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scripts/MainMenu.gd" type="Script" id=1]
[node name="MainMenu" type="Container" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
script = ExtResource( 1 )
[node name="ConnectOptions" type="VBoxContainer" parent="." index="0"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -280.0
margin_top = -221.0
margin_right = 280.0
margin_bottom = 221.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="Label" type="Label" parent="ConnectOptions" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 560.0
margin_bottom = 14.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "choose your weapon"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="HBoxContainer" type="HBoxContainer" parent="ConnectOptions" index="1"]
editor/display_folded = true
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 18.0
margin_right = 560.0
margin_bottom = 42.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
alignment = 1
[node name="Label" type="Label" parent="ConnectOptions/HBoxContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 5.0
margin_right = 17.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "IP:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="LineEdit2" type="LineEdit" parent="ConnectOptions/HBoxContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 21.0
margin_right = 271.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 1
size_flags_horizontal = 3
size_flags_vertical = 1
focus_mode = 2
context_menu_enabled = true
placeholder_text = "127.0.0.1"
placeholder_alpha = 0.6
caret_blink = false
caret_blink_speed = 0.65
caret_position = 0
_sections_unfolded = [ "Placeholder" ]
[node name="Label2" type="Label" parent="ConnectOptions/HBoxContainer" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 275.0
margin_top = 5.0
margin_right = 305.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Port:"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="LineEdit" type="LineEdit" parent="ConnectOptions/HBoxContainer" index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 309.0
margin_right = 560.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 1
size_flags_horizontal = 3
size_flags_vertical = 1
focus_mode = 2
context_menu_enabled = true
placeholder_text = "31400"
placeholder_alpha = 0.6
caret_blink = false
caret_blink_speed = 0.65
caret_position = 0
_sections_unfolded = [ "Placeholder" ]
[node name="HBoxContainer2" type="HBoxContainer" parent="ConnectOptions" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 46.0
margin_right = 560.0
margin_bottom = 66.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
custom_constants/separation = 44
alignment = 1
_sections_unfolded = [ "custom_constants" ]
[node name="Button" type="Button" parent="ConnectOptions/HBoxContainer2" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 214.0
margin_right = 249.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Join"
flat = false
align = 1
[node name="Button2" type="Button" parent="ConnectOptions/HBoxContainer2" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 293.0
margin_right = 346.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Create"
flat = false
align = 1
[node name="PlayOptions" type="VBoxContainer" parent="." index="1"]
editor/display_folded = true
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -280.0
margin_top = -75.0
margin_right = 280.0
margin_bottom = 221.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="Label" type="Label" parent="PlayOptions" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 560.0
margin_bottom = 14.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "choose your weapon"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="HBoxContainer" type="HBoxContainer" parent="PlayOptions" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 18.0
margin_right = 560.0
margin_bottom = 38.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
alignment = 1
[node name="Button" type="Button" parent="PlayOptions/HBoxContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 184.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
group = null
text = "Player"
flat = false
align = 1
[node name="Button2" type="Button" parent="PlayOptions/HBoxContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 188.0
margin_right = 372.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
group = null
text = "Camera"
flat = false
align = 1
[node name="Button3" type="Button" parent="PlayOptions/HBoxContainer" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 376.0
margin_right = 560.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
group = null
text = "Enemus"
flat = false
align = 1
[connection signal="pressed" from="ConnectOptions/HBoxContainer2/Button" to="." method="_on_Join_pressed"]
[connection signal="pressed" from="ConnectOptions/HBoxContainer2/Button2" to="." method="_on_Create_pressed"]

@ -13,7 +13,7 @@ size = Vector2( 10, 10 )
points = PoolVector3Array( -5, -5, 0, -5, 5, 0, 5, 5, 0, 5, -5, 0 )
[node name="Spatial" type="Spatial" index="0"]
[node name="World" type="Spatial"]
[node name="StaticBody" type="StaticBody" parent="." index="0"]
@ -29,7 +29,7 @@ constant_angular_velocity = Vector3( 0, 0, 0 )
[node name="MeshInstance" type="MeshInstance" parent="StaticBody" index="0"]
transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 0, 0, 0 )
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 )
layers = 1
material_override = null
cast_shadow = 1
@ -45,12 +45,49 @@ material/0 = null
[node name="CollisionShape" type="CollisionShape" parent="StaticBody" index="1"]
transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 0, 0, 0 )
transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0 )
shape = SubResource( 2 )
disabled = false
[node name="Player" parent="." index="1" instance=ExtResource( 1 )]
[node name="StaticBody2" type="StaticBody" parent="." index="1"]
editor/display_folded = true
input_ray_pickable = true
input_capture_on_drag = false
collision_layer = 1
collision_mask = 1
friction = 1.0
bounce = 0.0
constant_linear_velocity = Vector3( 0, 0, 0 )
constant_angular_velocity = Vector3( 0, 0, 0 )
[node name="MeshInstance" type="MeshInstance" parent="StaticBody2" index="0"]
transform = Transform( 1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 0, -4.65928 )
layers = 1
material_override = null
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
mesh = SubResource( 1 )
skeleton = NodePath("..")
material/0 = null
_sections_unfolded = [ "Transform" ]
[node name="CollisionShape" type="CollisionShape" parent="StaticBody2" index="1"]
transform = Transform( 1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 0, -4.65928 )
shape = SubResource( 2 )
disabled = false
_sections_unfolded = [ "Transform" ]
[node name="Player" parent="." index="2" instance=ExtResource( 1 )]
editor/display_folded = true
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0 )
_sections_unfolded = [ "Transform" ]
@ -72,9 +109,9 @@ move_speed = 2
look_speed = 0.3
zoom_multiplier = 3
scroll_zoom_multiplier = 5
default_distance = 10
default_distance = 6
min_distance = 0
max_distance = 50
max_distance = 10
zoom_toggle_distances = [ 0, 20, 40 ]
reverse_zoom_toggle_order = false
first_person_distance = 1
@ -102,7 +139,6 @@ look_zoom_toggle_action_name = "ui_up"
[node name="Camera" type="Camera" parent="Player/GimbalControl" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
keep_aspect = 1
cull_mask = 1048575
environment = null

@ -0,0 +1,22 @@
extends Container
onready var roles = [
$"PlayOptions/HBoxContainer/Button",
$"PlayOptions/HBoxContainer/Button2",
$"PlayOptions/HBoxContainer/Button3"
]
var avaliable = 7
func _ready():
pass
func _on_Create_pressed():
var ip =
NetworkManager.create_server()
func _on_Join_pressed():
pass # replace with function body

@ -0,0 +1,33 @@
extends Node
const DEFAULT_IP = '127.0.0.1'
const DEFAULT_PORT = 31400
const MAX_PLAYERS = 3
var players = {}
var self_data = { role = 0, position = Vector3(), rotation = Vector3() }
func _ready():
get_tree().connect('network_peer_disconnected', self, '_player_disconnect')
func create_server(ip = DEFAULT_IP, port = DEFAULT_PORT):
players[1] = self_data
var peer = NetworkedMultiplayerENet.new()
peer.create_server(ip, port)
get_tree().set_network_peer(peer)
func connect_to_server(ip = DEFAULT_IP, port = DEFAULT_PORT):
get_tree().connect('connected_to_server', self, '_connected')
var peer = NetworkedMultiplayerENet.new()
peer.create_client(ip, port)
get_tree().set_network_peer(peer)
func _connected():
players[get_tree().get_network_unique_id()] = self_data
rpc('_send_player_info', get_tree().get_network_unique_id(), self_data)
func _player_disconnect(id):
players.erase(id)
remote func _send_player_info(id, data):
Loading…
Cancel
Save