Scripting Optimization Question

Steamio_Jaundazz
Fri, 08 Dec 2023 16:51:20 +0000
Programming & Scripting

Hey everyone, I have a question maybe y’all can help with.

*Ive currently got a grid based tactical game that spawns AI actors as attachments to each unit actor that requires AI

*The flow path is… the Unit actor (theres lots of these) waits its turn (float in seconds) and then calls an event that another blueprint sees (the combat system, which there is only one of) which tells the corresponding AI actor to use A-star pathfinding to decide where it should move on the grid (the grid is also its own blueprint)

*The issue is, once I reach about ~40 unit actors with attached AI doing this the game slows down.

My question is im sure theres a more performant way I can approach this, im pretty new to game development so im sure theres some way I could improve this. Let me know your thoughts!

P.S. I tried working this through with Behavior trees in unreal but because the grid is int index based and I cant blackboard those values it wasnt working out.

2 posts - 2 participants