com.threerings.tudey.server
Class TudeySceneManager

java.lang.Object
  extended by com.threerings.crowd.server.PlaceManager
      extended by com.threerings.whirled.server.SceneManager
          extended by com.threerings.tudey.server.TudeySceneManager
All Implemented Interfaces:
RunQueue, SpeakHandler.SpeakerValidator, InvocationCodes, ChangeListener, MessageListener, InvocationProvider, TudeyCodes, TudeySceneModel.Observer, TudeySceneProvider, ActorAdvancer.Environment
Direct Known Subclasses:
ToolSceneManager

public class TudeySceneManager
extends SceneManager
implements TudeySceneProvider, TudeySceneModel.Observer, ActorAdvancer.Environment, RunQueue, TudeyCodes

Manager for Tudey scenes.


Nested Class Summary
static interface TudeySceneManager.ActorObserver
          An interface for objects to notify when actors are added or removed.
static interface TudeySceneManager.IntersectionSensor
          An interface for objects that should be notified when actors intersect them.
protected static class TudeySceneManager.ProfileTickOp
          Extends the tick op with profiling bits.
static interface TudeySceneManager.Sensor
          Base interface for sensors.
static interface TudeySceneManager.ShutdownObserver
          An interface for objects to notify when we shutdown.
protected static class TudeySceneManager.TickOp
          (Re)used to tick the participants.
static interface TudeySceneManager.TickParticipant
          An interface for objects that take part in the server tick.
protected static class TudeySceneManager.TickProfile
          Records information about a tick participant.
 
Nested classes/interfaces inherited from class com.threerings.crowd.server.PlaceManager
PlaceManager.DelegateOp, PlaceManager.MessageHandler
 
Nested classes/interfaces inherited from interface com.samskivert.util.RunQueue
RunQueue.AsExecutor
 
Field Summary
protected  ObserverList<TudeySceneManager.ActorObserver> _actorObservers
          The list of actor observers.
protected  HashIntMap<ActorLogic> _actors
          Actor logic objects mapped by id.
protected  HashSpace _actorSpace
          The actor space.
protected  ConfigManager _cfgmgr
          A reference to the scene model's configuration manager.
protected  HashIntMap<ClientLiaison> _clients
          Maps body oids to client liaisons.
protected  ClientManager _clmgr
          The client manager.
protected  ArrayList<Logic> _defaultEntrances
          The logic objects corresponding to default entrances.
protected  Rect _defaultLocalInterest
          The default local interest region.
protected  ArrayList<Effect> _effects
          Holds collected effects during queries.
protected  ArrayList<EffectLogic> _effectsFired
          The logic for effects fired on the current tick.
protected  ArrayList<SpaceElement> _elements
          Holds collected elements during queries.
protected  long _emptyTime
          The time at which the last occupant left.
protected  HashIntMap<Object> _entering
          Maps oids of entering bodies to the keys of the portals through which they're entering.
protected  HashMap<Object,EntryLogic> _entries
          Scene entry logic objects mapped by key.
protected  com.google.inject.Injector _injector
          The injector that we use to create and initialize our logic objects.
protected  HashMap<Class<?>,ArrayList<Logic>> _instances
          Maps logic classes to lists of logic instances.
protected  int _lastActorId
          The last actor id assigned.
protected  long _lastTick
          The system time of the last tick.
protected  Pathfinder _pathfinder
          The pathfinder used for path computation.
protected  Vector2f _penetration
          Stores penetration vector during queries.
protected  int _previousTimestamp
          The timestamp of the current and previous ticks.
protected static Map<String,TudeySceneManager.TickProfile> _profiles
          Used to profile our tick participants.
protected  TudeySceneManager.ProfileTickOp _profileTickOp
          The tick op used when profiling.
protected  List<Runnable> _runlist
          Holds runnables during tick.
protected  List<Runnable> _runnables
          Runnables enqueued for the next tick.
protected  HashSpace _sensorSpace
          The sensor space.
protected  ObserverList<TudeySceneManager.ShutdownObserver> _shutdownObservers
          The list of shutdown observers.
protected static ObserverList.ObserverOp<TudeySceneManager.ShutdownObserver> _shutdownOp
          Shutdown observer op.
protected  Set<ActorLogic> _staticActors
          "Static" actors.
protected  Set<ActorLogic> _staticActorsAdded
          The logic for static actors added on the current tick.
protected  Set<ActorLogic> _staticActorsRemoved
          The logic for static actors removed on the current tick.
protected  Set<ActorLogic> _staticActorsUpdated
          The logic for static actors updated on the current tick.
protected  HashMap<String,ArrayList<Logic>> _tagged
          Maps tags to lists of logic objects with that tag.
protected  long _tickDuration
          The duration of processing for the last tick.
