This wiki is archived from 2021-09-05

Planetary Annihilation net API: Difference between revisions

From Planetary Annihilation: TITANS and Classic PA Wiki
Jump to navigation Jump to search
(Created page with "Category:Modding = 50px Planetary Annihilation net API = == api.net.startGame( region, mode ) == create a new local or Uber game: * region: loca...")
 
mNo edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Modding]]
[[Category:Modding]]
= [[File:Titans-icon.png|50px]] Planetary Annihilation net API =
= Planetary Annihilation net API =
 
Do NOT use these API directly.
 
The preferred approach is to make use of the connect to game scene.


== api.net.startGame( region, mode ) ==
== api.net.startGame( region, mode ) ==


create a new local or Uber game:
{| class="wikitable"
* region: local or valid Uber region string
!region
* mode: Config or gw optionally prefixed with content eg PAExpansion1:Config for Titans
|mandatory
|string
|uber region: Australia, USCentral or EUWest
|-
!mode
|mandatory
|string
|Config or gw optionally prefixed with content eg PAExpansion1:Config for Titans
|-
!returns
|
|object
|
|-
|
!LobbyId
|string
|unique game identifier
|-
|
!ServerHostName
|string
|hostname or IP address
|-
|
!ServerPort
|string
|port number
|-
|
!Ticket
|string
|uber game ticket
|-
|
!Expires
|string
|ISO 8601 UTC timestamp
|}
 
== api.net.joinGame( params ) ==
 
Joins an Uber game based on a lobbyId.
 
{| class="wikitable"
!params
|mandatory
|object
|only lobbyId is used
|-
!returns
|
|object
|
|-
|
!LobbyId
|string
|unique game identifier
|-
|
!ServerHostName
|string
|hostname or IP address
|-
|
!ServerPort
|string
|port number
|-
|
!Ticket
|string
|uber game ticket
|-
|
!Expires
|string
|ISO 8601 UTC timestamp
|}
 
Internally retries 5 times baaed on PollWaitTimeMS.
 
Currently never returns if invalid lobbyId.
 
== api.net.connect( params ) ==
 
Connects to a game server.


returns object with:
{| class="wikitable"
* LobbyId (string)
!params
* ServerHostname (string)
|mandatory
* ServerPort (string)
|object
* Ticket (string)
|
* Expires (string)
|-
!host
|mandatory
|string
|hostname or IP address
|-
!port
|mandatory
|string
|port number
|-
!display_name
|mandatory
|string
|
|-
!ticket
|mandatory for uber servers
|string
|returned from startGame or joinGame
|-
!with_content
|optional
|string
|PAExpansion1 for Titans
|-
!clientData
|mandatory for uber servers
|object
|
|}


== api.net.joinGame( params) ==
clientData:


joins an Uber game based on a lobbyId:
{| class="wikitable"
* lobbyId (string)
!password
* all other params are ignored
|optional
|object
|
|-
!uberid
|mandatory for uber servers
|string
|unique player identifier
|-
!uuid
|optional
|string
|unique game identifier for invites to private game
|}


returns object with:
One of the following handlers should be fired:
* ServerHostName
* login_accepted
* ServerPort
* login_rejected
* connection_failed (does not currently fire)

Latest revision as of 11:23, 9 September 2021

Planetary Annihilation net API

Do NOT use these API directly.

The preferred approach is to make use of the connect to game scene.

api.net.startGame( region, mode )

region mandatory string uber region: Australia, USCentral or EUWest
mode mandatory string Config or gw optionally prefixed with content eg PAExpansion1:Config for Titans
returns object
LobbyId string unique game identifier
ServerHostName string hostname or IP address
ServerPort string port number
Ticket string uber game ticket
Expires string ISO 8601 UTC timestamp

api.net.joinGame( params )

Joins an Uber game based on a lobbyId.

params mandatory object only lobbyId is used
returns object
LobbyId string unique game identifier
ServerHostName string hostname or IP address
ServerPort string port number
Ticket string uber game ticket
Expires string ISO 8601 UTC timestamp

Internally retries 5 times baaed on PollWaitTimeMS.

Currently never returns if invalid lobbyId.

api.net.connect( params )

Connects to a game server.

params mandatory object
host mandatory string hostname or IP address
port mandatory string port number
display_name mandatory string
ticket mandatory for uber servers string returned from startGame or joinGame
with_content optional string PAExpansion1 for Titans
clientData mandatory for uber servers object

clientData:

password optional object
uberid mandatory for uber servers string unique player identifier
uuid optional string unique game identifier for invites to private game

One of the following handlers should be fired:

  • login_accepted
  • login_rejected
  • connection_failed (does not currently fire)