Code Monkey home page Code Monkey logo

project7-biocrowds's Introduction

BioCrowds

Biocrowds is a crowd simulation algorithm based on the formation of veination patterns on leaves. It prevents agents from colliding with each other on their way to their goal points using a notion of "personal space". Personal space is modelled with a space colonization algorithm. Markers (just points) are scattered throughout the simulation space, on the ground. At each simulation frame, each marker becomes "owned" by the agent closest to it (with some max distance representing an agent's perception). Agent velocity at the next frame is then computed using a sum of the displacement vectors to each of its markers. Because a marker can only be owned by one agent at a time, this technique prevents agents from colliding.

Agent Representation (15 pts)

Create an agent class to hold properties used for simulating and drawing the agent. Some properties you may want to consider include the following:

  • Position
  • Velocity
  • Goal
  • Orientation
  • Size
  • Markers

Grid/Marker Representation (25 pts)

Markers should be scattered randomly across a uniform grid. You should implement an efficient way of determining the nearest agent to a given marker. Based on an marker's location, you should be able to get the nearest four grid cells and loop through all the agents contained in them.

Setup (10 pts)

  • Create a scene (standard, with camera controls) and scatter markers across the entire ground plane
  • Spawn agents with specified goal points

Per Frame (35 pts)

  • Assign markers to the nearest agent within a given radius. Be sure that a marker is only assigned to a single, unique agent.
  • Compute velocity for each agent
  • New velocity is determined by summing contributions from all the markers the agent "owns". Each marker contribution consists of the displacement vector between the agent and the marker multiplied by some (non-negative) weight. The weighting is based on
    • Similarity between the displacement vector and the vector to agent's goal (the more similar, the higher the weight. A dot product works well)
    • Distance from agent (the further away, the less contribution) Each contribution is normalized by the total marker contributions (divide each contribution by sum total)
    • Clamp velocity to some maximum (you probably want to choose a max speed such that you agent will never move further than its marker radius)
  • Move agents by their newly computed velocity * time step
  • Draw a ground plane and cylinders to represent the agents.
  • For a more thorough explanation, see HERE and HERE and HERE and HERE

Two scenarios

  • Create two different scenarios (initial agent placement, goals) to show off the collision avoidance. Try to pick something interesting! Classics include two opposing lines of agents with goals on opposite sides, or agents that spawn in a circle, which each agent's goal directly across.
  • Provide some way to switch between scenarios

Deploy your code! (5 pts)

  • Your demo should run on your gh-pages branch

Extra credit

  • Add obstacles to your scene, such that agents avoid them

project7-biocrowds's People

Contributors

austineng avatar gracexu94 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.