A quick heads-up to inform you that this project is not dead yet
I've been working on a more high-level crowd manager to make it possible to render large crowds in big scenes.
The key to making this happen is paging the crowd. With that I mean only loading crowd agents in areas that are close to the camera, ea that can be seen.
This is much like the technique used in games as GTA or Assassin's Creed.
I still have to decide the final architecture, but the goal is to make the crowd manager a separate component that can be instantiated around the existing recast components, to allow maximal flexibility and make it an optional component. I also intend to make its behaviour customizable by means of strategy classes that can be plugged in.
Enough rant, these are some screens of the very first working demo:

- Early test: x-y coordinate pairs are navmesh tiles, red square is area currently loaded with a crowd. Crowd distribution is 1 agent per tile. Blue cylinders are agents.
- screenshot09032012_234918255.jpg (72.11 KiB) Viewed 39447 times

- Red wall indicates the end of the paged area
- screenshot09032012_234943409.jpg (40.91 KiB) Viewed 39447 times
The screens are minimalistic and small-scale, but a good way to test and debug the system.
It also works well with more agents

- screenshot09042012_000851099.jpg (74.34 KiB) Viewed 39447 times
The demo currently pages agents in 9 tiles around the camera position. This number can be increased, with a 25 tiles 5x5 grid being the next option up (how the amount of tiles and border cells goes up is an interesting formula

). The number of border tiles (tiles on the outer border of the paged area) is an important metric because it's there that new agents get added if the camera moves and the area slides to a new set of tiles.
Agents that walk out of the paged area will also be put in a new random location within one of the border tiles.
The idea is to make agents appear and dissappear as far away from the camera as possible, there where the viewer is least likely to notice it (an improvement on this technique could be to only shuffle things around outside of the camera view frustum).
So, there you go. What do you think? Suggestions, comments, experience you want to share, feature requests? Let me hear them!
My current roadmap is as follows:
- Make crowd
distributions configurable (currently only uniform distribution per tile)
- Add the notion of
spawn portals (this is a way to control distribution, by means of a population density property)
- Incorporate a
waypointing system to control the flow of traffic (instead of aimless wandering around)
- Add
interaction triggers with activation conditions like in behaviour trees. Eg. a bench trigger, when an agent walks by, there is a 20% chance that it will sit down, things like mutual exclusion (only one agent can enter), or queueing of multiple agents. This is a great way to add interaction to your world. This can be expanded with things like drawing money from ATM machines, buying something at market stalls, entering doors, looking through shop windows or interaction with other agents such as stopping and engaging in a conversation. Global action triggers are also possible, for example stopping and answering a cell phone call. Finally it should be possible to add action triggers dynamically, for example an explosion or gunshots should alert all agents in the vicinity, making them switch to panic mode and flee the scene. Other agents could be alerted when they see others fleeing, and flee as well, ...
- Not really crowd paging specific: add convenience functions to prune navmesh polygons not reachable from any waypoint to avoid spawning of agents in unreachable areas or imprison them in confined spaces (so that you don't need to edit out the unreachable parts manually).
- Apply instancing and hardware skinning to animated characters
- Scale the demo, make it more interesting
- Pair crowd paging with navmesh paging on large terrains (integration with the new paging terrain)
I'm first working on features I need immediately in one of my own applications. Then there is room for improvement after the deadline
