 [WIP] Split up lobby -> menu, lobby, custom_game
lobby.gd had gotten big, bloated, ugly, and hard to read. It needed a
refactor. The first thing I did is split up the *GUI* into the logical
steps it should be. So the new flow is:
- Start the game
- Click "Quick Play"
- Matchmaking begins on my dedicated server
- Start the game
- Click "Custom Game"
- *Only now* am I presented with server / client options
- Start the game
- Click "Singleplayer"
- Singleplayer
NOW, and only now, and NO MATTER WHAT PATH I TAKE, I am taken to the
*lobby*, which now is where I:
- Choose my name
- Choose hero
- See list of players
- Get my team assigned
- Anything else that I might like to put in
The point here is that this has *nothing* to do with handshaking /
matchmaking / etc! This is just part of the game! At this point I have
*already been connected* to the server. I've already been aquainted with
my other players. The game has begun.
I put the things that don't belong in any of these flows in
networking.gd, a sort of model-view sorta thing. All of these flows use
some sort of networking thing like `init_server` that tbh should be
*completely* abstracted from the UI.
It's totally a WIP!!! Above is the IDEA, but below is what I've actually
*done*:
- Made the scenes, made a passable UI for each one that at least
indicates ~what they'll do
- Made the corresponding scripts, and split up the lobby script into
ABOUT where I think it'll end up, but no promises
It still errors all over the place, and it's nowhere near properly
organized. PLUS, I'd also like to rewrite a lot of the code / rename
things as part of the initial refactor goal of making me able to
actually think about networking.
7 years ago |
|
- [gd_scene load_steps=5 format=2]
-
- [ext_resource path="res://assets/theme.tres" type="Theme" id=1]
- [ext_resource path="res://scripts/custom_game.gd" type="Script" id=2]
- [ext_resource path="res://assets/DejaVuSansMono.ttf" type="DynamicFontData" id=3]
-
- [sub_resource type="DynamicFont" id=1]
-
- size = 30
- use_mipmaps = false
- use_filter = false
- font_data = ExtResource( 3 )
-
- [node name="CustomGame" type="Control"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_right = 40.0
- margin_bottom = 40.0
- rect_pivot_offset = Vector2( 0, 0 )
- mouse_filter = 0
- mouse_default_cursor_shape = 0
- size_flags_horizontal = 1
- size_flags_vertical = 1
- theme = ExtResource( 1 )
- script = ExtResource( 2 )
-
- [node name="VSeparator" type="VSeparator" parent="." index="0"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 498.0
- margin_top = 140.0
- margin_right = 518.0
- margin_bottom = 563.0
- rect_pivot_offset = Vector2( 0, 0 )
- mouse_filter = 0
- mouse_default_cursor_shape = 0
- size_flags_horizontal = 1
- size_flags_vertical = 1
-
- [node name="Label" type="Label" parent="." index="1"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 54.0
- margin_top = 66.0
- margin_right = 395.0
- margin_bottom = 102.0
- rect_pivot_offset = Vector2( 0, 0 )
- mouse_filter = 2
- mouse_default_cursor_shape = 0
- size_flags_horizontal = 1
- size_flags_vertical = 4
- custom_fonts/font = SubResource( 1 )
- text = "Custom Game"
- percent_visible = 1.0
- lines_skipped = 0
- max_lines_visible = -1
-
- [node name="Server" type="Button" parent="." index="2"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 68.0
- margin_top = 261.0
- margin_right = 272.0
- margin_bottom = 331.0
- rect_pivot_offset = Vector2( 0, 0 )
- 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 = "Host Game"
- flat = false
- align = 1
-
- [node name="LevelSelect" type="OptionButton" parent="." index="3"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 72.0
- margin_top = 201.0
- margin_right = 243.0
- margin_bottom = 236.0
- rect_pivot_offset = Vector2( 0, 0 )
- focus_mode = 2
- mouse_filter = 0
- mouse_default_cursor_shape = 0
- size_flags_horizontal = 1
- size_flags_vertical = 1
- toggle_mode = false
- action_mode = 0
- enabled_focus_mode = 2
- shortcut = null
- group = null
- text = "Platform map"
- flat = false
- align = 0
- selected = 0
- items = [ "Platform map", null, false, 0, null, "City-like thing", null, false, 1, null, "Slide", null, false, 2, null ]
-
- [node name="Client" type="Button" parent="." index="4"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 588.0
- margin_top = 258.0
- margin_right = 812.0
- margin_bottom = 332.0
- rect_pivot_offset = Vector2( 0, 0 )
- 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 Game"
- flat = false
- align = 1
-
- [node name="IPLabel" type="Label" parent="." index="5"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 592.0
- margin_top = 205.0
- margin_right = 625.0
- margin_bottom = 227.0
- rect_pivot_offset = Vector2( 0, 0 )
- 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="IP" type="TextEdit" parent="." index="6"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 632.0
- margin_top = 202.0
- margin_right = 783.0
- margin_bottom = 231.0
- rect_pivot_offset = Vector2( 0, 0 )
- focus_mode = 2
- mouse_filter = 0
- mouse_default_cursor_shape = 0
- size_flags_horizontal = 1
- size_flags_vertical = 1
- text = "127.0.0.1"
- readonly = false
- highlight_current_line = false
- syntax_highlighting = false
- show_line_numbers = false
- highlight_all_occurrences = false
- override_selected_font_color = false
- context_menu_enabled = true
- smooth_scrolling = false
- v_scroll_speed = 80.0
- hiding_enabled = 0
- wrap_lines = false
- caret_block_mode = false
- caret_blink = false
- caret_blink_speed = 0.65
- caret_moving_by_right_click = true
-
- [node name="Label2" type="Label" parent="." index="7"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 72.0
- margin_top = 145.0
- margin_right = 171.0
- margin_bottom = 167.0
- rect_pivot_offset = Vector2( 0, 0 )
- mouse_filter = 2
- mouse_default_cursor_shape = 0
- size_flags_horizontal = 1
- size_flags_vertical = 4
- text = "Host game"
- percent_visible = 1.0
- lines_skipped = 0
- max_lines_visible = -1
-
- [node name="Label3" type="Label" parent="." index="8"]
-
- anchor_left = 0.0
- anchor_top = 0.0
- anchor_right = 0.0
- anchor_bottom = 0.0
- margin_left = 577.0
- margin_top = 147.0
- margin_right = 617.0
- margin_bottom = 169.0
- rect_pivot_offset = Vector2( 0, 0 )
- mouse_filter = 2
- mouse_default_cursor_shape = 0
- size_flags_horizontal = 1
- size_flags_vertical = 4
- text = "Join Game"
- percent_visible = 1.0
- lines_skipped = 0
- max_lines_visible = -1
-
-
|