Git Product home page Git Product logo

crowdsimulation's Introduction

CrowdSimulation

I used Processing to simulate multiple agents navigating an obstacle-filled environment using A* search on a graph of networks created through probabilistic roadmap (PRM).

Demos

Press space to start simulation and mouse left click to assign a singular goal for multiple agents Press space to pause the simulation, mouse right click to remove and add obstacles, and r key to recreate the environment
part1 part2

Commands

Users can interact with our simulation in a variety of ways"

  • Space bar - freeze/unfreeze. Agents will remain in place until the space bar is pressed
  • 'r' key - reset simulation, new obstacles, agents, and paths will be spawned
  • Mouse left click - reassign goal position. If multiple agents are in the scene, all agents will now move towards this goal.
  • Mouse right click - Add/remove obstacles. If an existing obstacle is clicked, it will be removed. Otherwise, a new obstacle will be added. Simulation must be paused when editing obstacles.

Challenges

One challenge I had for the PRM/A* implementation was the crowd simulation. Dubbed the "Beyblade Phenomenon", the spaceships would take the same edge or go towards the same PRM node in a relatively similar slope. As a result, the TTC forces would be large in magnitude and point in opposite, parallel directions, causing the spaceships to ricochet off of each other like a sweet Beyblade battle. To avoid this I tested out adding a force perpendicular to the TTC force when two spaceships were in deadlock, which ended up causing the spaceships to swirl around each other infinitely due to the spaceships still trying to reach the same PRM node, creating a "sticky" force. Ultimately, I lessened each spaceship's path's need to be similar to their respective A* planned path, put a constraint on the acceleration to avoid ricochet, and took inspiration from boid forces by using separation forces to keep the spaceships away from each other.

Image Sources:

Asteroid: https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.nicepng.com%2Fmaxp%2Fu2w7e6t4w7o0i1q8%2F&psig=AOvVaw1i2WecOsKujau9mNYq7Xnc&ust=1633477982214000&source=images&cd=vfe&ved=0CAkQjRxqFwoTCKCsrev5sfMCFQAAAAAdAAAAABAJ Planet_1: https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pngaaa.com%2Fdetail%2F1381749&psig=AOvVaw3jCniEyZCJ2eM8sH-ub5dt&ust=1633478053948000&source=images&cd=vfe&ved=0CAkQjRxqFwoTCODZlJH6sfMCFQAAAAAdAAAAABAD Planet_2: https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pngegg.com%2Fen%2Fsearch%3Fq%3Dcartoon%2Bplanet&psig=AOvVaw3jCniEyZCJ2eM8sH-ub5dt&ust=1633478053948000&source=images&cd=vfe&ved=0CAkQjRxqFwoTCODZlJH6sfMCFQAAAAAdAAAAABAK Planet_3: https://www.google.com/url?sa=i&url=https%3A%2F%2Fwww.pngkey.com%2Fdetail%2Fu2y3q8q8u2w7q8o0_solar-system-planet-cartoon-cartoon-planet%2F&psig=AOvVaw3jCniEyZCJ2eM8sH-ub5dt&ust=1633478053948000&source=images&cd=vfe&ved=0CAkQjRxqFwoTCODZlJH6sfMCFQAAAAAdAAAAABAQ Planet_4: https://listimg.pinclipart.com/picdir/s/530-5302363_planeten-clipart-spaceclip-transparent-green-planet-clipart-png.png Planet_5: https://e7.pngegg.com/pngimages/678/600/png-clipart-yellow-planet-space-asteroids-cartoon-saturn.png Ship: https://img.favpng.com/4/7/21/cartoon-unidentified-flying-object-clip-art-png-favpng-ppvq6wp3rnQh3RwUKyNprSsRC.jpg

crowdsimulation's People

Contributors

mattychoi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.