protected  SceneTicker _ticker
          The ticker.
protected  boolean _ticking
          Set when we're actually in the process of ticking.
protected  TudeySceneManager.TickOp _tickOp
          Used to tick the participants.
protected static long _tickParticipantCount
          Incremented on each participant tick when profiling.
protected  ObserverList<TudeySceneManager.TickParticipant> _tickParticipants
          The list of participants in the tick.
protected static boolean _tickProfEnabled
          Whether or not we're profiling tick participants.
protected static int _tickProfInterval
          The frequency at which we take tick samples.
protected  int _timestamp
          The timestamp of the current and previous ticks.
protected  TudeySceneObject _tsobj
          A casted reference to the Tudey scene object.
 
Fields inherited from class com.threerings.whirled.server.SceneManager
_invoker, _scene, _screg, _updates
 
Fields inherited from class com.threerings.crowd.server.PlaceManager
_bodyUpdater, _config, _deathListener, _delegates, _dispatcher, _dispatcherFinders, _invmgr, _locator, _marshallers, _msghandlers, _occInfo, _occListener, _omgr, _plobj, _registry, _shutdownInterval
 
Fields inherited from interface com.samskivert.util.RunQueue
AWT
 
Fields inherited from interface com.threerings.tudey.data.TudeyCodes
DEFAULT_BUFFER_DELAY, DEFAULT_TICK_INTERVAL
 
Fields inherited from interface com.threerings.presents.data.InvocationCodes
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR
 
Constructor Summary
TudeySceneManager()
           
 
Method Summary
 void addActorObserver(TudeySceneManager.ActorObserver observer)
          Adds an observer for actor events.
protected  EntryLogic addLogic(TudeySceneModel.Entry entry, boolean notify)
          Adds the logic object for the specified scene entry, if any.
 void addMappings(Logic logic)
          Registers the specified logic object unders its mappings.
 void addShutdownObserver(TudeySceneManager.ShutdownObserver observer)
          Adds a shutdown observer.
 void addTickParticipant(TudeySceneManager.TickParticipant participant)
          Adds a participant to notify at each tick.
 void addTickParticipant(TudeySceneManager.TickParticipant participant, boolean withinTick)
          Adds a participant to notify at each tick.
protected  void bodyEntered(int bodyOid)
           
protected  void bodyLeft(int bodyOid)
           
protected  void bodyUpdated(OccupantInfo info)
           
 void bodyWillEnter(BodyObject body)
           
 void bodyWillLeave(BodyObject body)
           
 void clearEnteringBody(BodyObject body)
          Clears out the mapping for an entering body.
static void clearTickProfiles()
          Clears the current set of tick profiles.
 boolean collides(ActorLogic logic)
          Determines whether the specified actor collides with anything in the environment.
 boolean collides(ActorLogic logic, Shape shape)
          Determines whether the specified actor collides with anything in the environment.
 boolean collides(ActorLogic logic, Shape shape, int timestamp)
          Determines whether the specified actor collides with anything in the environment.
 boolean collides(Actor actor, Shape shape)
          Checks whether the actor is colliding with anything.
 boolean collides(Actor actor, Shape shape, int timestamp)
          Determines whether the specified actor collides with anything in the environment.
 boolean collides(int mask, Shape shape)
          Determines whether the specified shape collides with anything in the environment.
 boolean collides(int mask, Shape shape, int timestamp)
          Determines whether the specified shape collides with anything in the environment.
protected  ClientLiaison createClientLiaison(BodyObject bodyobj, CrowdSession session)
          Creates the client liaison for the specified body.
protected  void createEntryLogics(TudeySceneModel sceneModel)
          Creates logics for an entries that have them.
 Logic createLogic(String cname)
          Creates an instance of the logic object with the specified class name using the injector, logging a warning and returning null on error.
protected  PlaceObject createPlaceObject()
           
protected  void didShutdown()
           
protected  void didStartup()
           
