com.threerings.tudey.server
Class ClientLiaison

java.lang.Object
  extended by com.threerings.tudey.server.ClientLiaison

public class ClientLiaison
extends Object

Handles interaction with a single client.


Nested Class Summary
protected static class ClientLiaison.TickRecord
          Contains the state at a single tick.
 
Field Summary
protected  List<Actor> _actorsAdded
          Holds actors added on the current tick.
protected  List<Actor> _actorsRemoved
          Holds actors removed on the current tick.
protected  List<ActorDelta> _actorsUpdated
          Holds actors updated on the current tick.
protected  IntMap<Actor> _added
          Stores added actors.
protected  BodyObject _bodyobj
          The client body object.
protected  PawnLogic _controlled
          The pawn that the client is controlling.
protected  List<Effect> _fired
          Stores effects fired.
protected  int _lastInput
          The timestamp of the last input frame received from the client.
protected  Rect _localInterest
          The untranslated area of interest.
protected  int _ping
          The most recent ping time estimate.
protected  TruncatedAverage _pingAverage
          The trailing average of the ping times.
protected  Set<ActorLogic> _previousVisibleActors
          The actors in the area of interest at the last update.
protected  boolean _receiving
          Set when we know that the client will be receiving on the client object.
protected  List<ClientLiaison.TickRecord> _records
          Records of each update transmitted to the client.
protected  IntMap<Actor> _removed
          Stores removed actor.
protected  TudeySceneManager _scenemgr
          The scene manager that created the liaison.
protected  CrowdSession _session
          The client session.
protected  PawnLogic _target
          The pawn that the client's camera is tracking.
protected  TudeySceneObject _tsobj
          The scene object.
protected  IntMap<ActorDelta> _updated
          Stores updated actor deltas.
protected  Set<ActorLogic> _visibleActors
          The actors in the area of interest on the current update.
protected  Rect _worldInterest
          The translated area of interest.
 
Constructor Summary
ClientLiaison(TudeySceneManager scenemgr, BodyObject bodyobj, CrowdSession session)
          Creates a new liaison for the specified client.
 
Method Summary
 void bodyUpdated(OccupantInfo info)
          Notes that the client's occupant info has been updated.
 void enqueueInput(int acknowledge, int ping, InputFrame[] frames)
          Processes a request to enqueue input received from a client.
 void enteredPlace()
          Notes that the client has successfully entered the place.
 int getControlDelta()
          Computes and returns the difference between the time at which the client depicts actors that it controls (its advanced time) and the time at which it depicts all other actors (its delayed time).
 int getLastInput()
          Returns the timestamp of the last input frame received from the client (or zero if none have yet been received).
 PawnLogic getTarget()
          Returns a reference to the client's target.
protected  void populateVisibleActors()
          Populates the set of visible actors.
 void postDelta()
          Posts the scene delta for this client, informing it any all relevant changes to the scene since its last acknowledged delta.
 void setCameraParams(CameraConfig config, float aspect)
          Sets the client's camera parameters.
 void setTarget(PawnLogic target)
          Sets the client's target actor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_scenemgr

protected TudeySceneManager _scenemgr
The scene manager that created the liaison.


_tsobj

protected TudeySceneObject _tsobj
The scene object.


_bodyobj

protected BodyObject _bodyobj
The client body object.


_session

protected CrowdSession _session
The client session.


_target

protected PawnLogic _target
The pawn that the client's camera is tracking.


_controlled

protected PawnLogic _controlled
The pawn that the client is controlling.


_localInterest

protected Rect _localInterest
The untranslated area of interest.


_worldInterest

protected Rect _worldInterest
The translated area of interest.


_records

protected List<ClientLiaison.TickRecord> _records
Records of each update transmitted to the client.


_receiving

protected boolean _receiving
Set when we know that the client will be receiving on the client object.


_ping

protected int _ping
The most recent ping time estimate.


_pingAverage

protected TruncatedAverage _pingAverage
The trailing average of the ping times.


_lastInput

protected int _lastInput
The timestamp of the last input frame received from the client.


_previousVisibleActors

protected Set<ActorLogic> _previousVisibleActors
The actors in the area of interest at the last update.


_visibleActors

protected Set<ActorLogic> _visibleActors
The actors in the area of interest on the current update.


_actorsAdded

protected List<Actor> _actorsAdded
Holds actors added on the current tick.


_actorsUpdated

protected List<ActorDelta> _actorsUpdated
Holds actors updated on the current tick.


_actorsRemoved

protected List<Actor> _actorsRemoved
Holds actors removed on the current tick.


_added

protected IntMap<Actor> _added
Stores added actors.


_updated

protected IntMap<ActorDelta> _updated
Stores updated actor deltas.


_removed

protected IntMap<Actor> _removed
Stores removed actor.


_fired

protected List<Effect> _fired
Stores effects fired.

Constructor Detail

ClientLiaison

public ClientLiaison(TudeySceneManager scenemgr,
                     BodyObject bodyobj,
                     CrowdSession session)
Creates a new liaison for the specified client.

Method Detail

bodyUpdated

public void bodyUpdated(OccupantInfo info)
Notes that the client's occupant info has been updated.


setTarget

public void setTarget(PawnLogic target)
Sets the client's target actor.


getTarget

public PawnLogic getTarget()
Returns a reference to the client's target.


setCameraParams

public void setCameraParams(CameraConfig config,
                            float aspect)
Sets the client's camera parameters.


getControlDelta

public int getControlDelta()
Computes and returns the difference between the time at which the client depicts actors that it controls (its advanced time) and the time at which it depicts all other actors (its delayed time).


getLastInput

public int getLastInput()
Returns the timestamp of the last input frame received from the client (or zero if none have yet been received).


enteredPlace

public void enteredPlace()
Notes that the client has successfully entered the place.


enqueueInput

public void enqueueInput(int acknowledge,
                         int ping,
                         InputFrame[] frames)
Processes a request to enqueue input received from a client.

Parameters:
ping - the ping calculated from the current time and the client's time estimate.

postDelta

public void postDelta()
Posts the scene delta for this client, informing it any all relevant changes to the scene since its last acknowledged delta.


populateVisibleActors

protected void populateVisibleActors()
Populates the set of visible actors.