Friday, December 18, 2015

B3 Interactive Narrative

This is our final Unity project!
enjoy it
Thanks all teammate and all TA's and professor


Github link https://github.com/CG-F15-14-Rutgers
  Youtube :https://www.youtube.com/watch?v=ISsq27dKzLo
  WebPlayer: http://rcssa.org/WebGame/WebPlayer.html


Story Name: The Lost Phone

This project could be separated into Three Chapters, which are related to three part of project description.
We combine the Three parts into one. 

Chapter I

This Chapter shows the start scene of the story. The environment is a complex street cafe. Some telegraph pole, tables, chairs, sunshades and long benches. There are a crowd of people in the cafe have a fight, two and are fight with each other and seven people are looking the fight and yelling and clapping. A red cost man coming from the left hand side of screen to meet a girl in the right and side. Characters animations are using KADAPT Library and some self-edited animations. They have a conversation and act some conversion animation such as wave hands, applaud, crying and etc. we also implemented the conversation dialog box for both characters. They are talking about the graphic class B3 assignment. After they are talking, then the conversation end and say goodbye to each other, the girl using Final IK interaction system to sit, and the man in the red dress finds an IPhone on the ground. And he picks up the iPhone. At same time the phone is ringing. There is a man talks from the iPhone and says he will come back to get his lost phone.

Tech Specs:
Using TreePlusSharp to construct behavior tree, Final IK interaction system, GUI on screen, Camera Script;

Character Capability: Go to the position, Oriented to another character, talk to character, fight to another character, Pick up object, Sit on the bench, To on the phone, claps, cheers, sad, cry, ect;

Multi-actor: conversation, fight, sees the fight;
Behavior Tree:




Chapter II

After the Chapter I, main character came to be on the scene, the Second Chapter this character could interact with other characters in the scene. Use the key board to control the character. You can see in the game, GUI had instruction how to control interaction.

There are three interaction between characters, ask the phone back, ask the girl dance, and stop the fight.

I created an Event Controller to interrupt with the behavior tree, which we could consider behavior tree as action library.


Control Graph:
Character Control: using keyboard key. To make three different interaction: T, Y and U.

Chapter III

This chapter demonstrated to select any characters in the scene to stop the War. This means we could select any character to interrupt behavior tree.


Character Control: using keyboard key. To select three different people: T, Y and U.


Conclusion

In this projects, I did lots of work to figure out the Final IK library and KADAPT library, unlike the old ADAPT library, KADAPT combined the Final IK to make character’s actives easier however it limited on access individual node in real-time, In ADAPT library the BehaviorEvent had a public function BehaviorEvent.run() which could make more easier to process behavior three in real time instead of interrupt the whole tree. It is possible to re-implement the run function for KADAPT library.


Friday, December 11, 2015

Assignment A5


To execute our simulation the command is
./steersim –config Myconfig.xml –testcase testcasename –ai sfAI

The idea of this complex crowd simulation is combine social forces and A* path finder.
The idea of pathfinder work with social forces is put the sequence of nodes that generate by A* into the waypoint and goalqueue list, after reach the current local goal, set the current local goal to the next goal in the waypoint and goal queue list. Sometimes, the agent will crack when it reach the corner of obstacles, so we need to recompute the path in four way A*.

We merge the A* pathfinder into our social forces AI
In reset function push the sequence of node that compute by A* into waypoints and midtermpath and goalQueue list.

In the updateAI we use hasLineOfSightTo function to check is there any obstacles between the agent current position and the current local goal.  If there is an obstacles between the way to the local goal, recalculate the path with four way A* algorithm. in addition, if the local goal is to far away from the current position, it will also recalculate the path.
In most case the OBSTACLE_CLEARANCE = 0 In Maze testcase, the agent size is bigger than other testcase, so we increase the OBSTACLE_CLEARANCE = 2;

In A* we decide to choice weight to 2 and also chose big G value and Manhattan distance.

In the test case hallway-four-way-rounded-roundabout we have solve the polygon obstacles

Implementation method:
1. How to detect if polygon obstacle is in the agents' query area?
Using GJK to detect if agent. Position + query radius colloid with polygon obstacle. If so, we start to compute the repulsion force between polygon obstacle and agents. else, do nothing.
2. How to calculate the force between agents and polygon obstacle?
If polygon obstacle is in the query area of agents, first, we get the nearest vertices in the polygon and split the angel of this vertices in to two parts. Then we compare the vector from the vertices to agent and the vector from vertices to its next vertices to determine which side of the vertices the agent is. Then we treat the face of side of the polygon obstacle as wall to calculate the repulsion force.

In the office complex, we got segmentation fault. The reason is in this testcase the wide of obstacle is so small so many agent crack in the corner of the obstacles. So many recalculate path in this test case.

We increase the goal force time 4. So it can reduce the bounce between agents.


Our created test case is an airport simulation. Some plane are departing and some are arriving. And we also change the shape of agent and color. So it likes look UFO. 

wall squeeze CG Group 14
https://youtu.be/J2vI5Q-txbw

plane ingress CG Group 14
https://youtu.be/9qO_MUMFOpU

hallway four way rounded roundabout CG Group 14
https://youtu.be/fwh1C3knhEU

double squeeze CG Group 14
https://youtu.be/34lVXvQEG2k

airport CG Group 14
https://youtu.be/NdibtJ2kwZk

bottleneck squeeze CG Group 14
https://youtu.be/kbqUvrYE1rA

office complex CG Group 14
https://youtu.be/4iIxO_zA3ms

maze CG Group 14
https://youtu.be/yZ5s-hunnME

plane egress CG Group 14
https://youtu.be/75xuuXNNBmg

