Path Planning Introduction 1 Who am I? Roland Geraerts Robotics background Research on path planning and crowd simulation Assistant professor Software package 2 Who are you? Master GMTE? Course Motion and Manipulation? Interest in games? Why do you follow this course? Interest in thesis projects? Who has exciting hobbies? 3 Learning goals of the course To become an expert in path planning and crowd simulation Study and discuss many papers To understand the limitations of current techniques Determine the limitations and open problems in the papers To become a very critical reader Hand in many assessments of papers Actively participate in discussions To understand the state-of-the-art in current games and how this could be improved Study path planning and crowd simulation in existing games Write paper about the applicability of new techniques (*) 4 Learning goals of the course To understand crowd simulation frameworks Follow the workshop Integrate some code into a framework (*) To improve further upon your scientific skills Participate in discussions and lead them Give better presentations Know how to set up experiments better (workshop) Write better review reports and assessments 5 Why this course Path planning and crowd simulation are important research topics in Utrecht Roland Geraerts, Frank van der Stappen, Wouter van Toll, Norman Jaklin, Arne Hillebrand, Sybren Stüvel Relation to animation research (Arjan Egges, Nicolas Pronost) Many research projects Gate Commit Commands Thesis and PhD projects Much interest from the industry 6 Practical aspects Meetings Tuesday 9.00 - 10.45 in UNNIK-517 Thursday 15.15 - 17.00 in ISRAELS-002 (Israëlslaan 118) Presence is mandatory If you cannot come for whatever reason • Hand in abstracts (on paper) during the meeting Website http://www.cs.uu.nl/docs/vakken/mpap/ Check the schedule Check regularly for announcements and changes Download papers Find the secret page 7 Assignments Present two papers Contents (10 min.), critical review (15 min.), discussion (15 min.) Write paper abstracts/assessments Only read the paper before your presentation One page per paper • Short abstract in your own words • Critical assessment – Main limitations and open problems – Surprising and innovative elements – Do the authors claim too much, make many assumptions, draw conclusions that are too general, not correctly setup their experiments? • Three questions or points for discussion Hand in the two pages (on paper) on the day of the presentation • Use headings: Summary, Assessment, Questions 8 Assignment 1 Study path planning/crowd simulation in a modern game Deliberately try to create problems • • • • 9 Destroy objects/buildings Stand in the way of moving characters Park a car on the sidewalks Let a character follow you while traversing a `difficult route’ Assignment 1 Collect video footage of issues that go wrong due to Collision-avoidance with entity, group of entities, or obstacle; e.g. a character • • • • • • • gets blocked; takes an illogical detour; does not avoid congested areas; passes through an obstacle or another character; makes sudden undesired directional changes; does not look ahead; walks through a group of interacting characters. Poor path planning and animation; e.g. a character • collides with another animated character; • takes an illogical detour (e.g. a shorter path exists that requires jumping or climbing); • takes an illogical action (e.g. it may walk through an object while jumping would be more logical). 10 Assignment 1 Procedure Investigate what goes wrong Make one video • • • • • • Use a 720p or 1080p resolution if possible; Compress your movie, and use a high bit-rate for the movie; Convert the video to a WMV-file Use e.g. Fraps for recording the movie You may include multiple examples Don't use transitions (e.g. fades) between clips or overlays (e.g. text); Present 3 slides next Tuesday (September 16) for discussion • • • • • 11 Name of the game, your names, picture, type of game The video Description of what goes wrong and why (according to you) Take with you on USB stick Explain and discuss (5 minutes) Some results of a previous assignment 12 Assignment 2 Choose between writing a paper or implementation Deadline • November 4 (23.59) • Use the Submit system Paper on path planning/crowd simulation in games • • • • Based on the problems extracted from assignment 1 Write a paper (10 pages) on how these problems can be solved Audience: a recommendation for the programmer of the game Try to be as critical on your own paper as you were on the paper you have reviewed Implement the RVO2 collision-avoidance method into our Crowd simulation framework • • • • 13 C++ Compare this method with two other (already integrated) methods A fair comparison is important Write a report Grading Game study Presentations Abstracts Paper/implementation 5% 20% + 20% 30% 25% To qualify for second change exam The original mark should at least be a 4; Actively participate in at least 13/17 of the meetings; Write at least 20/26 abstracts; Give both presentations satisfactory. 14 Grading You cannot pass the course if you skip assignment 1 or 2; one of your presentations; 5 or more meetings (out of 17 meetings); 7 or more abstracts (out of 26 abstracts). 15 Workshops Workshop 1 September 18 Crowd simulation • • • • Software and framework Collision-avoidance algorithms C++ Experimental research Workshop 2 November 4 A* Search • Understand the A* algorithm • Reason about its properties • Apply it to a range of problems 16 Schedule Week Date Topic Speaker Deadline 37 Sep 9 Introduction Teacher Read paper 0 Sep 11 Path planning in games Teacher Abstracts Sep 16 Current problems in games Everyone Assignment 1 Sep 18 Workshop I Teachers Sep 23 Path planning Students Abstracts Sep 25 Path planning Students Abstracts Sep 30 Social force-based models Students Abstracts Oct 2 Velocity-based models Students Abstracts Oct 7 Vision-based models Students Abstracts Oct 9 Flow Students Abstracts Oct 14 Flow Students Abstracts Oct 16 Crowds Students Abstracts Oct 21 Crowds, behavior Students Abstracts Oct 23 Behavior, massive crowds Students Abstracts Oct 28 Evaluation and validation Students Abstracts Oct 30 Evaluation and validation Students Abstracts Nov 4 Workshop II Teachers Assignment 2 38 39 40 41 42 43 44 45 17 Path planning Goal: bring characters from A to B through an environment Also vehicles, animals, camera, a formation, … Requirement: fast and flexible Real-time planning for thousands of characters Individuals and groups Dealing with local hazards Different types of environments 18 Path planning Goal: bring characters from A to B through an environment Also vehicles, animals, camera, a formation, … Requirement: fast and flexible Real-time planning for thousands of characters Individuals and groups Dealing with local hazards Different types of environments Requirement: visually convincing paths For example, the way humans move Low energy usage (smooth, short, minimal rotation/acceleration) Keep some distance (clearance) to obstacles Social behavior and rules (collision avoidance) … 19 Path planning algorithms in games Scripting Local approaches Flocking Cheating Networks of waypoints Grid-based A* Algorithms Navigation meshes 20 Do we need a new path planning algorithm? 21 differences Robotics Games Nr. entities Nr. DOFs CPU time Interaction Type path Correctness a few robots many DOFs much time available anti-social nice path fool-proof many characters a few DOFs little time available social visually convincing path may be incorrect Path planning errors in games 22 Path planning errors in games Networks of waypoints are incorrect Hand designed Do not adapt to changes in the environment Do not adapt to the type of character Local methods fail to find a route Keep stuck behind objects Lead to repeated motion Groups split up Not planned as a coherent entity Paths are unnatural Not smooth Stay too close to network/obstacles Methodology is not general enough to handle all problems 23 What we study in the course Methodology/framework that solves these problems Developed in Utrecht (still in development) Applications (characters, cameras, groups, crowds, …) Local character behavior How do people walk toward locations? How do they avoid each other? Must a path planning algorithm compute a path? Crowd behavior Flow models Planning approaches Massive crowds Crowd evaluation 24 The Explicit Corridor Map: Full/generic representation free space The Explicit Corridor Map Navigation mesh, or: a system of collision-free corridors Data structure: Medial axis + closest points to obstacles Computed efficiently by using the GPU or CPU Explicit Corridor Map (2D) 25 Explicit Corridor Map (multi-layered) The Explicit Corridor Map: Experiments City environment 26 Footprint and Explicit Corridor Map: 0.3s Corridors [macro scale] Computing a corridor: provides a global route Connect the start and goal to the medial axis Find corresponding shortest path in graph Corridor: concatenation of cells of the ECM Corridor 27 A corridor with small obstacles The Indicative Route Method [meso scale] The Indicative Route Method A path planning algorithm should NOT compute a path A one-dimensional path limits the character’s freedom Humans don’t do that either It should produce An Indicative/Preferred Route • Guides character to goal It uses a corridor Provides a global route Allows for flexibility 28 The Indicative Route Method [meso scale] “Algorithm” Compute a collision free indicative route from A to B Compute a corridor containing the route Move an attraction point along the indicative route • The attraction point attracts the character • The boundary of the corridor pushes it away • Other characters and local hazards push the character away 29 Local method [micro scale] Boundary force Find closest point on corridor boundary Perpendicular to boundary Increases to infinity when closer to boundary Force is 0 when clearance is large enough (or when on the MA) • Depends on the maximal speed of the character • Should be chosen such that oscillations are avoided Steering force Towards attraction point Can be constant Obtain path Force leads to an acceleration term Integration over time, update velocity/position/attraction point Yields a smooth (C1-continuous) path 30 IRM method Resulting vector field Indicative Route is short path 31 IRM method: Experiments City environment 32 Corridor and path: 2.8ms Crowd simulation Method can plan paths for a large number of characters Force model is used for local avoidance Path variation models are integrated, adding more realism Additional models can be incorporated easily Goal-oriented behavior Each character has its own long term goal When a character reaches its goal, a new goal is chosen Wandering behavior Attraction points do a random walk on the underlying graph 33 Collision-avoidance model Particle-based approaches E.g. Helbing model When characters get close to each other they push each other away Force depends on the distance between their personal spaces and whether they can see each other Disadvantages Reaction is late Also reaction when no collision Artifacts Goal force Avoidance force Resulting force 34 Improved collision-avoidance model Collision-prediction approach When characters are on collision course we compute the positions at impact (of personal spaces) Direction depends on their relative position at impact Force depends on the distance to impact Care must be taken when combining forces 35 Goal force Avoidance force Resulting force Improved collision-avoidance model Advantages Characters react earlier (like in real life) Characters choose routes that deviate only marginally from original route (energy efficient) Emergent behavior, e.g. lane formation and characters forming groups Fast (thousands of characters in real time) Helbing 36 Collision prediction Improved collision-avoidance model 37 Improved collision-avoidance model 38 Some previous work Also allow speed changes Deal with small groups 39 Further work Get different types of high-level crowd behavior Social behavior Collective behavior Incorporating semantics … Combine different types of moving entities People Bikes Cars Animals Combination of path planning and animation in 3D 40