Jump to content

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
Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...