Let’s assume i have 1000 enemies in one map, yet the maximum number of characters on screen is 50.
The game can be saved at any time.
- I’m thinking this is my best option:
- BP_SpawnEnemy generates BP_EnemyData on initial level load.
- BP_EnemyData spawns BP_Enemy when the player enters a specified range.
- BP_Enemy updates BP_EnemyData when the player leaves a specified range. Then BP_Enemy gets deleted.
- A control script has a list of all 1000+ BP_EnemyData instances, range-checking 20 every tick.
- SaveGames will convert between BP_EnemyData and BP_EnemySaveGameData.
As I dont know if the following **assumptions **are correct, other options might be:
2. Don’t use BP_EnemyData. Spawn 1000 BP_Enemy directly. Let the engine handle it. Disable tick & ai of BP_Enemy when out of range, the rest is already covered by the engine. (Animations, Physics). This will produce negligible overhead from sleeping characters.
3. Don’t use BP_EnemyData. Let the engine handle it, use smaller (or larger) levels, because UE4 can only handle up to X sleeping actors with negligible overhead.
4. Use BP_EnemyData, but work with triggers and individual spawn areas, because having 1000+ actors in a list to range-check 10 every tick is a bad idea. Use physics/triggers for that.
I’m looking for advice and clarification.