In the mod I'm currently working on, I have 1000+ actors in my map, most of which are spawners for either cars or pedestrians. Over the course of development, the car actors and pedestrian actors became more and more advanced, and the map got bigger and bigger. I initially just limited the range where these objects can spawn in, but then I limited the amount of objects that can be spawned, and their distance to eachother. The problem is, I have basically ran out of ways to squeeze any more performance using this system, as the large amount of spawner actors has started to destroy the performance of the game.
This is my code for the spawner:
Code: Select all
actor TrafficCarSpawner 11801
{
States
{
Spawn:
stop
TNT1 A random(10,30) nodelay A_CheckSight("SpawnCar")
loop
SpawnCar:
TNT1 A 1
TNT1 A 0 A_CheckProximity("Spawn","TrafficCar",10000, GetCVar("t3_vehicle_density"))
TNT1 A 0 A_CheckProximity("Spawn","TrafficCar",256)
TNT1 A 0 A_CheckRange(GetCVar("t3_cull_distance"), "Spawn", True)
TNT1 A 200 A_SpawnItem("TrafficCar")
goto Spawn
}
}
I'm contemplating replacing the large amount of actors with an ACS array, which might improve performance.
EDIT: The function A_CheckSight is rather expensive on processing power and caused all the slowdown here.