Jump to content
lilinitsy

Better Crowd Simulation - Where to look in the codebase?

Recommended Posts

Hello, all. I'm new to 0. A.D. and interested in contributing. Mainly, the crowd simulation and the way that units move by default without a formulation and the way they bunch at one location is quite unrealistic. This can be solved with the pretty heavily researched topic of crowd simulation. I've implemented Boids crowd simulation (a pretty basic one that looks reasonably good) before and would probably like to reimplement it for 0. A.D (https://pdfs.semanticscholar.org/4183/faeef708a56b988742b5572fce9174caec7b.pdf). The codebase is pretty massive, and I've noticed that there is a lot of somewhat relevant AI code in source/simulation2/components. I'm mostly wondering if anyone can point me more specifically to where I'd look to begin modifying how units move and adding some better crowd simulation.

  • Like 2

Share this post


Link to post
Share on other sites

I made a mod with better unit behavior, regarding chasing, attacking and capturing. But no AI is used, but for example some randomness. But i think formation is the best way to go, it has several advandages: like better to micro, looks nicer, more tactical and less cost of pathfinding. U can look at my modhttps://0ad.mod.io/formation-fighting-mod. And look mostly on UnitAI.js.    

  • Like 1

Share this post


Link to post
Share on other sites

Hey, Gaius, nice mod!  I skimmed it - it's a lot of JS, which I don't know very well - and it's cool. You should make a display video if you want to show off the differences between your mod and the standard.

I'm mostly interested in making the clustering / flocking behaviour without a formation more realistic, disregarding improving other aspects for now. In a strict implementation, I shouldn't have to actually end up modifying the costs of pathfinding though. Many more advanced crowd simulations are either based on a spring-force type model, or a velocity space model, and the path doesn't exactly change. The units will move a little differently, but their goal will be to move along the path, while the crowd simulation aspects (forces, velocity spaces, etc.) will keep them very slightly offset from the path. It should result in a better looking group movement without a formation.

  • Like 4

Share this post


Link to post
Share on other sites
1 hour ago, Lion.Kanzen said:

You wanna say @wraitii.

4 hours ago, lilinitsy said:

I'm mostly wondering if anyone can point me more specifically to where I'd look to begin modifying how units move and adding some better crowd simulation.

0 A.D. doesn't have the crowd simulation, only a path finder for short and long paths. You can find it in source/simulation2/, files that contains the "path" word in their names. There are also UnitAI and UnitMotion components.

  • Like 1

Share this post


Link to post
Share on other sites
Just now, vladislavbelov said:

You wanna say @wraitii.

0 A.D. doesn't have the crowd simulation, only a path finder for short and long paths. You can find it in source/simulation2/, files that contains the "path" word in their names. There are also UnitAI and UnitMotion components.

is rare see him in forums... so i trying some more regular.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×