static void dumpTickProfiles()
          Dumps the current set of tick profiles to the log.
 void enqueueInputReliable(ClientObject caller, int acknowledge, int smoothedTime, InputFrame[] frames)
          Handles a TudeySceneService.enqueueInputReliable(int, int, com.threerings.tudey.data.InputFrame[]) request.
 void enqueueInputUnreliable(ClientObject caller, int acknowledge, int smoothedTime, InputFrame[] frames)
          Handles a TudeySceneService.enqueueInputUnreliable(int, int, com.threerings.tudey.data.InputFrame[]) request.
 void enteredPlace(ClientObject caller)
          Handles a TudeySceneService.enteredPlace() request.
 void entryAdded(TudeySceneModel.Entry entry)
          Notes that an entry has been added to the scene.
 void entryRemoved(TudeySceneModel.Entry oentry)
          Notes that an entry has been removed from the scene.
 void entryUpdated(TudeySceneModel.Entry oentry, TudeySceneModel.Entry nentry)
          Notes that an entry has been updated within the scene.
 EffectLogic fireEffect(int timestamp, Logic target, Vector2f translation, float rotation, ConfigReference<EffectConfig> ref)
          Fires off an effect with the referenced configuration.
 EffectLogic fireEffect(int timestamp, Logic target, Vector2f translation, float rotation, String name)
          Fires off an effect at the with the named configuration.
 EffectLogic fireEffect(int timestamp, Logic target, Vector2f translation, float rotation, String name, String firstKey, Object firstValue, Object... otherArgs)
          Fires off an effect with the supplied name and arguments.
 ActorLogic getActorLogic(int id)
          Returns the logic object for the actor with the provided id, if any.
 HashSpace getActorSpace()
          Returns a reference to the actor space.
 int getBufferDelay()
          Returns the delay with which the clients display information received from the server in order to compensate for network jitter and dropped packets.
 ConfigManager getConfigManager()
          Returns a reference to the configuration manager for the scene.
 boolean getDebugRegions()
          Checks whether we should show region debug effects.
protected  Logic getDefaultEntrance(BodyObject body)
          Selects a default entrance for an entering player.
 Rect getDefaultLocalInterest()
          Returns the default untransformed area of interest region for clients.
 Effect[] getEffectsFired(PawnLogic target, Rect bounds)
          Returns an array containing all effects fired on the current tick whose influence regions intersect the provided bounds.
 EntryLogic getEntryLogic(Object key)
          Returns the logic object for the entry with the provided key, if any.
<L extends Logic>
List<L>
getInstances(Class<L> clazz)
          Returns the list of logic objects that are instances of the supplied class.
 boolean getIntersection(Ray2D ray, float length, int mask, int timestamp, Vector2f intersection)
          Determines the intersection point of this segment in the environment.
 Logic getLogic(EntityKey key)
          Returns the logic object for the entity with the provided key, if any.
 int getNextTimestamp()
          Returns the approximate timestamp of the next tick.
 Pathfinder getPathfinder()
          Returns a reference to the pathfinder object.
protected  ConfigReference<ActorConfig> getPawnConfig(BodyObject body)
          Returns a reference to the configuration to use for the specified body's pawn or null for none.
 boolean getPenetration(Actor actor, Shape shape, Vector2f result)
          Checks whether the actor is colliding with anything and, if it is, populates the provided object with the penetration vector (the minimum translation required to cancel the penetration).
 int getPreviousTimestamp()
          Returns the timestamp of the last tick.
 TudeySceneModel getSceneModel()
          Returns a reference to the scene model.
 HashSpace getSensorSpace()
          Returns a reference to the sensor space.
 Set<ActorLogic> getStaticActors()
          Returns a reference to the set of static actors.
 Set<ActorLogic> getStaticActorsAdded()
          Returns a reference to the set of static actors added on the current tick.
 Set<ActorLogic> getStaticActorsRemoved()
          Returns a reference to the set of static actors removed on the current tick.
 Set<ActorLogic> getStaticActorsUpdated()
          Returns a reference to the set of static actors updated on the current tick.
 List<Logic> getTagged(String tag)
          Returns the list of logic objects with the supplied tag.
 PawnLogic getTarget(ClientObject clobj)
          Returns a reference to the target of the specified client, if any.
 long getTickDuration()
          Returns the amount of time spent processing the last tick.
protected  SceneTicker getTicker()
          Returns the ticker with which to tick the scene.
 int getTickInterval()
          Returns the interval at which we call the tick() method.
static int getTickProfInterval()
          Returns the tick profile interval.
 int getTicksPerSecond()
          Returns the number of ticks per second.
 int getTimestamp()
          Returns the timestamp of the current tick.
 int getTransmitInterval()
          Returns the interval at which clients transmit their input frames.
 void getVisibleActors(PawnLogic target, Rect bounds, Collection<ActorLogic> results)
          Populates the supplied collection with references to all non-static actors visible to the specified target whose influence regions intersect the provided bounds.
protected  long idleTickPeriod()
          Returns the number of milliseconds to continue ticking when there are no occupants in the scene.
 boolean isDispatchThread()
           
 boolean isRunning()
           
static boolean isTickProfEnabled()
          Checks whether tick profiling is enabled.
 void mapEnteringBody(BodyObject body, Object portalKey)
          Notes that a body will be entering via the identified portal.
protected  void maybeAddDefaultEntrance(Logic logic)
          Adds a logic to the default entrance if it has been marked as such.
