Update 2 – Prototype 1 Completed

We are excited to announce that our first prototype is now complete and fully functional. Since last time, we have made a lot of general improvements of our code. We can now, to some extent, customize the way we want the program to run, straight from the Unity UI, which is really convenient.

Most importantly, we have implemented a way of handling collision between the agents so that they keep their distances at all times. Our approach to narrowing down the number of agents that need to be compared every frame is using a method similar to the particle-in-cell method, which is otherwise used to determine the densities and velocities in every cell. For each agent, we always look at all the agents in the same cell. It is when we look at agents in adjacent cells that we have implemented the method mentioned. Basically, what the algorithm does is that it only considers agents close to the boundaries of the cell, and for each of those agents it uses the agent’s position relative to the cell to determine which of the adjacent cells are of interest. In other words, the algorithm makes sure so that collision handling is only carried out for agents in the cells closest to the agent in question.

However, it doesn’t stop there, as we have added even more to this first prototype. In fact, the particle-in-cell method, which calculates the density field, has been implemented already at this stage. We now have a matrix with the density-values for each cell and it is only used, at this moment, to change the color of the cell, which looks pretty neat. A cell with the density 0 has a dark grey color and as the density increases, the color becomes much lighter until it is completely white. This is one of the features which can be enabled directly from the Unity UI.

Back to the collision handling algorithm. When testing this new algorithm we have noticed that it performs really well, in most situations. It performs well, as long as it doesn’t have to deal with large clusters of agents that are moving inwards toward a point in the center. In this scenario, what happens is that the agents keep on pushing inwards, causing the agents in the middle to be crushed and sort of fused together. This is basically what happens when we spawn agents in the outer cells and tell them to go to the exact opposite side of the grid. We end up with the scenario described above. This is not an issue though, because when we have implemented the unilateral incompressibility constraint later on we will never arrive at this scenario ever again. In fact, it seems, at this stage, that our collision handling algorithm will work really well in collaboration with the UIC, upon its implementation, and we really look forward to seeing them in action together.



Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in:

WordPress.com Logo

Du kommenterar med ditt WordPress.com-konto. Logga ut / Ändra )


Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )


Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s