Страница:
Lag Compensation
Страницы
Attribute Message System
Binary Serialization
BitWriter & BitReader
Connection Approval
Core Components
Custom Transports
Dedicated Servers
Differences from UNET HLAPI
Getting Started
HLAPI Differences
Handshake
Home
Lag Compensation
Library Initialization
Limitations
Message Encryption
Message System
Modularity
NetworkConfig
NetworkProfiler Editor Window
Networked Object Pooling
NetworkedAnimator
NetworkedBehaviour
NetworkedNavMeshAgent
NetworkedObject
NetworkedTransform
NetworkedVar
NetworkingManager
Object & Behaviour Relation
Object Ownership
Object Spawning
Observer
Optimization
Passthrough Messages
Prototype Components
Roadmap
Scene Management
SyncedVars
Targeted Messages
TrackedObject
5
Lag Compensation
Albin Corén редактировал(а) эту страницу 2018-03-29 00:04:48 +02:00
The MLAPI has built in Lag Compensation which is useful for Server Authoritative actions. For example if a client tells the server to shoot, and it's aimed right at another player. By the time the messages reaches the server, the client that was hit would already have moved. Lag compensation allows the server to rewind time to predict what the other client saw.
Each object that you want to be included in the lag compensation needs a TrackedObject script on it. A lag compensation can then be executed like this:
//1f is the amount of seconds to go back in time.
LagCompensationManager.Simulate(1f, () =>
{
//Do your stuff here. Raycasts etc.
});
or
//One in this case is the clientId 1's roundtriptime / 2
LagCompensationManager.Simulate(1, () =>
{
//Do your stuff here. Raycasts etc.
});
Getting Started
The Basics
- Message System
- Object Spawning
- Object & Behaviour Relation
- Modularity
- NetworkedVar
- Scene Management
- Object Ownership
Components
Advanced Topics
- Encryption
- Networked Object Pooling
- Lag Compensation
- BitWriter & BitReader
- Custom Transports
- Optimization
- Network Profiler Window
- Dedicated Servers