protected  void placeBecameEmpty()
           
 void postRunnable(Runnable runnable)
           
 void removeActorLogic(int id)
          Removes the logic mapping for the actor with the given id.
 void removeActorObserver(TudeySceneManager.ActorObserver observer)
          Removes an actor observer.
protected  void removeLogic(Object key)
          Removes the logic object for the specified scene entry, if any.
 void removeMappings(Logic logic)
          Remove the specified logic object from the mappings.
 void removeShutdownObserver(TudeySceneManager.ShutdownObserver observer)
          Removes a shutdown observer.
 void removeTickParticipant(TudeySceneManager.TickParticipant participant)
          Removes a participant from the tick list.
 void setCameraParams(ClientObject caller, CameraConfig config, float aspect)
          Handles a TudeySceneService.setCameraParams(com.threerings.tudey.config.CameraConfig, float) request.
 void setDefaultLocalInterest(Rect interest)
          Sets the default untransformed area of interest region for clients.
 void setTarget(ClientObject caller, int pawnId)
          Handles a TudeySceneService.setTarget(int) request.
static void setTickProfEnabled(boolean enabled)
          Enables or disables tick participant profiling.
static void setTickProfInterval(int interval)
          Sets the frequency at which we sample tick participants.
 ActorLogic spawnActor(int timestamp, Vector2f translation, float rotation, ConfigReference<ActorConfig> ref)
          Spawns an actor with the referenced configuration.
 ActorLogic spawnActor(int timestamp, Vector2f translation, float rotation, ConfigReference<ActorConfig> ref, Actor actor)
          Spawns an actor with the referenced configuration.
 ActorLogic spawnActor(int timestamp, Vector2f translation, float rotation, String name)
          Spawns an actor with the named configuration.
 ActorLogic spawnActor(int timestamp, Vector2f translation, float rotation, String name, String firstKey, Object firstValue, Object... otherArgs)
          Spawns an actor with the supplied name and arguments.
 void staticActorUpdated(ActorLogic logic)
          Notes that a static actor's state has changed.
 void submitActorRequest(ClientObject caller, int actorId, String name)
          Handles a TudeySceneService.submitActorRequest(int, java.lang.String) request.
 void submitEntryRequest(ClientObject caller, Object key, String name)
          Handles a TudeySceneService.submitEntryRequest(java.lang.Object, java.lang.String) request.
 void tick()
          Updates the scene.
 int triggerIntersectionSensors(int timestamp, ActorLogic actor)
          Triggers any intersection sensors intersecting the specified shape.
 int triggerSensors(Class<? extends TudeySceneManager.Sensor> type, int timestamp, Collection<Shape> shapes, int flags, ActorLogic actor)
          Triggers any sensors of the specified type intersecting the specified shape.
 int triggerSensors(Class<? extends TudeySceneManager.Sensor> type, int timestamp, Shape shape, int flags, ActorLogic actor)
          Triggers any sensors of the specified type intersecting the specified shape.
protected static void updateTickProfile(Object participant, long started)
          Updates the tick profile for the specified participant.
 
Methods inherited from class com.threerings.whirled.server.SceneManager
getLocation, getScene, getUpdates, gotSceneData, isPersistent, recordUpdate, setSceneData, toString, where
 
Methods inherited from class com.threerings.crowd.server.PlaceManager
addDelegate, addDispatcher, addOccupantInfo, addProvider, applyToDelegates, applyToOccupants, cancelShutdowner, checkPermissions, checkShutdownInterval, createSpeakHandler, didInit, getAccessController, getConfig, getPlaceObject, getPlaceObjectClass, idleUnloadPeriod, init, isValidSpeaker, messageReceived, permissionsFailed, ratifyBodyEntry, registerMessageHandler, shouldCreateSpeakService, shouldDeclareEmpty, shutdown, startup, toString, updateOccupantInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_injector

@Inject
protected com.google.inject.Injector _injector
The injector that we use to create and initialize our logic objects.


_clmgr

@Inject
protected ClientManager _clmgr
The client manager.


_tsobj

protected TudeySceneObject _tsobj
A casted reference to the Tudey scene object.


_cfgmgr

protected ConfigManager _cfgmgr
A reference to the scene model's configuration manager.


_ticker

protected SceneTicker _ticker
The ticker.


_lastTick

protected long _lastTick
The system time of the last tick.


_tickDuration

protected long _tickDuration
The duration of processing for the last tick.


_timestamp

protected int _timestamp
The timestamp of the current and previous ticks.


_previousTimestamp

protected int _previousTimestamp
The timestamp of the current and previous ticks.


_emptyTime

protected long _emptyTime
The time at which the last occupant left.


_lastActorId

protected int _lastActorId
The last actor id assigned.


_entering

protected HashIntMap<Object> _entering
Maps oids of entering bodies to the keys of the portals through which they're entering.


