-
-
Notifications
You must be signed in to change notification settings - Fork 71
Client–Server_Initialization
Client–Server initialization occurs in two or one Lua states depending on whether or not initialization takes place in a dedicated server context or in a listen server context, respectively.
In Vertex Adventure, the engine connects to the Prime Universe in the main menu.
game.client.gui.mainmenu
if ( not engine.isConnectedToServer() ) then
if ( _DEBUG ) then
engine.connect( "localhost" )
else
-- TODO: Update this to use a universe browser.
engine.connect( "newton.andrewmcwatters.com" )
end
else
engine.disconnect()
end
Since Grid was written for Vertex Adventure, an MMORPG, and no
server browser exists yet, connecting to a listen server is typically only done
for debugging purposes by using the region
console command.
engine.shared.region
concommand( "region", "Loads the specified region",
function( _, _, _, _, argT )
-- ...
engine.connectToListenServer()
end
)
After making a call to either engine.connect() or
engine.connectToListenServer(), Grid loads
engine.client.network
which then allows
network.connect() or network.connectToListenServer() to be
called.
Depending on which method is called, the engine will either use lua-enet to connect to the server or emulate the network procedures in-memory.
- Connect to server in:
-
Client
game.client.gui.mainmenu
or -
Client
engine.shared.region
-
Connecting to address:port...
- Server engine.onConnect()
-
peer has connected.
- Client engine.onConnect()
-
Connected to the server!
-
Client
sendAuthTicket()
- Server
-
Received payload "authenticate" from peer
-
Player username has joined the game.
- Server engine.sendServerInfo()
-
Client
-
Received payload "serverInfo"
-
- Client engine.sendClientInfo()
-
Server
-
Received payload "clientInfo" from peer
-
- Shared player:initialSpawn()
Callbacks
- onAddonMounted
- onAddonUnmounted
- onMainMenuActivate
- onMainMenuClose
- onNPCSpawn
- onPlayerChat
- onPlayerConnect
- onPlayerDisconnect
- onPlayerInitialSpawn
- onPlayerSay
- onPlayerSpawn
- onPlayerUse
- onReloadImage
- onReloadScript
- onReloadSound
- quit
- update
Classes
- canvas
- character
- color
- concommand
- context
- convar
- entity
- fullscreencanvas
- host
- map
- networkvar
- payload
- player
- scheme
- shader
- sprite
- tween
- typelenvalues
- vector
Interfaces and Libraries
Panels
- box
- button
- checkbox
- closebutton
- commandbutton
- commandbuttongroup
- dropdownlist
- dropdownlistitem
- dropdownlistitemgroup
- frame
- frametab
- frametabgroup
- frametabpanel
- frametabpanels
- imagepanel
- label
- panel
- passwordtextbox
- progressbar
- radiobutton
- radiobuttongroup
- rootpanel
- scrollablepanel
- scrollbar
- slider
- tabbedframe
- text
- textbox
- textboxautocompleteitemgroup
- throbber
- viewport