User Tools

Site Tools


networking

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
networking [2016/07/25 12:44]
Mike
networking [2016/11/17 13:11] (current)
Mike [Movement]
Line 1: Line 1:
-====== ​Networking/Online Multiplayer ======+====== Online Multiplayer ======
  
 Setting up your game for online multiplayer is considered an advanced topic, so it is recommended that you familiarize yourself with 001 Game Creator in general before attempting to implement this. Setting up your game for online multiplayer is considered an advanced topic, so it is recommended that you familiarize yourself with 001 Game Creator in general before attempting to implement this.
Line 18: Line 18:
   - When the server receives a connection, the "​Connection Received"​ system trigger is executed on the server with a parameter variable "​ip"​ containing the IP address of the connecting client and a parameter variable "​id"​ containing a unique number identifying the client (which can be used in other events).   - When the server receives a connection, the "​Connection Received"​ system trigger is executed on the server with a parameter variable "​ip"​ containing the IP address of the connecting client and a parameter variable "​id"​ containing a unique number identifying the client (which can be used in other events).
   - Once the client realizes that it has made the connection, the left branch of the "​Connect to Game Server"​ event continues to execute.   - Once the client realizes that it has made the connection, the left branch of the "​Connect to Game Server"​ event continues to execute.
-  - The server and client may freely communicate using [[networkmessages|Network Messages]]. That is, the server can execute a network message event causing all clients or a specific client to run the script inside. And vice versa, the client can execute a network message event causing the server to run the script inside.+  - The server and client may freely communicate using **[[networkmessages|Network Messages]]**. That is, the server can execute a network message event causing all clients or a specific client to run the script inside. And vice versa, the client can execute a network message event causing the server to run the script inside.
   - The server, at any point in time may close the connection using the "Close Connection"​ event; this can be based on the "​ip"​ value provided by the "​Connection Received"​ system trigger. The client, at any point in time may close the connection in the same way.   - The server, at any point in time may close the connection using the "Close Connection"​ event; this can be based on the "​ip"​ value provided by the "​Connection Received"​ system trigger. The client, at any point in time may close the connection in the same way.
  
Line 35: Line 35:
 The port number you choose should be unique, and likely customizable. ​ Any other software may use any port they choose to use, and if the port is already in use, you may have issues with hosting a server on that same port.  It is advisable to choose a port with at least three or four digits in the number. The port number you choose should be unique, and likely customizable. ​ Any other software may use any port they choose to use, and if the port is already in use, you may have issues with hosting a server on that same port.  It is advisable to choose a port with at least three or four digits in the number.
  
-For a list of registered port numbers and further recommendations,​ see [[https://​en.wikipedia.org/​wiki/​List_of_TCP_and_UDP_port_numbers|List of TCP and UDP port numbers on Wikipedia]].+For a list of registered port numbers and further recommendations,​ see **[[https://​en.wikipedia.org/​wiki/​List_of_TCP_and_UDP_port_numbers|List of TCP and UDP port numbers on Wikipedia]]**.
  
 ---- ----
Line 53: Line 53:
 Getting a connection established is the most important factor. ​ Always ensure that you're hosting on the right IP address, connecting to the right IP address, and using a port number that is not already being used by other software on the hosting computer. Getting a connection established is the most important factor. ​ Always ensure that you're hosting on the right IP address, connecting to the right IP address, and using a port number that is not already being used by other software on the hosting computer.
  
-It may help to uncheck "​Freeze game when game loses focus" in [[general|Game Settings]], as the game and thus networking functionality won't proceed unless the particular instance of the game has focus.+It may help to uncheck "​Freeze game when game loses focus" in **[[general|Game Settings]]**, as the game and thus networking functionality won't proceed unless the particular instance of the game has focus.
  
 When the server receives a connection from a client, it would probably be wise to have the two communicate a bit before throwing everyone into the game.  For example, the server can take this opportunity to validate the IP address of the incoming connection, or wait for a secret password from the client to enter a particular game.  It all comes down to how the game designer intends to validate a player and what information the server and client need to know about each other. When the server receives a connection from a client, it would probably be wise to have the two communicate a bit before throwing everyone into the game.  For example, the server can take this opportunity to validate the IP address of the incoming connection, or wait for a secret password from the client to enter a particular game.  It all comes down to how the game designer intends to validate a player and what information the server and client need to know about each other.
Line 63: Line 63:
 Most gameplay elements should be transmitted as they happen or change. ​ However, movement is particularly susceptible to noticeable performance issues because of common network issues, such as low latency situations or bandwidth limitations. Most gameplay elements should be transmitted as they happen or change. ​ However, movement is particularly susceptible to noticeable performance issues because of common network issues, such as low latency situations or bandwidth limitations.
  
-A simple solution for handling movement, is to intermittently have the client inform the server of its current location. ​ The server can simply relay this back to the other clients and those clients can merely use a "Walk to Location"​ event to that new location. ​ It will look //just as good// as what the other client probably ​performance, but reduces the amount of data transmitted over the network.+A simple solution for handling movement, is to intermittently have the client inform the server of its current location. ​ The server can simply relay this back to the other clients and those clients can merely use a "Walk to Location"​ event to that new location. ​ It will look //just as good// as what the other client probably ​performed, but reduces the amount of data transmitted over the network.
  
 ---- ----
networking.1469468665.txt.gz ยท Last modified: 2016/07/25 12:44 by Mike