Just wanted to post here and give a big "Thank you" to Richard for this and all of the works he's shared in the past. I remember when you mentioned this AI stuff in a post a while back ( might have been the old GG boards ) and I've studied the scripts a lot since then. I've built other systems with Managers and so on based off of the concepts put in place here - using a 'Manager' to add/remove objects or even entire new SimGroups!
In case you've forgotten the details, one of the best additions you made was the 'throttling' of AI think routines based on the AI's proximity to Players. Basically making the AI call a think() function but only when Players were near enough. Otherwise, it could go into a 'sleep' mode and not waste any precious resources thinking about nothing =) The biggest thing here is the 'when Players are near enough'
bit. It's been awhile since I've looked at that stuff, but I think what needs to happen is this:
- Server keeps a list of SpawnSpheres.
- If a Player gets within range of a SpawnSphere, set an 'awake' flag to true on the SpawnSphere.
- Have a ScriptTickObject( or something similar, anything that 'ticks' ) that constantly runs a function iterating the list of SpawnSpheres searching for 'awake' flags. For each one that's awake, activate the think() routine for the spawned AI belonging to that SpawnSphere. Could have an early out in the function so it won't do the iterations if none are awake( or even not run the function in the first place ).
Just thinking out loud but that's a direction I was looking into going soon.
In my current project, I am VERY near to setting up AI spawnGroups, think functions, and so on. I will be revisiting this stuff and use it much as a reference guide while building the map's AI. It is likely that I could end up porting those Managers you speak of and if that happens I will definitely let you know =) I do agree that with the Sim lookups going on it could be in the best interest of the resource.
For my goals the largest obstacle is figuring out how to approach the adding/removing of the AI units as Players travel across the rather large map. Currently I plan to use the actual Manager object already in Torque ( the one that fires off NetEvents ) that will activate SpawnSpheres - all based on distance from the Player object. Maybe it'll work, maybe it won't?