Hi.
I am designing a game, where player assign jobs, and NPC is doing the work. At the moment this is all working properly, but there are small numbers of actor in game.
For example: I have around 50 NPC, doing trace (sphere), finding closest object(actor - around 100 of those for now, but i should end with over 600-700 at the end), move to that actor location, do some work, destroy actor, spawn something else in place of the actor, wait a bit more, destroy that spawned actor, update HUD, and then NPC returns to the starting position, doing new trace.
I use few delays, and I use actors for traceable objects.
When game starts, and NPC start working, game works more or less normally, but after 50-60 actors destroyed, game starts to lag, and lag is increasing over time. I am not quite sure why, but something does stack up.
“edit:Writing this gave me idea why game starts to lag…but question still stands.”
Question is: Is it possible to use foliage instead of actors, and trace out single closest foliage. If I can do that, then I can easily replace that singled out foliage with actor to do my other stuff. And would that be more efficient?
Thank you.