_clients

protected HashIntMap<ClientLiaison> _clients
Maps body oids to client liaisons.


_tickParticipants

protected ObserverList<TudeySceneManager.TickParticipant> _tickParticipants
The list of participants in the tick.


_ticking

protected boolean _ticking
Set when we're actually in the process of ticking.


_actorObservers

protected ObserverList<TudeySceneManager.ActorObserver> _actorObservers
The list of actor observers.


_shutdownObservers

protected ObserverList<TudeySceneManager.ShutdownObserver> _shutdownObservers
The list of shutdown observers.


_entries

protected HashMap<Object,EntryLogic> _entries
Scene entry logic objects mapped by key.


_actors

protected HashIntMap<ActorLogic> _actors
Actor logic objects mapped by id.


_staticActors

protected Set<ActorLogic> _staticActors
"Static" actors.


_tagged

protected HashMap<String,ArrayList<Logic>> _tagged
Maps tags to lists of logic objects with that tag.


_instances

protected HashMap<Class<?>,ArrayList<Logic>> _instances
Maps logic classes to lists of logic instances.


_defaultEntrances

protected ArrayList<Logic> _defaultEntrances
The logic objects corresponding to default entrances.


_actorSpace

protected HashSpace _actorSpace
The actor space. Used to find the actors within a client's area of interest.


_sensorSpace

protected HashSpace _sensorSpace
The sensor space. Used to detect mobile objects.


_pathfinder

protected Pathfinder _pathfinder
The pathfinder used for path computation.


_staticActorsAdded

protected Set<ActorLogic> _staticActorsAdded
The logic for static actors added on the current tick.


_staticActorsUpdated

protected Set<ActorLogic> _staticActorsUpdated
The logic for static actors updated on the current tick.


_staticActorsRemoved

protected Set<ActorLogic> _staticActorsRemoved
The logic for static actors removed on the current tick.


_effectsFired

protected ArrayList<EffectLogic> _effectsFired
The logic for effects fired on the current tick.


_runnables

protected List<Runnable> _runnables
Runnables enqueued for the next tick.


_defaultLocalInterest

protected Rect _defaultLocalInterest
The default local interest region.


_elements

protected ArrayList<SpaceElement> _elements
Holds collected elements during queries.


_effects

protected ArrayList<Effect> _effects
Holds collected effects during queries.


_runlist

protected List<Runnable> _runlist
Holds runnables during tick.


_tickOp

protected TudeySceneManager.TickOp _tickOp
Used to tick the participants.


_profileTickOp

protected TudeySceneManager.ProfileTickOp _profileTickOp
The tick op used when profiling.


_penetration

protected Vector2f _penetration
Stores penetration vector during queries.


_tickProfEnabled

protected static boolean _tickProfEnabled
Whether or not we're profiling tick participants.


_tickProfInterval

protected static int _tickProfInterval
The frequency at which we take tick samples.


_profiles

protected static Map<String,TudeySceneManager.TickProfile> _profiles
Used to profile our tick participants.


_tickParticipantCount

protected static long _tickParticipantCount
Incremented on each participant tick when profiling.


_shutdownOp

protected static final ObserverList.ObserverOp<TudeySceneManager.ShutdownObserver> _shutdownOp
Shutdown observer op.

Constructor Detail

TudeySceneManager

public TudeySceneManager()
Method Detail

setTickProfEnabled

public static void setTickProfEnabled(boolean enabled)
Enables or disables tick participant profiling.


isTickProfEnabled

public static boolean isTickProfEnabled()
Checks whether tick profiling is enabled.


setTickProfInterval

public static void setTickProfInterval(int interval)
Sets the frequency at which we sample tick participants.


getTickProfInterval

public static int getTickProfInterval()
Returns the tick profile interval.


dumpTickProfiles

public static void dumpTickProfiles()
Dumps the current set of tick profiles to the log.


clearTickProfiles

public static void clearTickProfiles()
Clears the current set of tick profiles.


getBufferDelay

public int getBufferDelay()
Returns the delay with which the clients display information received from the server in order to compensate for network jitter and dropped packets.


getTicksPerSecond

public int getTicksPerSecond()
Returns the number of ticks per second.


getTickInterval

public int getTickInterval()
Returns the interval at which we call the tick() method.


getTransmitInterval

public int getTransmitInterval()
Returns the interval at which clients transmit their input frames.


getConfigManager

public ConfigManager getConfigManager()
Returns a reference to the configuration manager for the scene.


addTickParticipant

public void addTickParticipant(TudeySceneManager.TickParticipant participant)
Adds a participant to notify at each tick.


addTickParticipant

public void addTickParticipant(TudeySceneManager.TickParticipant participant,
                               boolean withinTick)
