Removed stupid requirement about game creation
This commit is contained in:
@@ -9,9 +9,11 @@ extends Node
|
||||
## `ws://` or `wss://` URL. On the web the client defaults to the page's own
|
||||
## origin, so a server and its web client can share one host and port.
|
||||
##
|
||||
## Creating a new game spawns the server as a separate headless instance of the
|
||||
## game and then connects this process to it as a client. The first player to
|
||||
## log in becomes the game's admin and stays admin across reconnections,
|
||||
## Creating a new game connects this process to an authoritative server as its
|
||||
## first player, who becomes the game's admin and configures it. On the web the
|
||||
## server is the dedicated instance already serving the page (a browser cannot
|
||||
## spawn processes); elsewhere a dedicated headless instance is spawned and the
|
||||
## client connects to that. Admin stays with the player across reconnections,
|
||||
## because admin is tied to the player's name rather than their peer id.
|
||||
##
|
||||
## Joining requires a name and a password. A new name sets its password on its
|
||||
@@ -115,6 +117,15 @@ func send_game_state(peer_id: int, snapshot: Dictionary) -> void:
|
||||
_rpc_game_state.rpc_id(peer_id, snapshot)
|
||||
|
||||
|
||||
## Starts a new game. The web client cannot spawn a server, so it creates the
|
||||
## game on the dedicated server already serving the page; elsewhere a dedicated
|
||||
## server process is spawned and the client connects to it.
|
||||
func create_game() -> Error:
|
||||
if OS.has_feature("web"):
|
||||
return join_game_url(default_server_url())
|
||||
return host_game()
|
||||
|
||||
|
||||
## Spawns a dedicated server process and connects to it as a client.
|
||||
func host_game() -> Error:
|
||||
var port := _find_free_port()
|
||||
|
||||
Reference in New Issue
Block a user