Kaim::World Class Reference

Kaim::World Class Reference

#include <world.h>

Class Description

Inherits Kaim::RefCountBaseNTS< C, Stat >.

Main API Functions

 World (KyUInt32 databaseCount=1)
 
virtual ~World ()
 
void SetUserData (void *userData)
 
void * GetUserData ()
 

Update

void Update (KyFloat32 simulationTimeInSeconds=0.016f)
 
KyUInt32 GetUpdateCount () const
 
WorldStatistics * GetWorldStatistics ()
 

VisualDebug

VisualDebugging is only enabled with KY_BUILD_DEBUG_and KY_BUILD_RELEASE With KY_BUILD_SHIPPING, functions related to VisualDebugging are replaced by empty inlined functions for convenience, However, it can still be judicious to guard your own code that uses VisualDebugging with a check against KY_BUILD_SHIPPING.

KyResult StartVisualDebug (const VisualDebugServerConfig &visualDebugServerConfig)
 
void StopVisualDebug ()
 
VisualDebugServerGetVisualDebugServer ()
 
VisualDebugRegistry * GetElementRegistry ()
 
DisplayListManagerGetDisplayListManager ()
 
VisualDebugAttributesManager * GetAttributesManager ()
 

WorldElement Getters

KyUInt32 GetDatabasesCount () const
 
DatabaseGetDatabase (KyUInt32 index)
 
KyUInt32 GetPointsOfInterestCount () const
 
PointOfInterestGetPointOfInterest (KyUInt32 index)
 
KyUInt32 GetCylinderObstaclesCount () const
 
CylinderObstacleGetCylinderObstacle (KyUInt32 index)
 
KyUInt32 GetBoxObstaclesCount () const
 
BoxObstacleGetBoxObstacle (KyUInt32 index)
 
KyUInt32 GetTagVolumesCount () const
 
KyUInt32 GetTagVolumesToBeIntegratedCount () const
 
KyUInt32 GetTagVolumesIntegratedCount () const
 
KyUInt32 GetTagVolumesToBeRemovedCount () const
 
TagVolumeGetTagVolumesToBeIntegrated (KyUInt32 index)
 
TagVolumeGetTagVolumesIntegrated (KyUInt32 index)
 
TagVolumeGetTagVolumesToBeRemoved (KyUInt32 index)
 
KyUInt32 GetQueryQueueArraysCount () const
 
QueryQueueArrayGetQueryQueueArray (KyUInt32 index)
 
KyUInt32 GetQueryPendingOperationCount () const
 

NavigationProfile

KyUInt32 AddNavigationProfile (Ptr< BaseNavigationProfile > navigationProfile)
 
Ptr< BaseNavigationProfileGetNavigationProfile (KyUInt32 profileId)
 

Async Queries

void SetAsyncQueryDispatcher (IAsyncQueryDispatcher *asyncQueryDispatcher)
 
IAsyncQueryDispatcherGetAsyncQueryDispatcher ()
 
void PushAsyncQuery (IQuery *query, AsyncQueryDispatchId asyncQueryDispatchId=AsyncQueryDispatchId_Default, Bot *bot=0)
 
void CancelAsyncQuery (IQuery *query)
 
void ProcessQueuesOutsideWorldUpdate ()
 
void SetWorldUpdateThreadId (ThreadId threadId)
 
ThreadId GetWorldUpdateThreadId () const
 

RemoveAll...

void RemoveAndCancellAll ()
 
void RemoveAllBots ()
 
void RemoveAllPointsOfInterest ()
 
void RemoveAllCylinderObstacles ()
 
void RemoveAllBoxObstacles ()
 
void RemoveAllTagVolumes ()
 
void ClearDatabase (KyUInt32 databaseIndex)
 

Specific optimization to the ShortcutTrajectory

Theses functions are only useful for bots with ShortcutTrajectory.

It allows to skip ProgressOnPath and ShortcutTrajectory computations that are usually done each frame.

Note that on some events the bot can be updated more often than the given number.

For instance, if changes occur on the Path or to be sure not to miss its current target.

KyUInt32 GetNumberOfFramesForShortcutTrajectoryPeriodicUpdate () const
 
void SetNumberOfFramesForShortcutTrajectoryPeriodicUpdate (KyUInt32 numberOfFrames)
 

For internal use only

void * m_userData
 
KyArray< Ptr< BaseNavigationProfile > > m_navigationProfiles
 
KyUInt32 m_updateCount
 
KyUInt32 m_nbFramesForShortcutTrajectoryPeriodicUpdate
 
KyUInt32 m_databaseCount
 
KyArray< Ptr< Database >, MemStat_WorldFwk > m_databases
 
Ptr< DatabaseBindingm_allDatabaseBinding
 
Ptr< CollisionWorldm_collisionWorld
 
TrackedCollection< Ptr< PointOfInterest >, MemStat_PointOfInterest > m_pointsOfInterests
 
TrackedCollection< Ptr< CylinderObstacle >, MemStat_CylinderObstacle > m_cylinderObstacles
 
TrackedCollection< Ptr< BoxObstacle >, MemStat_BoxObstacle > m_boxObstacles
 
TrackedCollection< Ptr< QueryQueueArray >, MemStat_QuerySystem > m_queryQueueArrays
 
TrackedCollection< Ptr< TagVolume >, MemStat_TagVolume > m_tagVolumesToBeIntegrated
 
TrackedCollection< Ptr< TagVolume >, MemStat_TagVolume > m_tagVolumesIntegrated
 