Adds a participant to notify at each tick.

Parameters:
withinTick - if true and we are not currently in the process of ticking, adds the participant in the next tick.

removeTickParticipant

public void removeTickParticipant(TudeySceneManager.TickParticipant participant)
Removes a participant from the tick list.


addActorObserver

public void addActorObserver(TudeySceneManager.ActorObserver observer)
Adds an observer for actor events.


removeActorObserver

public void removeActorObserver(TudeySceneManager.ActorObserver observer)
Removes an actor observer.


addShutdownObserver

public void addShutdownObserver(TudeySceneManager.ShutdownObserver observer)
Adds a shutdown observer.


removeShutdownObserver

public void removeShutdownObserver(TudeySceneManager.ShutdownObserver observer)
Removes a shutdown observer.


getTimestamp

public int getTimestamp()
Returns the timestamp of the current tick.


getPreviousTimestamp

public int getPreviousTimestamp()
Returns the timestamp of the last tick.


getNextTimestamp

public int getNextTimestamp()
Returns the approximate timestamp of the next tick.


getTickDuration

public long getTickDuration()
Returns the amount of time spent processing the last tick.


getTagged

public List<Logic> getTagged(String tag)
Returns the list of logic objects with the supplied tag.


getInstances

public <L extends Logic> List<L> getInstances(Class<L> clazz)
Returns the list of logic objects that are instances of the supplied class.


getActorSpace

public HashSpace getActorSpace()
Returns a reference to the actor space.


getSensorSpace

public HashSpace getSensorSpace()
Returns a reference to the sensor space.


getPathfinder

public Pathfinder getPathfinder()
Returns a reference to the pathfinder object.


setDefaultLocalInterest

public void setDefaultLocalInterest(Rect interest)
Sets the default untransformed area of interest region for clients.


getDefaultLocalInterest

public Rect getDefaultLocalInterest()
Returns the default untransformed area of interest region for clients.


getDebugRegions

public boolean getDebugRegions()
Checks whether we should show region debug effects.


spawnActor

public ActorLogic spawnActor(int timestamp,
                             Vector2f translation,
                             float rotation,
                             String name)
Spawns an actor with the named configuration.


spawnActor

public ActorLogic spawnActor(int timestamp,
                             Vector2f translation,
                             float rotation,
                             String name,
                             String firstKey,
                             Object firstValue,
                             Object... otherArgs)
Spawns an actor with the supplied name and arguments.


spawnActor

public ActorLogic spawnActor(int timestamp,
                             Vector2f translation,
                             float rotation,
                             ConfigReference<ActorConfig> ref)
Spawns an actor with the referenced configuration.


spawnActor

public ActorLogic spawnActor(int timestamp,
                             Vector2f translation,
                             float rotation,
                             ConfigReference<ActorConfig> ref,
                             Actor actor)
Spawns an actor with the referenced configuration.

Parameters:
actor - if non-null, the already-created actor object.

fireEffect

public EffectLogic fireEffect(int timestamp,
                              Logic target,
                              Vector2f translation,
                              float rotation,
                              String name)
Fires off an effect at the with the named configuration.


fireEffect

public EffectLogic fireEffect(int timestamp,
                              Logic target,
                              Vector2f translation,
                              float rotation,
                              String name,
                              String firstKey,
                              Object firstValue,
                              Object... otherArgs)
Fires off an effect with the supplied name and arguments.


fireEffect

public EffectLogic fireEffect(int timestamp,
                              Logic target,
                              Vector2f translation,
                              float rotation,
                              ConfigReference<EffectConfig> ref)
Fires off an effect with the referenced configuration.


createLogic

public Logic createLogic(String cname)
Creates an instance of the logic object with the specified class name using the injector, logging a warning and returning null on error.


getLogic

public Logic getLogic(EntityKey key)
Returns the logic object for the entity with the provided key, if any.


getEntryLogic

public EntryLogic getEntryLogic(Object key)
Returns the logic object for the entry with the provided key, if any.


getActorLogic

public ActorLogic getActorLogic(int id)
Returns the logic object for the actor with the provided id, if any.


getVisibleActors

public void getVisibleActors(PawnLogic target,
                             Rect bounds,
                             Collection<ActorLogic> results)
Populates the supplied collection with references to all non-static actors visible to the specified target whose influence regions intersect the provided bounds.


getStaticActors

public Set<ActorLogic> getStaticActors()
Returns a reference to the set of static actors.


getStaticActorsAdded

public Set<ActorLogic> getStaticActorsAdded()
Returns a reference to the set of static actors added on the current tick.


getStaticActorsUpdated

public Set<ActorLogic> getStaticActorsUpdated()
Returns a reference to the set of static actors updated on the current tick.


