Asset data management

Added functions to AssetManager to pack/unpack assets using an id hash instead of their id string this cuts down how much data is sent across the network for assets

All asset macros updated to use this new functionality.
This commit is contained in:
marauder2k7 2025-12-09 10:04:33 +00:00
parent 563c0266e4
commit 74638c0f2c
4 changed files with 115 additions and 173 deletions

View file

@ -59,6 +59,10 @@
#include "assets/assetFieldTypes.h"
#endif
#ifndef _NETCONNECTION_H_
#include "sim/netConnection.h"
#endif
// Debug Profiling.
#include "platform/profiler.h"
@ -84,6 +88,11 @@ public:
typedef HashTable<typeAssetId, typeAssetId> typeAssetIsDependedOnHash;
typedef HashMap<AssetPtrBase*, AssetPtrCallback*> typeAssetPtrRefreshHash;
// ASSET NETWORK PACK
typedef U32 typeAssetNetId;
typedef HashMap<typeAssetNetId, typeAssetId> typeNetIdToAssetMap;
typedef HashMap<typeAssetId, typeAssetNetId> typeAssetToNetIdMap;
// ASSET NETWORK PACK END
private:
/// Declared assets.
typeDeclaredAssetsHash mDeclaredAssets;
@ -91,6 +100,11 @@ private:
/// Referenced assets.
typeReferencedAssetsHash mReferencedAssets;
// ASSET NETWORK PACK
typeNetIdToAssetMap mNetIdToAsset;
typeAssetToNetIdMap mAssetToNetId;
// ASSET NETWORK PACK END
/// Asset dependencies.
typeAssetDependsOnHash mAssetDependsOn;
typeAssetIsDependedOnHash mAssetIsDependedOn;
@ -151,6 +165,14 @@ public:
bool isReferencedAsset( const char* pAssetId );
bool renameReferencedAsset( const char* pAssetIdFrom, const char* pAssetIdTo );
// ASSET NETWORK PACK
void packDataAsset(BitStream* stream, const char* pAssetId);
const char* unpackDataAsset(BitStream* stream);
void packUpdateAsset(NetConnection* con, U32 mask, BitStream* stream, const char* pAssetId);
const char* unpackUpdateAsset(NetConnection* con, BitStream* stream);
// ASSET NETWORK PACK END
/// <summary>
/// Compile all assets.
/// </summary>