Instantiate a few hundred arenas?

ok currently i am working on a pokemon like game

i did set up the arena gameobject which can have different versions
grassarena
forestarena
ā€¦

I plan to have a few hundred NPCs running around like a playerobject with their own goals and daily schedule.

right now i think about how to initialize the arena in a good way performance wise
a npc can battle other npcs or find a monster inside the grass and have his own instance

so currently a BattleEvent collects all data around the battle itself but if a human player wants to spectate a npc he can watch the battle so i need to:

  • create a copy of the arena (for example copy ā†’ grassarena)

  • fill in all the BattleEvent Data

  • and let the npc run through them

  • destroy the copy at the end and save the BattleEvent results

since the games focus point is to simulate a pokemon like world with a few hundred npcs in intensive times about 100 arenas could be created in the same minute
which could be performance-wise difficult to handle since the arena gameobject has a full ui about everything monster battle related content so people can watch it

i dont really want to emulate battles but have the npc actually do them
so i am looking for ideas on how to do it in a better way then the one I currently have in mind

currently thinking about it

i could count the existing npcs at the start use this as refrence and create lik 1/4 copys for each arena mark them with a bool as in use and only instantiate new ones when every existing arena is in use

only destroy overhead
for my scaling this probably works good enough

example:
at gamestart i add 500 npc to the world so i would create 125 arena objects which i only overwrite when they are free
if for some reason 130 arenas are needed 5 would be instantiated and terminated at the end of the event

so try using a free arena else create a own one

1 Like