-
-
Notifications
You must be signed in to change notification settings - Fork 71
Client–Server_Initialization
This article outlines engine-level behavior. The following information is best suited for engine modders rather than game developers.
Client–Server initialization occurs in one or two Lua states depending on whether or not initialization takes place in a listen server context or in a dedicated server context, respectively.
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 map
console command.
engine.shared.map
concommand( "map", "Loads the specified map",
function( _, _, _, _, argT )
-- ...
engine.connectToListenServer()
end
)
In Grid, the engine connects to the server from the main menu.
game.client.gui.mainmenu
if ( not engine.isConnected() ) then
if ( _DEBUG ) then
engine.connect( "localhost" )
end
else
engine.disconnect()
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.map
-
Connecting to address:port...
- Server engine.onConnect()
-
peer has connected.
- Client engine.onConnect()
-
Connected to the server!
- Server engine.onPostConnect()
- 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