s&
About
The Project
info
About s&box
map
Roadmap
monitoring
Metrics
Engine startup and usage numbers
Updates
newspaper
Latest News
published_with_changes
Changes
Release-by-release changelog
Games
Browse Games
Discover Games
gamejams
live now
Game Jam III
Ends
Fri 25 Sep
Theme
One More Round
The jam is running. Build something, or play the entries.
£
50,000
prizepool
View the jam
Workshop
Playable
sports_esports
Games
Standalone games and gamemodes
Assets
landscape
Maps
view_in_ar
Models
texture
Materials
apparel
Clothing
apps
Everything
Every asset type in one list
Forum
Learn
Documentation
rocket_launch
Getting Started
docs
Documentation
api
API Reference
Resources
school
Tutorials
manage_search
Code Search
input
Log in with Steam
chevron_left
Change Language
简体中文
English
Русский
Español
Português-Brasil
Deutsch
日本語
Français
Polski
Türkçe
한국어
Pirate
Italiano
ไทย
繁體中文
Українська
Čeština
Nederlands
Magyar
Dansk
Suomi
Svenska
Norsk
Ελληνικά
Română
Български
Tiếng Việt
Bahasa Indonesia
Español-Latinoamérica
العربية
Api
Classes
GameNetworkSystem
chevron_left
Classes
class
GameNetworkSystem
Constructors
functions
GameNetworkSystem
Methods
functions
AcceptConnection
functions
AddHandler
functions
BecomeHostAsync
functions
Broadcast
functions
BroadcastRaw
functions
Dispose
functions
GetMountedVPKs
functions
GetSnapshot
functions
MountVPKs
functions
OnBecameHost
functions
OnConnected
functions
OnHostChanged
functions
OnInitialize
functions
OnJoined
functions
OnLeave
functions
Push
functions
ResyncFromHostAsync
functions
Send
functions
SetSnapshotAsync
lock
Tick
Static Properties
remove_circle
IsActive
remove_circle
IsClient
remove_circle
IsConnecting
remove_circle
IsHost
Static Methods
remove_circle
Connect
remove_circle
CreateLobby
remove_circle
Disconnect
remove_circle
QueryLobbies
remove_circle
TryConnectSteamId
GameNetworkSystem
An instance of this is created by the NetworkSystem when a server is joined, or created. You should not try to create this manually.
class
Sandbox.Network
.
abstract
Sandbox.Engine
build
Constructors
1
GameNetworkSystem
(
)
functions
Methods
20
AcceptConnection
(
channel
,
reason
)
bool
Called on the host to decide whether to accept a Sandbox.Connection.
AddHandler
(
handler
)
BecomeHostAsync
(
previousHost
,
snapshot
)
Task
We're already the host; load the previous host's snapshot.
Broadcast
(
obj
,
filter
)
BroadcastRaw
(
msg
,
filter
)
Dispose
(
)
GetMountedVPKs
(
source
,
msg
)
GetSnapshot
(
source
,
msg
)
MountVPKs
(
source
,
msg
)
Task
OnBecameHost
(
previousHost
)
Legacy host-change callback. Override BecomeHostAsync to apply the handoff snapshot. The default BecomeHostAsync implementation calls this for existing subclasses.
OnConnected
(
client
)
A client has connected to the server but hasn't fully finished joining yet.
OnHostChanged
(
previousHost
,
newHost
)
Legacy host-change callback. Override ResyncFromHostAsync to apply the new host's snapshot. The default ResyncFromHostAsync implementation calls this for existing subclasses.
OnInitialize
(
)
Called when the network system should handle initialization.
OnJoined
(
client
)
Fully joined the server. Can be called when changing the map too. The game should usually create some object for the player to control here.
OnLeave
(
client
)
A client has disconnected from the server.
Push
(
)
IDisposable
Allows to push some kind of scope when reading network messages. This is useful if you need to adjust Time.Now etc.
ResyncFromHostAsync
(
previousHost
,
newHost
,
snapshot
)
Task
Rebuild the game from the new host's snapshot.
Send
(
connectionId
,
obj
)
SetSnapshotAsync
(
data
)
Task
Tick
(
)
Called every frame
data_object
Static Properties
4
IsActive
obsolete
bool
True if we're currently connected etc
IsClient
obsolete
bool
True if we're connected to a server and not the host.
IsConnecting
obsolete
bool
True if we're currently connecting to the server
IsHost
obsolete
bool
True if we can be considered the host of this session. Either we're not connected to a server, or we are and we are the host.
functions
Static Methods
5
Connect
(
steamid
)
obsolete
CreateLobby
(
)
obsolete
Disconnect
(
)
obsolete
QueryLobbies
(
)
obsolete
Task`1
TryConnectSteamId
(
steamId
)
obsolete
Task`1
Inheritance
GameNetworkSystem
SceneNetworkSystem
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.