getStaticActorsRemoved

public Set<ActorLogic> getStaticActorsRemoved()
Returns a reference to the set of static actors removed on the current tick.


getEffectsFired

public Effect[] getEffectsFired(PawnLogic target,
                                Rect bounds)
Returns an array containing all effects fired on the current tick whose influence regions intersect the provided bounds.


getTarget

public PawnLogic getTarget(ClientObject clobj)
Returns a reference to the target of the specified client, if any.


removeActorLogic

public void removeActorLogic(int id)
Removes the logic mapping for the actor with the given id.


triggerIntersectionSensors

public int triggerIntersectionSensors(int timestamp,
                                      ActorLogic actor)
Triggers any intersection sensors intersecting the specified shape.


triggerSensors

public int triggerSensors(Class<? extends TudeySceneManager.Sensor> type,
                          int timestamp,
                          Shape shape,
                          int flags,
                          ActorLogic actor)
Triggers any sensors of the specified type intersecting the specified shape.


triggerSensors

public int triggerSensors(Class<? extends TudeySceneManager.Sensor> type,
                          int timestamp,
                          Collection<Shape> shapes,
                          int flags,
                          ActorLogic actor)
Triggers any sensors of the specified type intersecting the specified shape.


collides

public boolean collides(ActorLogic logic)
Determines whether the specified actor collides with anything in the environment.


collides

public boolean collides(ActorLogic logic,
                        Shape shape)
Determines whether the specified actor collides with anything in the environment.


collides

public boolean collides(ActorLogic logic,
                        Shape shape,
                        int timestamp)
Determines whether the specified actor collides with anything in the environment.


collides

public boolean collides(Actor actor,
                        Shape shape,
                        int timestamp)
Determines whether the specified actor collides with anything in the environment.


collides

public boolean collides(int mask,
                        Shape shape)
Determines whether the specified shape collides with anything in the environment.


collides

public boolean collides(int mask,
                        Shape shape,
                        int timestamp)
Determines whether the specified shape collides with anything in the environment.


getIntersection

public boolean getIntersection(Ray2D ray,
                               float length,
                               int mask,
                               int timestamp,
                               Vector2f intersection)
Determines the intersection point of this segment in the environment.


staticActorUpdated

public void staticActorUpdated(ActorLogic logic)
Notes that a static actor's state has changed.


mapEnteringBody

public void mapEnteringBody(BodyObject body,
                            Object portalKey)
Notes that a body will be entering via the identified portal.


clearEnteringBody

public void clearEnteringBody(BodyObject body)
Clears out the mapping for an entering body.


bodyWillEnter

public void bodyWillEnter(BodyObject body)
Overrides:
bodyWillEnter in class PlaceManager

bodyWillLeave

public void bodyWillLeave(BodyObject body)
Overrides:
bodyWillLeave in class PlaceManager

enteredPlace

public void enteredPlace(ClientObject caller)
Description copied from interface: TudeySceneProvider
Handles a TudeySceneService.enteredPlace() request.

Specified by:
enteredPlace in interface TudeySceneProvider

enqueueInputReliable

public void enqueueInputReliable(ClientObject caller,
                                 int acknowledge,
                                 int smoothedTime,
                                 InputFrame[] frames)
Description copied from interface: TudeySceneProvider
Handles a TudeySceneService.enqueueInputReliable(int, int, com.threerings.tudey.data.InputFrame[]) request.

Specified by:
enqueueInputReliable in interface TudeySceneProvider

enqueueInputUnreliable

public void enqueueInputUnreliable(ClientObject caller,
                                   int acknowledge,
                                   int smoothedTime,
                                   InputFrame[] frames)
Description copied from interface: TudeySceneProvider
Handles a TudeySceneService.enqueueInputUnreliable(int, int, com.threerings.tudey.data.InputFrame[]) request.

Specified by:
enqueueInputUnreliable in interface TudeySceneProvider

setTarget

public void setTarget(ClientObject caller,
                      int pawnId)
Description copied from interface: TudeySceneProvider
Handles a TudeySceneService.setTarget(int) request.

Specified by:
setTarget in interface TudeySceneProvider

setCameraParams

public void setCameraParams(ClientObject caller,
                            CameraConfig config,
                            float aspect)
Description copied from interface: TudeySceneProvider
Handles a TudeySceneService.setCameraParams(com.threerings.tudey.config.CameraConfig, float) request.

Specified by:
setCameraParams in interface TudeySceneProvider

submitActorRequest

public void submitActorRequest(ClientObject caller,
                               int actorId,
                               String name)
Description copied from interface: TudeySceneProvider
Handles a TudeySceneService.submitActorRequest(int, java.lang.String) request.

Specified by:
submitActorRequest in interface TudeySceneProvider