doorway two way CG Group 14
https://youtu.be/ZAhxFKZjubA

hallway two way CG Group 14
https://youtu.be/6xyE49ldB9w

crowd crossing CG Group 14
https://youtu.be/hiDJ5Dt19Bo


Sunday, December 6, 2015

Assignment A4 Pathfinding


Blog post : http://rutgerscg14.blogspot.com/

Our submitted AstarPlanner.cpp is
Manhattan distance
Set bigger G for breaking ties
Weighted of heuristics is 2
You are free to change weighted to 1 or 4 or 8;
You are free to change Manhattan to Euclidian
You are free to change to choice smaller G when F-value is same



Part 1
Manhattan, testcase search-1.xml, Path length = 30, # expanded nodes = 852;
https://www.youtube.com/watch?v=YDCcYahzFNs
Manhattan, testcase search-2.xml, Path length = 76, # expanded nodes = 4846;
https://www.youtube.com/watch?v=w0E_9ZsrFJI
Euclidian, testcase search-1.xml, Path lenght = 26, # expanded nodes = 1016;
https://www.youtube.com/watch?v=Az18MZGJ_wE
Euclidian, testcase search-1.xml, Path length = 75, # expanded nodes = 6418;
https://www.youtube.com/watch?v=u8HZ5RLU4AY



Part 2
Manhattan, testcase search-1.xml, g_smaller, Path length = 30 , # expanded nodes = 852;
https://www.youtube.com/watch?v=BMBXyfsSupk
Manhattan, testcase search-2.xml, g_smaller, Path length = 76, # expanded nodes = 4846;
https://www.youtube.com/watch?v=4K5rJQ13vPA
Manhattan, testcase search-1.xml, g_bigger, Path length = 30, # expanded nodes = 840;
https://www.youtube.com/watch?v=eDxocYNuMXw
Manhattan, testcase search-2.xml, g_bigger, Path length = 76, # expanded nodes = 4844;
https://www.youtube.com/watch?v=YywlJysrA0s
Euclidian, testcase search-1.xml, g_smaller, Path length = 26, # expanded nodes = 1016;
https://www.youtube.com/watch?v=hKIopU3Q90I
Euclidian, testcase search-2.xml, g_smaller, Path length = 75, # expanded nodes = 6418;
https://www.youtube.com/watch?v=76qTtNQe_8k
Euclidian, testcase search-1.xml, g_bigger, Path length = 26, # expanded nodes = 1016;
https://www.youtube.com/watch?v=ftll1vgiP08
Euclidian, testcase search-2.xml, g_bigger, Path length = 75, # expanded nodes = 6418;
https://www.youtube.com/watch?v=udeoZ1rdGT0



Part 3
Manhattan, testcase search-1.xml, g_bigger, Path length = 30 , # expanded nodes = 840 ;
https://www.youtube.com/watch?v=8kLODjbFKKM
Manhattan, testcase search-2.xml, g_bigger, Path length = 76, # expanded nodes = 4844;
https://www.youtube.com/watch?v=neEN3RYP3fY
Euclidian, testcase search-1.xml, g_bigger, Path length = 26, # expanded nodes = 1016;
https://www.youtube.com/watch?v=6dD3jCVay3k
Euclidian, testcase search-2.xml, g_bigger, Path length = 75, # expanded nodes = 6418;
https://www.youtube.com/watch?v=b2gu3HoHSxA



Part4
Manhattan, testcase search-1.xml, g_bigger, weight = 2, Path length = 28, # expanded nodes
= 348; 

https://www.youtube.com/watch?v=0U2kkM1Nly8
Manhattan, testcase search-2.xml, g_bigger, weight = 2, Path length = 77, # expanded nodes
= 2202; 

https://www.youtube.com/watch?v=PfaEt9NjDSI
Manhattan, testcase search-1.xml, g_bigger, weight = 4, Path length = 27, # expanded nodes
= 294 ;
https://www.youtube.com/watch?v=WKVNopz01hc
Manhattan, testcase search-2.xml, g_bigger, weight = 4, Path length = 77, # expanded nodes
= 988 ;
https://www.youtube.com/watch?v=haNxhOb5DQU
Manhattan, testcase search-1.xml, g_bigger, weight = 8, Path length = 37, # expanded nodes
= 304 ;
https://www.youtube.com/watch?v=I8DBYoSLx48
Manhattan, testcase search-2.xml, g_bigger, weight = 8, Path length = 77, # expanded nodes
= 512;
https://www.youtube.com/watch?v=Cq5W-ss0DjI
Euclidian, testcase search-1.xml, g_bigger, weight = 2, Path length = 29, # expanded nodes =
360;

https://www.youtube.com/watch?v=BquF1wOnQRc
Euclidian, testcase search-2.xml, g_bigger, weight = 2, Path length = 77, # expanded nodes =
2902;

https://www.youtube.com/watch?v=O4BGv3rpQaI
Euclidian, testcase search-1.xml, g_bigger, weight = 4, Path length = 28, # expanded nodes =
254; 

https://www.youtube.com/watch?v=MJdKdWbeNTs
Euclidian, testcase search-2.xml, g_bigger, weight = 4, Path length = 77, # expanded nodes =
1144; 

https://www.youtube.com/watch?v=brLsTtJn0Vo
Euclidian, testcase search-1.xml, g_bigger, weight = 8, Path length = 37, # expanded nodes =
232;

https://www.youtube.com/watch?v=oiLQ38If99M
Euclidian, testcase search-2.xml, g_bigger, weight = 8, Path length = 77, # expanded nodes =
488; 

https://www.youtube.com/watch?v=qEvN9FV1sSU