TrackedCollection< Ptr< TagVolume >, MemStat_TagVolume > m_tagVolumesToBeRemoved
 
WorldElementSpatializer * m_worldElementSpatializer
 
Ptr< BaseNavigationProfilem_defaultNavigationProfile
 
Ptr< BotConfigm_defaultPathFollowerConfig
 
VisualDebugServerConfig m_visualDebugServerConfig
 
VisualDebugServerm_visualDebugServer
 
bool m_wasConnected
 
DisplayListManagerm_displayListManager
 
VisualDebugRegistry * m_visualDebugRegistry
 
VisualDebugAttributesManager * m_visualDebugAttributesManager
 
WorldStatistics * m_statistics
 
DatabaseUpdateManager * m_databaseUpdateManager
 
AvoidanceWorkspace m_avoidanceWorkspace
 
Ptr< IAsyncQueryDispatcherm_asyncQueryDispatcher
 
bool m_isInWorldUpdate
 
ThreadId m_worldUpdateThreadId
 

Constructor & Destructor Documentation

Kaim::World::World ( KyUInt32  databaseCount = 1)
explicit
Parameters
databaseCountThe number of databases added to this world, must be greater than or equal to 1.

Member Function Documentation

KyUInt32 Kaim::World::AddNavigationProfile ( Ptr< BaseNavigationProfile navigationProfile)

If TraverseLogic of the NavigationProfile has obsolete functions, navigationProfile won't be added and AddNavigationProfile returns KyUInt32MAXVAL.

+ Examples:
VisualDebugAttributesManager * Kaim::World::GetAttributesManager ( )
inline

Get the attributesManager that is required when creating an attribute group.

BoxObstacle * Kaim::World::GetBoxObstacle ( KyUInt32  index)
inline
Precondition
index must be valid, we don't check it there.
CylinderObstacle * Kaim::World::GetCylinderObstacle ( KyUInt32  index)
inline
Precondition
index must be valid, we don't check it there.
DisplayListManager * Kaim::World::GetDisplayListManager ( )
inline

Get the DisplayListManager that is required when creating a ScopedDisplayList.

+ Examples:
VisualDebugRegistry * Kaim::World::GetElementRegistry ( )
inline

Returns the registry in this World of instances of WorldElement that can be visually debugged in Gameware Navigation Lab.

KyUInt32 Kaim::World::GetNumberOfFramesForShortcutTrajectoryPeriodicUpdate ( ) const
inline

Gives the number of frames between two updates of the PathFollowing for each bot.

PointOfInterest * Kaim::World::GetPointOfInterest ( KyUInt32  index)
inline
Precondition
index must be valid, we don't check it there.
QueryQueueArray * Kaim::World::GetQueryQueueArray ( KyUInt32  index)
inline
Precondition
index must be valid, we don't check it there.
TagVolume * Kaim::World::GetTagVolumesIntegrated ( KyUInt32  index)
inline
Precondition
index must be valid, we don't check it there.
TagVolume * Kaim::World::GetTagVolumesToBeIntegrated ( KyUInt32  index)
inline
Precondition
index must be valid, we don't check it there.
TagVolume * Kaim::World::GetTagVolumesToBeRemoved ( KyUInt32  index)
inline
Precondition
index must be valid, we don't check it there.
KyUInt32 Kaim::World::GetUpdateCount ( ) const
inline

Retrieves the number of times Update() has been called.

WorldStatistics * Kaim::World::GetWorldStatistics ( )
inline

Returns statistics on CPU consumption during Update() and its steps.

With KY_BUILD_SHIPPING, it returns KY_NULL;

void Kaim::World::PushAsyncQuery ( IQuery query,
AsyncQueryDispatchId  asyncQueryDispatchId = AsyncQueryDispatchId_Default,
Bot bot = 0 
)

Pushes an IQuery in the right QueryQueue accordingly to World's IAsyncQueryDispatcher.

void Kaim::World::RemoveAndCancellAll ( )

Remove all Bots, PointOfInterest, CylinderObstacles, BoxObstacles, TagVolumes, and NavData; and cancel all queries.

void Kaim::World::SetAsyncQueryDispatcher ( IAsyncQueryDispatcher asyncQueryDispatcher)

Set a new IAsyncQueryDispatcher instance to be used by this World:

void Kaim::World::SetNumberOfFramesForShortcutTrajectoryPeriodicUpdate ( KyUInt32  numberOfFrames)
inline

Set the number of frames between two updates of the PathFollowing for all bots with TrajectoryMode_Shortcut.

Default value is 1 in order to get an update each frame.

If 0 is passed, it is defaulted to 1.

For instance, by setting a value of 5, UpdateBotPathFollowing will call the ProgressOnPathComputer and the Trajectory one frame on 5, this will make UpdateBotPathFollowing being around 3 times faster since the number of RayCanGo used to maintained the TargetOnPathStatus is exactly divided by 5, but some other components are already skipping some frames, hence their cost is not divided by 5.

KyResult Kaim::World::StartVisualDebug ( const VisualDebugServerConfig visualDebugServerConfig)

Starts the visual debug server. You can start it at any time.

+ Examples:
void Kaim::World::Update ( KyFloat32  simulationTimeInSeconds = 0.016f)

Updates the World.

It is possible to use Gameware Navigation as a NavMesh/NavGraph Query toolbox without calling World::Update(). But to easily support Bots, obstacles, DynamicNavMesh, etc., a World::Update() call is required every frame.

+ Examples:

The documentation for this class was generated from the following file: