tisdag 24 maj 2016

Final result

We modified a previous scene which included 3D agents, with a different camera angle to make it more comparable with the video from the following site How do we walk together.
Trails after each agent was also added to make it easier to analyze.

Here is our video

Finaly we modified it even further by using theses agent in a kth setting.

måndag 23 maj 2016

Experimenting with trails

Here we experimented with trails. A trail is drawn after each agent so that it's possible to analyze where they have been. This was achieved with Unity's built in trail renderer.

In this video each agent is assigned a trail renderer and a random color. This will be used later on in our project.

onsdag 11 maj 2016

RVO with formations

Here we use formations together with RVO2 to create a potential crosswalk scene. Each group is assigned a random formation from a set of three and a random color. The goal for each group is to get to the oppisite side of the screen.

With 2D agents

With 3D Agents

lördag 23 april 2016

RVO implementation in Unity3D

Today we managed to implement RVO in Unity. We used the C# version of RVO2 found on this page http://gamma.cs.unc.edu/RVO2/

Here's a scene consisting of 100 agents in a circle, with the goal of getting to the opposite side. It's a classic test and it seems to work fine.

onsdag 20 april 2016

Group changing formation

Here is a video of 10 agents changing formations. First we can see the magnificent creation of a horizontal row formation, then the group quickly changes into a stable vertical line formation and finally they end up in a triangle formation without colliding.

onsdag 6 april 2016

Implementation of RVO integrated with Unity

Here's a video of our attempt to remake the implementation of RVO (made by Stephen J. Guy, et al. http://gamma.cs.unc.edu/RVO2/).

The movement of the agents are working and most of them seem to be moving towards the opposite side of the circle (as specified as the goal for the agent). However, the agents doesn't seem to be avoiding each other nor do they change direction during the simulation, which they should do at some point.

But the simulation does run at a reasonable fps, so the computations aren't too heavy on the CPU.

onsdag 23 mars 2016

Group formations prototype #1

Today we have experimented with some group formations. We have implemented an abstract base class for making the agents align in a specific formation. To use this class one has to inherit it and implement the method CreateTemplate(). In this method there needs to be specified how the relative positions to the leader of the group are placed. Also, the nr of agents has to be stated in the inspector and which of the agents is the leader.

Here is a demo of a group formation for walking on a line:

Here is a demo of a group walking in a triangle formation:

torsdag 17 mars 2016

Agents avoiding collision

In this scene we have made different approaches to making the agents avoid each other. First we tried using the UnitySteer script "Steer For Spherical Obstacles" on one of the agents. This script was not supposed to be used in that way, we found out. Then we tried with the script "Steer For Evasion". This script uses another agent as the reference to avoid. The disadvantage with that is that the agent can only avoid one other object for each script. 

The hard part in the simulation was to find out which parameter to change in order to avoid collisions between the agents. We needed to find the radius parameter for which represented the agents "comfort zone". In the end we found this to be a combination of the "Safety Distance" and the vehicles radius. The result is shown in the video above. In the video above ther's a slight offset in the vertical axis between the two agents.

If there's no offset the agents will do the same movements for a while and then diverge from each other. This is something that can happen in the real world too, but maybe not this extreme.

Collision avoidance with Unitysteer

Today we experimented with different types of collision avoidance for our agent. The following scene in these videos is composed of one agent and one obstacle. The agent will collide straight on the obstacle, without any angle of incidence. The agent's goal is to pass the obstacle and end up on the other side.

In this scene we used Unitysteer's biped ve script for our agent. By using this our agent got stuck and didn't make any progress.

Our nex step was to try Unitysteer's Autonomous Vehicle scrip with the same scene setup as above. When we tried this the agent managed to avoid the obstacle and steer around it.

onsdag 10 februari 2016

First try with UnitySteer

This far in the project we have downloaded the UnitySteer package from GitHub (link found below). This package contains several implemented steering methods, for example following a path or avoiding obstacles.

Here is a video of an agent trying to follow a specific path while also trying to avoid the spherical obstacles:

Some problems with this implementation is that the agent sometimes breakes the physical laws and walks inside the obstacle. Also the steering is jagged which does not look realistic. When a human spots an obstacle it doesn't turn the opposite way like the agent seems to do. Instead it turns just enough to not intersect with the obstacle.

A more smooth implementation of obstacle avoidance is shown in a previous post.

Link to UnitySteer: https://github.com/ricardojmendez/UnitySteer

Problems with GitHub

Today we finally solved the problems we had with git.

The problems were that when we merged a clone of UnitySteer into our repository, pushed it and then pulled it on another computer it arised several compile errors in the scripts from UnitySteer. After several tries we managed to solve this problem.

We had a problem with the linking of the UnitySteer scripts in our agent prefab when pulling from git. The script components were still attatched to the agent but they were empty. This was due to some changes in the meta files in the UnitySteer package. When we renewed the UnitySteer package this problem was solved.

onsdag 3 februari 2016

Implementing our own steering to Unity

Today we managed to implement the steering algoritm "seek", by using the technique described on this page, Game Development Understanding Steering.

We also implemented obstacle avoidance by taking advantage of Unitys' built in RayTracing function, the method we used is described in this video, Obstacle Avoidance

Here is a demo on what we have achieved so far

The framerate drops randomly at certain times. This might be the case because our agent model is quite complex and the laptop we ran this on has a weak GPU. For our next iteration we plan on using 2D sprites while in the development stage, to not be limited by our GPU when using even more agents.

onsdag 27 januari 2016

Planing for the primary prototype

This week we have done some research by reading a few research papers, including state of the art algorithms for simulating group formations and dense groups using fluid dynamics. This has given us some insight to what we might achieve in our final product.

Papers that we have read:
Generating Freestyle Group Formations in Agent-Based Crowd Simulations
Here is a demo of the implementation above: Youtube video

Spectral-Based Group Formation Control

For the moment we need to do more research to be able to reach the level of the implementation above. We will first try to simulate one or a few agents walking a certain path in a static environment. Then we will try to implement the following Steering Algorithm. This our first step towards a group formation simulation.

For this we have set a deadline at next Wednesday (3/2-2016).

onsdag 20 januari 2016

Project plan. Week 5-8

This is a rough time plan which we will follow durring the first weeks of our project.

Week 5:
  • Do background research on the topic.
  • Study source code from students who has done similar project.

Week 6:
  • Decide on which type of project we want to do.
  • Start brainstorming on the first prototype.

Week 7:
  • Complete first prototype.

Week 8:
  • Get feedback on first prototype and apply that to our next prototype.