Global methods and properties to control Photon Bolt. More...
Static Public Member Functions | |
static void | Accept (UdpEndPoint endpoint) |
Signal bolt to accept an incoming client connection request More... | |
static void | Accept (UdpEndPoint endpoint, IProtocolToken acceptToken) |
Signal bolt to accept an incoming client connection request More... | |
static void | AddGlobalEventCallback< T > (Action< T > callback) |
Manually add a global event callback More... | |
static void | AddGlobalEventListener (MonoBehaviour mb) |
Manually add a global event listener More... | |
static GameObject | Attach (GameObject gameObject) |
Manually attach an Entity. More... | |
static GameObject | Attach (GameObject gameObject, IProtocolToken token) |
Manually attach an Entity. More... | |
static void | Connect (UdpEndPoint endpoint, IProtocolToken token=null) |
Connect to a server using their listening endpoint More... | |
static void | Connect (ushort port, IProtocolToken token=null) |
Connect to a server running on a specific port. This game server must be running on the local machine. More... | |
static UdpChannelName | CreateStreamChannel (string name, UdpChannelMode mode, int priority) |
Creating a new binary streaming channel More... | |
static void | Destroy (GameObject gameObject) |
Remove a gameObject from the bolt simulation. More... | |
static void | Destroy (GameObject gameObject, IProtocolToken token) |
Remove a gameObject from the bolt simulation. More... | |
static void | Detach (GameObject gameObject) |
Manually detach an Entity. More... | |
static void | Detach (GameObject gameObject, IProtocolToken token) |
Manually detach an Entity. More... | |
static void | DisableLanBroadcast () |
Disable LAN broadcasting More... | |
static void | EnableLanBroadcast (ushort port=60000) |
Enable LAN broadcasting More... | |
static bool | FindConnection (uint connectionId, out BoltConnection boltConnection) |
Looks at the BoltConnection list for a specific connection reference based on its ID. More... | |
static BoltEntity | FindEntity (NetworkId id) |
Find an entity based on unique id More... | |
static BoltEntity | Instantiate (GameObject prefab) |
Create a new entity in the simuation from a prefab More... | |
static BoltEntity | Instantiate (GameObject prefab, IProtocolToken token) |
Create a new entity in the simuation from a prefab More... | |
static BoltEntity | Instantiate (GameObject prefab, IProtocolToken token, Vector3 position, Quaternion rotation) |
Create a new entity in the simuation from a prefab More... | |
static BoltEntity | Instantiate (GameObject prefab, Vector3 position, Quaternion rotation) |
Create a new entity in the simuation from a prefab More... | |
static BoltEntity | Instantiate (PrefabId prefabId) |
Create a new entity in the simuation from a prefab More... | |
static BoltEntity | Instantiate (PrefabId prefabId, IProtocolToken token) |
Create a new entity in the simuation from a prefab More... | |
static BoltEntity | Instantiate (PrefabId prefabId, IProtocolToken token, Vector3 position, Quaternion rotation) |
Create a new entity in the simuation from a prefab More... | |
static BoltEntity | Instantiate (PrefabId prefabId, Vector3 position, Quaternion rotation) |
Create a new entity in the simuation from a prefab More... | |
static void | LoadScene (string scene) |
Load a scene based on name, only possible on the Server More... | |
static void | LoadScene (string scene, IProtocolToken token) |
Load a scene based on name, only possible on the Server More... | |
static void | LoadSceneSync () |
Use this method to sync the local scene on the Client with the remote scene from the Server. This method can only be invoked on the Client and it's only useful if you have the Auto Scene Load disabled. More... | |
static BoltPhysicsHits | OverlapSphereAll (Vector3 origin, float radius) |
Perform a sphere overlap against Bolt hitboxes More... | |
static BoltPhysicsHits | OverlapSphereAll (Vector3 origin, float radius, int frame) |
Perform a sphere overlap against Bolt hitboxes More... | |
static Vector3 | PositionAtFrame (BoltHitboxBody hitboxBody, int frame) |
Perform a hitbox rewind to get transform position at a given frame. More... | |
static void | PreLoadPrefabDatabase () |
Async load Bolt Entity prefabs More... | |
static BoltPhysicsHits | RaycastAll (Ray ray) |
Perform a raycast against Bolt hitboxes More... | |
static BoltPhysicsHits | RaycastAll (Ray ray, int frame) |
Perform a raycast against Bolt hitboxes More... | |
static void | Refuse (UdpEndPoint endpoint) |
Signal bolt to refuse an incoming connection request More... | |
static void | Refuse (UdpEndPoint endpoint, IProtocolToken token) |
Signal bolt to refuse an incoming connection request More... | |
static void | RegisterTokenClass< T > () |
Registers a type as a potential protocol token More... | |
static void | RemoveGlobalEventCallback< T > (Action< T > callback) |
Manually remove a global event callback More... | |
static void | RemoveGlobalEventListener (MonoBehaviour mb) |
Manually remove a global event listener More... | |
static void | SetCanReceiveEntities (bool canReceiveEntities) |
Whether the local simulation can receive entities instantiated from other connections More... | |
static void | SetEventFilter (IEventFilter filter) |
Sets bolt to use a filter to accept or reject certain events based on custom filtering More... | |
static void | SetNetworkSimulation (float loss, int pingMin, int pingMax) |
Sets the simulated network loss/ping settings for this peer. More... | |
static void | SetPrefabPool (IPrefabPool pool) |
Sets a custom implementation for pooling prefabs More... | |
static void | Shutdown () |
Shutdown this instance. More... | |
static void | ShutdownImmediate () |
Shutdowns Bolt Immediately. More... | |
static void | UpdateCurrentScene () |
Updates the internal loaded scene information. This is useful if Bolt is not used to manage Scenes and this is done externally by the developer. If the active Scene was changed, this must be invoked in order to signal that the internal data must be updated. More... | |
static void | UpdateSceneObjectsLookup () |
Updates the scene objects for fast lookup. More... | |
static void | UpdateSessionList (Map< Guid, UdpSession > sessions) |
Updates the session list from an external source More... | |
Properties | |
static IEnumerable< BoltConnection > | Clients [get] |
All clients connected to this host More... | |
static IEnumerable< BoltConnection > | Connections [get] |
All the connections connected to this host More... | |
static AsyncOperation | CurrentAsyncOperation [get] |
Gets the current async operation. More... | |
static string | CurrentVersion [get] |
Gets the current Bolt version as string. More... | |
static IEnumerable< BoltEntity > | Entities [get] |
Returns an IEnumerable list of all Bolt Entities currently loaded into the scene More... | |
static int | Frame [get] |
The current local simulation frame number More... | |
static float | FrameAlpha [get] |
Normalized value of how much time have passed since the last FixedUpdate More... | |
static float | FrameBeginTime [get] |
The time the last fixed update begain, same as Time.fixedTime More... | |
static float | FrameDeltaTime [get] |
The fixed frame delta, same as Time.fixedDeltaTime More... | |
static int | FramesPerSecond [get] |
How many FixedUpdate frames per second bolt is configured to run More... | |
static GameObject | GlobalObject [get] |
The global object that all global behaviours will be attached to More... | |
static bool | IsClient [get] |
Returns true if this host is a client More... | |
static bool | IsConnected [get] |
Returns true if this instance is a server or a client with at least one valid connection. More... | |
static bool | IsDebugMode [get] |
Returns true if Bolt was compiled in debug mode More... | |
static bool | IsRunning [get] |
Signal if Bolt is running. More... | |
static bool | IsServer [get] |
Returns true if this host is a server More... | |
static bool | IsSinglePlayer [get] |
Returns true if this host is running in single player mode. More... | |
static int? | MaxConnections [get] |
The max number of client connections to the server More... | |
static IEnumerable< BoltEntity > | SceneObjects [get] |
A list of all BoltEntities in the server simulation More... | |
static ScopeMode | ScopeMode [get] |
The scoping mode active More... | |
static BoltConnection | Server [get] |
The server connection More... | |
static int | ServerFrame [get] |
On the server this returns the local frame, on a client this returns the currently estimated frame of all server objects we have received More... | |
static float | ServerTime [get] |
The current server simulation time More... | |
static Map< Guid, UdpSession > | SessionList [get] |
Gets the list of UdpSession received by the system. More... | |
static float | Time [get] |
The local time, same as Time.time More... | |
static UdpSocket | UdpSocket [get] |
Gets the current UDP socket. More... | |
static Version | Version [get] |
The current Photon Bolt assembly version number. More... | |
static string??? | VersionConfiguration [get] |
Gets the Bolt Version description. More... | |
static string??? | VersionInfo [get] |
Extra info of the Current Bolt version. More... | |
Global methods and properties to control Photon Bolt.
Example: How to load a map on the server and instantiate a server controlled player.
Example: How to connect to a server with known IP and port number.
Example: How to use the BoltNetwork frame
property in an Update loop. Here we recalculate the player path 3 times per second.
|
inlinestatic |
Signal bolt to accept an incoming client connection request
endpoint | The UDP address of incoming client connection |
Example: Accepting an incoming connection.
|
inlinestatic |
Signal bolt to accept an incoming client connection request
endpoint | The UDP address of incoming client connection |
acceptToken | A data token from the server |
Example: Accepting an incoming connection and passing a data token to tell the client the preferred reconnect timeout.
|
inlinestatic |
Manually add a global event callback
T | : | Bolt.Event |
|
inlinestatic |
Manually add a global event listener
mb | The monobehaviour to invoke events on |
|
inlinestatic |
Manually attach an Entity.
gameObject | Game object. |
|
inlinestatic |
Manually attach an Entity.
gameObject | Game object. |
token | Token. |
|
inlinestatic |
Connect to a server using their listening endpoint
BOLT PRO ONLY
endpoint | Server end point to connect to |
token | Optional Token used when connecting to server, this can be the client credentials |
Example: A method to connect to any server ip and port as a client.
|
inlinestatic |
Connect to a server running on a specific port. This game server must be running on the local machine.
port | Connect to a local server using its port |
token | Optional Token used when connecting to server, this can be the client credentials |
Example: A method to connect to any server using only its port as a client.
|
inlinestatic |
Creating a new binary streaming channel
name | Channel name |
mode | Reliability mode |
priority | Bandwidth priority |
Example: Creating an unreliable stream channel for voice and a reliable stream channel for sending custom player icons.
|
inlinestatic |
Remove a gameObject from the bolt simulation.
gameObject | The gameObject to remove |
Example: Destroying all player entities using a foreach loop over BoltNetwork.SceneObjects
.
|
inlinestatic |
Remove a gameObject from the bolt simulation.
gameObject | The gameObject to remove |
token | Optional Token used when destroying an Entity, this can be used to send information about the destruction. |
Example: Destroying all player entities using a foreach loop over BoltNetwork.SceneObjects
and sending a death recap message as a protocol token.
|
inlinestatic |
Manually detach an Entity.
gameObject | Game object. |
|
inlinestatic |
Manually detach an Entity.
gameObject | Game object. |
token | Token. |
|
inlinestatic |
Disable LAN broadcasting
Example: Disabling LAN broadcasting at the end of a game.
|
inlinestatic |
Enable LAN broadcasting
port | The port to use for LAN broadcast. Default is 60000. |
Example: Enabling LAN broadcast after starting a new server using a specified port.
|
inlinestatic |
Looks at the BoltConnection list for a specific connection reference based on its ID.
connectionId | Connection ID to check |
boltConnection | Reference to a BoltConnection if the ID is valid |
|
inlinestatic |
Find an entity based on unique id
id | The id to look up |
Example: Locating an entity within the scene using an id provided by the input command.
|
inlinestatic |
Create a new entity in the simuation from a prefab
prefab | The prefab to clone into the simulation |
Example: How to instantiate and configure a player entity inside a Bolt.GlobalEventListener
on the server using a public editor variable playerPrefab
as the player prefab object.
|
inlinestatic |
Create a new entity in the simuation from a prefab
prefab | The prefab to clone into the simulation |
token | A data token of max size 512 bytes |
Example: How to instantiate a player entity and allow to to configure itself with some initial data.
|
inlinestatic |
Create a new entity in the simuation from a prefab
prefab | The prefab to clone into the simulation |
token | A data token of max size 512 bytes |
position | A position vector |
rotation | A rotation quaternion |
Example: How to instantiate and configure a player entity with both an initial data token and a given position / rotation.
|
inlinestatic |
Create a new entity in the simuation from a prefab
prefab | The prefab to clone into the simulation |
position | A position vector |
rotation | A rotation quaternion |
Example: How to instantiate and configure a player entity with the position and rotation set to match that of the spawnPoint
transform reference.
|
inlinestatic |
Create a new entity in the simuation from a prefab
prefabId | The prefab to clone into the simulation |
Example: How to instantiate a player entity using the static BoltPrefabs
class as a shortcut to the player prefab object.
|
inlinestatic |
Create a new entity in the simuation from a prefab
prefabId | The prefab to clone into the simulation |
token | A data token of max size 512 bytes |
Example: How to instantiate a player entity and allow to to configure itself with some initial data using static BoltPrefabs
class as a shortcut to the player prefab object.
|
inlinestatic |
Create a new entity in the simuation from a prefab
prefabId | The prefab to clone into the simulation |
token | A data token of max size 512 bytes |
position | A position vector |
rotation | A rotation quaternion |
Example: How to instantiate and configure a player entity inside a Bolt.GlobalEventListener
on the server using initial data and the static BoltPrefabs
class as a shortcut to the player prefab id.
|
inlinestatic |
Create a new entity in the simuation from a prefab
prefabId | The prefab to clone into the simulation |
position | A position vector |
rotation | A rotation quaternion |
Example: How to instantiate a player entity from the static BoltPrefabs
class with a given position and rotation.
|
inlinestatic |
Load a scene based on name, only possible on the Server
scene | The scene to load |
Example: A utility function to start a server and initialize the first map.
|
inlinestatic |
Load a scene based on name, only possible on the Server
scene | The scene to load |
token | A data token from the server |
Example: Passing a random tip to display to each client while the new map is loading.
|
inlinestatic |
Use this method to sync the local scene on the Client with the remote scene from the Server. This method can only be invoked on the Client and it's only useful if you have the Auto Scene Load disabled.
Example: Receiving a signal from the server to sync scenes.
|
inlinestatic |
Perform a sphere overlap against Bolt hitboxes
origin | The origin of the sphere |
radius | The radius of the sphere |
Example: Calculating the blast radius of a grenade.
|
inlinestatic |
Perform a sphere overlap against Bolt hitboxes
origin | The origin of the sphere |
radius | The radius of the sphere |
frame | The frame to rollback to for calculation |
Example: Calculating the blast radius of a grenade.
|
inlinestatic |
Perform a hitbox rewind to get transform position at a given frame.
hitboxBody | The BoltHitboxBody to rewind |
frame | The frame (aka BoltNetwork.frame) to rewind to |
Example: Using PositionAtFrame to perform a dist check between a caster and target entity, but some frames back in time.
|
inlinestatic |
|
inlinestatic |
Perform a raycast against Bolt hitboxes
ray | The ray to |
Example: Using RaycastAll to detect a hit event and apply damage in a player weapon firing method.
|
inlinestatic |
Perform a raycast against Bolt hitboxes
ray | The ray to |
frame | The frame to roll back to when performing this raycast |
Example: Using RaycastAll to detect a hit event on a specific previous frame and then apply damage in a player weapon firing method.
|
inlinestatic |
Signal bolt to refuse an incoming connection request
endpoint | The UDP address of incoming client connection |
Example: Refusing an incoming connection.
|
inlinestatic |
Signal bolt to refuse an incoming connection request
endpoint | The UDP address of incoming client connection |
token | A data token from the server |
Example: Refusing an incoming connection and sending back an error message.
|
inlinestatic |
Registers a type as a potential protocol token
T | The type to register |
Example Registering two token types on startup.
T | : | class | |
T | : | IProtocolToken | |
T | : | new() |
|
inlinestatic |
Manually remove a global event callback
T | : | Bolt.Event |
|
inlinestatic |
Manually remove a global event listener
mb | The monobehaviour to be removed |
|
inlinestatic |
Whether the local simulation can receive entities instantiated from other connections
canReceiveEntities | WTrue/False |
Example: Configuring the server to allow receiving entities and open a LAN game.
|
inlinestatic |
Sets bolt to use a filter to accept or reject certain events based on custom filtering
filter | Your custom implementation of the IEventFilter interface |
Example: A custom event filter implementation which does nothing.
Example: Setting the NullEventFilter
on startup.
|
inlinestatic |
Sets the simulated network loss/ping settings for this peer.
loss | Simulated loss, 0.0-1.0 |
pingMin | Simulated minimum ping |
pingMax | Simulated max ping |
|
inlinestatic |
Sets a custom implementation for pooling prefabs
pool | The custom pooling implementation |
Example: Setting bolt to use a custom prefab pooling implementation.
|
inlinestatic |
Shutdown this instance.
|
inlinestatic |
Shutdowns Bolt Immediately.
|
inlinestatic |
Updates the internal loaded scene information. This is useful if Bolt is not used to manage Scenes and this is done externally by the developer. If the active Scene was changed, this must be invoked in order to signal that the internal data must be updated.
|
inlinestatic |
Updates the scene objects for fast lookup.
|
inlinestatic |
Updates the session list from an external source
sessions | New sessions list. |
|
staticget |
All clients connected to this host
Example: Disconnecting all current clients.
|
staticget |
All the connections connected to this host
Example: Terminating all connections.
|
staticget |
Gets the current async operation.
The current async operation.
|
staticget |
Gets the current Bolt version as string.
|
staticget |
Returns an IEnumerable list of all Bolt Entities currently loaded into the scene
Example: A post-game method to destroy all minions/npcs in the server simulation.
|
staticget |
The current local simulation frame number
Example: Using the BoltNetwork frame in a loop to recalculate the player path once every 20 frames.
|
staticget |
Normalized value of how much time have passed since the last FixedUpdate
|
staticget |
The time the last fixed update begain, same as Time.fixedTime
|
staticget |
The fixed frame delta, same as Time.fixedDeltaTime
Example: How to use frameDeltaTime
to translate a player's per-second health regeneration rate into a per-frame value.
|
staticget |
How many FixedUpdate frames per second bolt is configured to run
Example: Calculating the number of frames between footsteps from a time interval.
|
staticget |
The global object that all global behaviours will be attached to
Example: The globalObject
can be used as a root for attaching new scripts such as GlobalEventListener callbacks.
|
staticget |
Returns true if this host is a client
Example: Implementing a client-side score sheet display to show the scores at the end of a game.
|
staticget |
Returns true if this instance is a server or a client with at least one valid connection.
Example: Using the isConnected
property to do an automatic reconnect loop.
|
staticget |
Returns true if Bolt was compiled in debug mode
Example: Showing an FPS and ping counter when in debug mode.
|
staticget |
Signal if Bolt is running.
Example: How to use the isRunning
property to detect a downtime and restart the server.
|
staticget |
Returns true if this host is a server
Example: Using the isServer
property to implement server specific logic such as spawning NPCs after a new map has been generated.
|
staticget |
Returns true if this host is running in single player mode.
true
if is single player; otherwise, false
.
|
staticget |
The max number of client connections to the server
Example: Using the max connections value to enforce server connection limits on an incoming client connection.
|
staticget |
A list of all BoltEntities in the server simulation
Example: Destroying all player entities using a foreach loop over BoltNetwork.SceneObjects
and finding the players with StateIs()
.
|
staticget |
The scoping mode active
|
staticget |
The server connection
Example: Displaying the current server IP address and port to the client.
|
staticget |
On the server this returns the local frame, on a client this returns the currently estimated frame of all server objects we have received
Example: Predicting the next possible fire frame on the client using the estimated serverFrame
.
|
staticget |
The current server simulation time
Example: Using the serverTime
property to display a message when the max game time has expired.
|
staticget |
Gets the list of UdpSession received by the system.
The session list.
|
staticget |
The local time, same as Time.time
Example: Using the time
property to periodically play footstep sounds on the client.
|
staticget |
Gets the current UDP socket.
The UDP socket.
|
staticget |
|
staticget |
Extra info of the Current Bolt version.