tag:blogger.com,1999:blog-4616141443440467522024-03-13T14:21:37.952-07:00Crowd SimulationSandstenhttp://www.blogger.com/profile/10735468075421879829noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-461614144344046752.post-66820608678920062122016-05-24T10:58:00.000-07:002019-01-22T07:52:11.898-08:00Final resultWe 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 <a href="http://www.mehdimoussaid.com/archives/58">How do we walk together</a>.<br />
Trails after each agent was also added to make it easier to analyze.<br />
<br />
Here is our video<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/wLDexID2360/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/wLDexID2360?feature=player_embedded" width="320"></iframe></div>
<br />
Finaly we modified it even further by using theses agent in a kth setting.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/Wv7A7WfAHjw/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/Wv7A7WfAHjw?feature=player_embedded" width="320"></iframe></div>
<br />
Implementation at github: <a href="https://github.com/Sandsten/Kexjobb/tree/develop">https://github.com/Sandsten/Kexjobb/tree/develop</a>Sandstenhttp://www.blogger.com/profile/10735468075421879829noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-90520981245062708992016-05-23T09:10:00.000-07:002016-05-24T10:55:44.707-07:00Experimenting with trailsHere 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.<br />
<br />
In this video each agent is assigned a trail renderer and a random color. This will be used later on in our project.<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/v7xhkmT5izA/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/v7xhkmT5izA?feature=player_embedded" width="320"></iframe></div>
<br />Youtube Accounthttp://www.blogger.com/profile/09990193144349372540noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-73805030009762940912016-05-11T07:05:00.001-07:002016-05-24T08:58:19.927-07:00RVO with formationsHere 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.<br />
<br />
<div style="text-align: center;">
With 2D agents</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/mtrGyJhewdE/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/mtrGyJhewdE?feature=player_embedded" width="320"></iframe></div>
<br />
<div style="text-align: center;">
With 3D Agents</div>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/oKXNlF4_RF4/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/oKXNlF4_RF4?feature=player_embedded" width="320"></iframe></div>
<div style="text-align: center;">
<br /></div>
Sandstenhttp://www.blogger.com/profile/10735468075421879829noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-6632704005881545182016-04-23T12:47:00.002-07:002016-04-23T12:47:35.819-07:00RVO implementation in Unity3DToday we managed to implement RVO in Unity. We used the C# version of RVO2 found on this page <a href="http://gamma.cs.unc.edu/RVO2/">http://gamma.cs.unc.edu/RVO2/</a><br />
<br />
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.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/W6ApBGcz57o/0.jpg" src="https://www.youtube.com/embed/W6ApBGcz57o?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />Youtube Accounthttp://www.blogger.com/profile/09990193144349372540noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-37889696211810844092016-04-20T06:24:00.000-07:002016-04-20T06:27:12.530-07:00Group changing formation<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/HwGMDcqBW5o/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/HwGMDcqBW5o?feature=player_embedded" width="320"></iframe></div>
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.Youtube Accounthttp://www.blogger.com/profile/09990193144349372540noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-5737909316514367522016-04-06T13:07:00.002-07:002016-04-06T13:07:32.583-07:00Implementation of RVO integrated with Unity<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/157yr85u5gI/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/157yr85u5gI?feature=player_embedded" width="320"></iframe></div>
<br />
Here's a video of our attempt to remake the implementation of RVO (made by Stephen J. Guy, et al. <a href="http://gamma.cs.unc.edu/RVO2/">http://gamma.cs.unc.edu/RVO2/</a>).<br />
<br />
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.<br />
<br />
But the simulation does run at a reasonable fps, so the computations aren't too heavy on the CPU.Youtube Accounthttp://www.blogger.com/profile/09990193144349372540noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-77962447727275726772016-03-23T09:29:00.003-07:002016-03-23T09:29:42.851-07:00Group formations prototype #1Today 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.<br />
<br />
Here is a demo of a group formation for walking on a line:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/1LQTMGD_KN0/0.jpg" src="https://www.youtube.com/embed/1LQTMGD_KN0?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Here is a demo of a group walking in a triangle formation:</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div style="text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/TlEqXsqH248/0.jpg" src="https://www.youtube.com/embed/TlEqXsqH248?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<br />Youtube Accounthttp://www.blogger.com/profile/09990193144349372540noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-64647931254793124952016-03-17T08:32:00.000-07:002016-03-17T09:02:45.922-07:00Agents avoiding collision<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/NsOvg6jI1TE/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/NsOvg6jI1TE?feature=player_embedded" width="320"></iframe></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
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. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
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.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div style="text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/zarau7VWoWs/0.jpg" src="https://www.youtube.com/embed/zarau7VWoWs?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
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.</div>
Martinhttp://www.blogger.com/profile/08633764201386881562noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-69716253762878993582016-03-17T08:21:00.002-07:002016-03-17T08:41:54.273-07:00Collision avoidance with Unitysteer<div class="separator" style="clear: both;">
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.</div>
<div class="separator" style="clear: both;">
<br /></div>
<div class="separator" style="clear: both;">
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.</div>
<div class="separator" style="clear: both; text-align: center;">
<br /><iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/rbeUndrQ7qg/0.jpg" src="https://www.youtube.com/embed/rbeUndrQ7qg?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
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.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div style="text-align: center;">
<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/fTwl03LflA4/0.jpg" src="https://www.youtube.com/embed/fTwl03LflA4?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br /></div>
<br />
<br />Sandstenhttp://www.blogger.com/profile/10735468075421879829noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-40949418976643504522016-02-10T09:07:00.004-08:002016-02-10T09:15:20.204-08:00First try with UnitySteerThis 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.<br />
<br />
Here is a video of an agent trying to follow a specific path while also trying to avoid the spherical obstacles:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dz5QFgBXbyiKv0kdq5JFryEHvARndmZ3uyu06xRNOjbSfIrOe0FYkffCBOubDxfGdRD0TZ5UehAJZahscsG4Q' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<br />
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.<br />
<br />
A more smooth implementation of obstacle avoidance is shown in a previous post.<br />
<br />
Link to UnitySteer: <a href="https://github.com/ricardojmendez/UnitySteer">https://github.com/ricardojmendez/UnitySteer</a>Martinhttp://www.blogger.com/profile/08633764201386881562noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-90425947193302300452016-02-10T08:10:00.000-08:002016-02-10T08:10:44.221-08:00Problems with GitHubToday we finally solved the problems we had with git.<br />
<br />
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.<br />
<br />
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.Martinhttp://www.blogger.com/profile/08633764201386881562noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-29721781391886516862016-02-03T08:48:00.000-08:002016-03-17T09:07:28.440-07:00Implementing our own steering to UnityToday we managed to implement the steering algoritm "seek", by using the technique described on this page, <a href="http://gamedevelopment.tutsplus.com/tutorials/understanding-steering-behaviors-movement-manager--gamedev-4278">Game Development Understanding Steering</a>.<br />
<div>
<br /></div>
<div>
We also implemented obstacle avoidance by taking advantage of Unitys' built in RayTracing function, the method we used is described in this video, <a href="https://vimeo.com/9304844" style="text-decoration: none;"><span style="color: #1155cc; font-family: "arial"; font-size: 14.6667px; text-decoration: underline; vertical-align: baseline; white-space: pre-wrap;">Obstacle Avoidance</span></a></div>
<div>
<br /></div>
<div>
Here is a demo on what we have achieved so far</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div style="text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxmzOh-T2l0Rsr-FvQHsEDI3VzHZK1rLo9YVGkEQtyOpcb-eUkRsSm2k_yShfkP1c40hNsY9BUJj7sShdIRpA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div>
<div>
<br /></div>
<div>
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.</div>
Sandstenhttp://www.blogger.com/profile/10735468075421879829noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-54996282171967615482016-01-27T08:43:00.002-08:002016-01-27T08:43:35.927-08:00Planing for the primary prototypeThis 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.<br />
<br />
Papers that we have read:<br />
<a href="http://graphics.cs.uh.edu/wp-content/papers/2013/2011_CGA-crowd-formation-generation-preprint.pdf">Generating Freestyle Group Formations in Agent-Based Crowd Simulations</a><br />
Here is a demo of the implementation above: <a href="https://youtu.be/VmKD_by9rAQ">Youtube video</a><br />
<br />
<a href="http://onlinelibrary.wiley.com/doi/10.1111/j.1467-8659.2009.01404.x/epdf">Spectral-Based Group Formation Control</a><br />
<br />
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 <a href="http://www.red3d.com/cwr/papers/1999/gdc99steer.pdf">Steering Algorithm</a>. This our first step towards a group formation simulation.<br />
<br />
For this we have set a deadline at next Wednesday (3/2-2016).Sandstenhttp://www.blogger.com/profile/10735468075421879829noreply@blogger.com0tag:blogger.com,1999:blog-461614144344046752.post-56084008480097171182016-01-20T08:25:00.000-08:002016-01-20T08:25:09.640-08:00Project plan. Week 5-8<span style="font-family: Arial; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">This is a rough time plan which we will follow durring the first weeks of our project.</span><br />
<span style="font-family: Arial; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;"><br /></span>
<span style="font-family: Arial; font-size: 14.6667px; line-height: 1.38; white-space: pre-wrap;">Week 5:</span><br />
<span id="docs-internal-guid-77ee54e9-5fd1-3b9c-2d09-d2dea95bc7c3"><ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="font-family: Arial; font-size: 14.6667px; list-style-type: disc; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;"> Do background research on the topic. </span></div>
</li>
<li dir="ltr" style="font-family: Arial; font-size: 14.6667px; list-style-type: disc; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Study source code from students who has done similar project. </span></div>
</li>
</ul>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Week 6: </span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="font-family: Arial; font-size: 14.6667px; list-style-type: disc; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Decide on which type of project we want to do. </span></div>
</li>
<li dir="ltr" style="font-family: Arial; font-size: 14.6667px; list-style-type: disc; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Start brainstorming on the first prototype. </span></div>
</li>
</ul>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Week 7: </span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="font-family: Arial; font-size: 14.6667px; list-style-type: disc; vertical-align: baseline;"><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Complete first prototype.</span></div>
</li>
</ul>
<br /><div dir="ltr" style="line-height: 1.38; margin-bottom: 0pt; margin-top: 0pt;">
<span style="font-family: Arial; font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Week 8: </span></div>
<ul style="margin-bottom: 0pt; margin-top: 0pt;">
<li dir="ltr" style="font-family: Arial; font-size: 14.6667px; list-style-type: disc; vertical-align: baseline;"><span style="font-size: 14.6667px; vertical-align: baseline; white-space: pre-wrap;">Get feedback on first prototype and apply that to our next prototype.</span></li>
</ul>
</span>Sandstenhttp://www.blogger.com/profile/10735468075421879829noreply@blogger.com0