submitEntryRequest

public void submitEntryRequest(ClientObject caller,
                               Object key,
                               String name)
Description copied from interface: TudeySceneProvider
Handles a TudeySceneService.submitEntryRequest(java.lang.Object, java.lang.String) request.

Specified by:
submitEntryRequest in interface TudeySceneProvider

entryAdded

public void entryAdded(TudeySceneModel.Entry entry)
Description copied from interface: TudeySceneModel.Observer
Notes that an entry has been added to the scene.

Specified by:
entryAdded in interface TudeySceneModel.Observer

entryUpdated

public void entryUpdated(TudeySceneModel.Entry oentry,
                         TudeySceneModel.Entry nentry)
Description copied from interface: TudeySceneModel.Observer
Notes that an entry has been updated within the scene.

Specified by:
entryUpdated in interface TudeySceneModel.Observer

entryRemoved

public void entryRemoved(TudeySceneModel.Entry oentry)
Description copied from interface: TudeySceneModel.Observer
Notes that an entry has been removed from the scene.

Specified by:
entryRemoved in interface TudeySceneModel.Observer

getSceneModel

public TudeySceneModel getSceneModel()
Description copied from interface: ActorAdvancer.Environment
Returns a reference to the scene model.

Specified by:
getSceneModel in interface ActorAdvancer.Environment

getPenetration

public boolean getPenetration(Actor actor,
                              Shape shape,
                              Vector2f result)
Description copied from interface: ActorAdvancer.Environment
Checks whether the actor is colliding with anything and, if it is, populates the provided object with the penetration vector (the minimum translation required to cancel the penetration).

Specified by:
getPenetration in interface ActorAdvancer.Environment
Returns:
true if a collision was detected (in which case the result vector will be populated), false otherwise.

collides

public boolean collides(Actor actor,
                        Shape shape)
Description copied from interface: ActorAdvancer.Environment
Checks whether the actor is colliding with anything.

Specified by:
collides in interface ActorAdvancer.Environment

postRunnable

public void postRunnable(Runnable runnable)
Specified by:
postRunnable in interface RunQueue

isDispatchThread

public boolean isDispatchThread()
Specified by:
isDispatchThread in interface RunQueue

isRunning

public boolean isRunning()
Specified by:
isRunning in interface RunQueue

createPlaceObject

protected PlaceObject createPlaceObject()
Overrides:
createPlaceObject in class PlaceManager

didStartup

protected void didStartup()
Overrides:
didStartup in class SceneManager

createEntryLogics

protected void createEntryLogics(TudeySceneModel sceneModel)
Creates logics for an entries that have them.


didShutdown

protected void didShutdown()
Overrides:
didShutdown in class SceneManager

bodyEntered

protected void bodyEntered(int bodyOid)
Overrides:
bodyEntered in class PlaceManager

bodyLeft

protected void bodyLeft(int bodyOid)
Overrides:
bodyLeft in class PlaceManager

placeBecameEmpty

protected void placeBecameEmpty()
Overrides:
placeBecameEmpty in class PlaceManager

bodyUpdated

protected void bodyUpdated(OccupantInfo info)
Overrides:
bodyUpdated in class PlaceManager

createClientLiaison

protected ClientLiaison createClientLiaison(BodyObject bodyobj,
                                            CrowdSession session)
Creates the client liaison for the specified body.


getDefaultEntrance

protected Logic getDefaultEntrance(BodyObject body)
Selects a default entrance for an entering player.

Returns:
the default entrance, or null if no such entrance is available.

maybeAddDefaultEntrance

protected void maybeAddDefaultEntrance(Logic logic)
Adds a logic to the default entrance if it has been marked as such.


addLogic

protected EntryLogic addLogic(TudeySceneModel.Entry entry,
                              boolean notify)
Adds the logic object for the specified scene entry, if any.

Parameters:
notify - whether or not to notify the logic that it has been added.

removeLogic

protected void removeLogic(Object key)
Removes the logic object for the specified scene entry, if any.


addMappings

public void addMappings(Logic logic)
Registers the specified logic object unders its mappings.


removeMappings

public void removeMappings(Logic logic)
Remove the specified logic object from the mappings.


tick

public void tick()
Updates the scene.


getPawnConfig

protected ConfigReference<ActorConfig> getPawnConfig(BodyObject body)
Returns a reference to the configuration to use for the specified body's pawn or null for none.


idleTickPeriod

protected long idleTickPeriod()
Returns the number of milliseconds to continue ticking when there are no occupants in the scene.


getTicker

protected SceneTicker getTicker()
Returns the ticker with which to tick the scene.


updateTickProfile

protected static void updateTickProfile(Object participant,
                                        long started)
Updates the tick profile for the specified participant.