31 class DatabaseBinding;
32 class WorldElementSpatializer;
33 class PointOfInterest;
34 class CylinderObstacle;
41 class IAvoidanceComputer;
42 class QueryQueueArray;
44 class AsyncQueryDispatcher;
45 class DatabaseUpdateManager;
46 class VisualDebugAttributesManager;
47 class BaseNavigationProfile;
52 class World :
public RefCountBaseNTS<World, MemStat_WorldFwk>
63 void SetUserData(
void* userData);
80 #if defined(KY_CONFIG_DEBUG_OR_DEV)
81 WorldStatistics* GetWorldStatistics();
91 void StopVisualDebug();
94 VisualDebugServer* GetVisualDebugServer();
112 KyUInt32 GetPointsOfInterestCount()
const;
115 KyUInt32 GetCylinderObstaclesCount()
const;
118 KyUInt32 GetBoxObstaclesCount()
const;
121 KyUInt32 GetTagVolumesCount()
const;
122 KyUInt32 GetTagVolumesToBeIntegratedCount()
const;
123 KyUInt32 GetTagVolumesIntegratedCount()
const;
124 KyUInt32 GetTagVolumesToBeRemovedCount()
const;
129 KyUInt32 GetQueryQueueArraysCount()
const;
132 KyUInt32 GetQueryPendingOperationCount()
const;
136 KyUInt32 AddNavigationProfile(Ptr<BaseNavigationProfile> navigationProfile);
137 Ptr<BaseNavigationProfile> GetNavigationProfile(
KyUInt32 profileId);
158 void ProcessQueuesOutsideWorldUpdate();
160 void SetWorldUpdateThreadId(ThreadId threadId);
161 ThreadId GetWorldUpdateThreadId()
const;
169 void RemoveAllBots();
170 void RemoveAllPointsOfInterest();
171 void RemoveAllCylinderObstacles();
172 void RemoveAllBoxObstacles();
173 void RemoveAllTagVolumes();
176 void ClearDatabase(
KyUInt32 databaseIndex);
205 void FlushCommandsInWorldUpdate();
206 void ProcessQueuesInWorldUpdate();
208 void UpdateDatabases();
209 void UpdateSpatializations();
210 void UpdateBotsPathFollowing(
KyFloat32 simulationTimeInSeconds);
211 void SendVisualDebugData(
KyFloat32 simulationTimeInSeconds);
212 void UpdateStatistics(
KyFloat32 worldUpdateMs);
213 void FlushCommandsOutOfWorldUpdate();
216 void CancelAllQueriesAndClearCommandsInAllQueryQueueArray();
217 void ClearAllDatabases();
227 KyUInt32 m_nbFramesForShortcutTrajectoryPeriodicUpdate;
232 Ptr<DatabaseBinding> m_allDatabaseBinding;
235 Ptr<CollisionWorld> m_collisionWorld;
249 WorldElementSpatializer* m_worldElementSpatializer;
252 Ptr<BaseNavigationProfile> m_defaultNavigationProfile;
253 Ptr<BotConfig> m_defaultPathFollowerConfig;
257 VisualDebugServer* m_visualDebugServer;
260 VisualDebugRegistry* m_visualDebugRegistry;
261 VisualDebugAttributesManager* m_visualDebugAttributesManager;
264 WorldStatistics* m_statistics;
266 DatabaseUpdateManager* m_databaseUpdateManager;
272 Ptr<IAsyncQueryDispatcher> m_asyncQueryDispatcher;
273 bool m_isInWorldUpdate;
274 ThreadId m_worldUpdateThreadId;
277 KY_INLINE
void World::SetUserData(
void* userData) { m_userData = userData; }
278 KY_INLINE
void* World::GetUserData() {
return m_userData; }
282 #if defined(KY_CONFIG_DEBUG_OR_DEV)
283 KY_INLINE WorldStatistics* World::GetWorldStatistics() {
return m_statistics; }
286 KY_INLINE
KyUInt32 World::GetDatabasesCount()
const {
return m_databases.GetCount(); }
289 KY_INLINE
KyUInt32 World::GetPointsOfInterestCount()
const {
return m_pointsOfInterests.GetCount(); }
292 KY_INLINE
KyUInt32 World::GetCylinderObstaclesCount()
const {
return m_cylinderObstacles.GetCount(); }
295 KY_INLINE
KyUInt32 World::GetBoxObstaclesCount()
const {
return m_boxObstacles.GetCount(); }
298 KY_INLINE
KyUInt32 World::GetTagVolumesCount()
const
300 return m_tagVolumesToBeIntegrated.GetCount() + m_tagVolumesIntegrated.GetCount() + m_tagVolumesToBeRemoved.GetCount();
302 KY_INLINE
KyUInt32 World::GetTagVolumesToBeIntegratedCount()
const {
return m_tagVolumesToBeIntegrated.GetCount(); }
303 KY_INLINE
KyUInt32 World::GetTagVolumesIntegratedCount()
const {
return m_tagVolumesIntegrated.GetCount(); }
304 KY_INLINE
KyUInt32 World::GetTagVolumesToBeRemovedCount()
const {
return m_tagVolumesToBeRemoved.GetCount(); }
309 KY_INLINE
KyUInt32 World::GetQueryQueueArraysCount()
const {
return m_queryQueueArrays.GetCount(); }
314 KY_INLINE
void World::SetWorldUpdateThreadId(ThreadId threadId) { m_worldUpdateThreadId = threadId; }
315 KY_INLINE ThreadId World::GetWorldUpdateThreadId()
const {
return m_worldUpdateThreadId; }
320 KY_INLINE
void World::NewVisualDebugFrame(
KyUInt32 gameFrameIndex) {
if (m_visualDebugServer) m_visualDebugServer->NewFrame(gameFrameIndex); }
321 KY_INLINE VisualDebugServer* World::GetVisualDebugServer() {
return m_visualDebugServer; }
326 #ifdef KY_CONFIG_RELEASE
328 KY_INLINE
void World::StopVisualDebug() {}
AvoidanceWorkspace aggregates at once:
Definition: avoidanceworkspace.h:34
void RemoveAndCancellAll()
Remove all Bots, PointOfInterest, CylinderObstacles, BoxObstacles, TagVolumes, and NavData; and cance...
Definition: world.cpp:114
CylinderObstacles represent dynamic objects of your game engine that prevent your Bots from moving fr...
Definition: cylinderobstacle.h:76
This class is the world element that represent an active character in Autodesk Navigation.
Definition: bot.h:128
AsyncQueryDispatchId
Typically there is one QueryQueue for each AsyncQueryDispatchId.
Definition: asyncquerydispatcher.h:21
Game side: Manages all DisplayListData, send them to the NavigationLab.
Definition: displaylist.h:375
KyUInt32 GetUpdateCount() const
Retrieves the number of times Update() has been called.
Definition: world.h:280
Database * GetDatabase(KyUInt32 index)
Definition: world.h:287
void SetNumberOfFramesForShortcutTrajectoryPeriodicUpdate(KyUInt32 numberOfFrames)
Set the number of frames between two updates of the PathFollowing for all bots with TrajectoryMode_Sh...
Definition: world.h:318
void PushAsyncQuery(IQuery *query, AsyncQueryDispatchId asyncQueryDispatchId=AsyncQueryDispatchId_Default, Bot *bot=nullptr)
Pushes an IQuery in the right QueryQueue accordingly to World's IAsyncQueryDispatcher.
Definition: world.cpp:437
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
QueryQueueArray * GetQueryQueueArray(KyUInt32 index)
Definition: world.h:310
QueryQueueArray processes queries in an asynchronous, time-sliced way.
Definition: queryqueuearray.h:31
TagVolume * GetTagVolumesToBeRemoved(KyUInt32 index)
Definition: world.h:307
VisualDebugAttributesManager * GetAttributesManager()
Get the attributesManager that is required when creating an attribute group.
Definition: world.h:324
General purpose array for movable objects that require explicit construction/destruction.
Definition: kyarray.h:162
TrackedCollection is a class which is a "Collection" of T=C* or T = Ptr< c="" /> (not sorted...
Definition: collection.h:77
KyResult StartVisualDebug(const VisualDebugServerConfig &visualDebugServerConfig)
VisualDebugging is only enabled with KY_CONFIG_DEBUG and KY_CONFIG_DEV With KY_CONFIG_RELEASE, 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_CONFIG_RELEASE.
void SetAsyncQueryDispatcher(IAsyncQueryDispatcher *asyncQueryDispatcher)
Set a new IAsyncQueryDispatcher instance to be used by this World:
Definition: world.cpp:424
void Update(KyFloat32 simulationTimeInSeconds=0.016f)
Updates the World.
Definition: world.cpp:152
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:196
This class is a runtime container for Autodesk Navigation WorldElements such as NavData, Bots, BoxObstacles, TagVolumes...
Definition: world.h:52
TagVolume * GetTagVolumesToBeIntegrated(KyUInt32 index)
Definition: world.h:305
This class represents runtime-defined volumes with customized NavTag.
Definition: tagvolume.h:119
Configure the VisualDebugServer.
Definition: visualdebugserver.h:46
This class is a runtime container for all NavData that represents the world from the point of view of...
Definition: database.h:57
void ForceClearWorkingMemory()
Cancel all queries and only free WorkingMemory for all databases and query queues owned by this world...
Definition: world.cpp:126
BoxObstacle * GetBoxObstacle(KyUInt32 index)
Definition: world.h:296
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
#define KY_ERROR
use result == KY_ERROR to test for error
Definition: types.h:132
PointOfInterest * GetPointOfInterest(KyUInt32 index)
Definition: world.h:290
World::PushAsyncQuery(IQuery* query) pushes the Query in the QueryQueue.
Definition: asyncquerydispatcher.h:41
KyUInt32 GetNumberOfFramesForShortcutTrajectoryPeriodicUpdate() const
Theses functions are only useful for bots with ShortcutTrajectory.
Definition: world.h:317
PointOfInterest is a tagged position spatialized into the NavMesh.
Definition: pointofinterest.h:71
DisplayListManager * GetDisplayListManager()
Get the DisplayListManager that is required when creating a DisplayList.
Definition: world.h:323
void CancelAsyncQuery(IQuery *query)
This function should be called only for queries currently in a query queue which can be checked by ca...
Definition: world.cpp:452
Each instance of the BoxObstacle class represents a dynamic, physical object in your game engine that...
Definition: boxobstacle.h:127
VisualDebugRegistry * GetElementRegistry()
Returns the registry in this World of instances of WorldElement that can be visually debugged in the ...
Definition: world.h:322
TagVolume * GetTagVolumesIntegrated(KyUInt32 index)
Definition: world.h:306
#define KyUInt32MAXVAL
KyUInt32 max value
Definition: types.h:68
CylinderObstacle * GetCylinderObstacle(KyUInt32 index)
Definition: world.h:293
Abstract class for all queries.
Definition: iquery.h:123
float KyFloat32
float
Definition: types.h:32