Hello fellow space explorers,
I am currently working on a Meteor driven game. So far I have got most of the basics for the single player part. I wanted to have your thoughts about how to manage/setup my application so it can easily handle an AI ecosystem.
To put it simple, there will be multiple “actors” that will need to take different decisions at different times. Here’s a basic example:
Actor1 decides to go to the store to buy fruits.
(actor takes time to go to the store)
Actor1 buys the fruits, and goes home
(actor takes time to go home)
Actor1 puts the fruits in the fridge
I have thought of handling this as follows:
Each actor is in a collection (which might differ according to its type)
There is a decision queue collection that stores the actor’s ID and the time expected for it to need to decide something.
I use an autorun on that collection to grab all decisions that need to be taken and trigger the “take decision” event which they are listening to.
The decision is taken and a new decision is added to the queue at the time the task is expected to end.
If the user tries to rob the actor, the event is triggered to make it react.
By using events, I expect to make it run smoother by having all the actor instances up instead of fetching their whole identity and behaviors every time they need to react. But that will also take more and more memory as the world expends, or the players amount increases. So I am expecting to have to spawn multiple instances of the application (maybe I could sepperate AI and Front completely…) but how would someone go in managing the instance of each actors throughout the Cluster?
Has someone already faced this kind of problematic? The AI by itself should not be very heavy for one actor, but the actors count might get in the hundred thousands easily…
Thank you for your thoughts.