Experiments in game design and development

last updated 2021-03-28


⇣ (1)
  • Research on group movement and boids for {gamedev}
    • Boids and Steering
      • {^Boids}
        • Three behaviors:
          1. Separation: steer to avoid crowding local flockmates
          2. Alignment: steer towards the average heading of local flockmates
          3. Cohesion: steer to move toward the average position of local flockmates
        • Each boid reacts only to flockmates within a certain field of distance and angle (i.e. in fov)
      • {^Steering Behaviors For Autonomous Characters}
        • Simple behaviors for individuals and pairs:
          • Seek and Flee
          • Pursue and Evade
          • Wander
          • Arrival
          • Obstacle Avoidance
          • Containment
          • Wall Following
          • Path Following
          • Flow Field Following
        • Combined behaviors and groups:
          • Crowd Path Following
          • Leader Following
          • Unaligned Collision Avoidance
          • Queuing (at a doorway)
          • Flocking (combining: separation, alignment, cohesion)
    • Videos in a "Unity RTS" devlog series
      • {^Unity RTS - Movement Tutorial}
        • Use "agent" model to define behaviors; design allows you to have multiple behaviors (i.e. avoid obstacle, but move towards objective) easily
        • Used a non-MonoBehavior class to store steering, i.e. angular rotation and instantaneously velocity
        • agent class takes steering to apply velocity to GameObject.
        • agent has a SetSteering method that takes a steering class and a weight, that allows multiple steering behaviors to be applied.
        • using update and lateUpdate separately -- update to update position and orientation, lateUpdate to update velocity and angular velocity (and create a new steering)
        • Class AgentBehavior defines the different steering behaviors for the agent. It has a target, an agent, a destination, and all the necessary definitions for the steering behavior.
          • For example, a seek behavior would steer towards a target.
      • {^Unity RTS - Boids tutorial}
        • Use a game object to control game object groups that behave together, i.e. share a target, and give it a child_prefab GameObject property, and a list of members.
        • Use boid separation to keep objects with similar movement patterns and the same target to prevent crowding.
          • Define desiredSeparation, and create a steering behavior. Iterate over all members of flock, and create a repulsion depending on inverse of distance.
        • Boid cohesion aggregates the center of the herd and adds that to the steering's linear vector.
        • Separation should have a much greater weight than cohesion.
        • Boid alignment means that objects should try to point the same way.
      • {^Unity RTS - Movement and Pathfinding Groups}
        • Interesting series of experiments using leader/followers, flow fields and other movement patterns.
    • {^Group Pathfinding & Movement in RTS Style Games}
      • Stopping a group was an issue, because only the first reached its destination. They tried "message passing" where units within a certain proximity would pass the "I'm there" message.
      • Having a unit move through a crowd of other units was an issue. Solved by having the unit moving through exert a force on the others, which was also propagated through the group using the message passing system. Starcraft has the unit move out of the way and then back to the original position. In the end this had too many edge cases (i.e. you can push a unit that is idle, but not one that is active).
      • Group movement appeared "messy"
        • they tried:
          1. calculating center point of group
          2. taking difference for each unit
          3. applying the same diff to each unit's destination
        • this worked well for the common case, but when the destination had obstacles, it broke down.
        • when units were dispersed when a command was issue, they'd stay dispersed upon destination arrival
        • Solution ended up being to calc a "smart center" for the group:
          1. calculate avg position of all units
          2. remove any units outside of 1 stdev of the average
          3. recalculate average position from that subset of group
          4. if the dest is within a stdev of center point, can use naive independent movement
          5. if there is no meaningful group, you want them to regroup as much as possible, and if stdev is larger than a max, you have them all move to the same dest.
          6. if there is a cluster but also outliers, collapse them by giving them a destination in the direction of their offset, but only a stdev's length away from the group's central destination. This gives a natural behavior of "collapsing back in" to the group.