Sly 2:Game state: Difference between revisions

Restructured article
(Fixed colors)
(Restructured article)
Line 3:
}}
 
The '''DAG'''Game (state'''D'''irected '''A'''cyclic '''G'''raph) is a data structure usedrefers to manage the current state of objects in the the game world. It was the subject of a 2005 GDC presentation by Bruce Oberg, the Principal Engineer at Sucker Punch.<ref>[https://www.gdcvault.com/play/1020295/The-Picture-Worth-a-Thousand The Picture Worth a Thousand Bugs] - YouTube, 3 April 2021 (archived from a 2005 GDC conference)</ref>
 
== Tasks ==
The current game state is represented by a '''D'''irected '''A'''cyclic '''G'''raph, or '''DAG''', which is a data structure comprised of a directed graph ofwith nodes,no wherecycles. eachEach node on the DAG is called a ''task''. For instanceexample, <tt>t1_follow_dmitri_on_streets</tt> is the task of tailing Dimitri in the "Follow Dimitri" job (the prefix <tt>t1</tt> indicates that it is a task in Episode 1, and <tt>follow</tt> is the codename for the "Follow Dimitri" job).
 
=== Task States ===
Each task has a ''state'', value which iscan be one of the following:
 
*{{color|red|0 – Unavailable}}
Line 16:
*{{color|gray|3 – Final}}
 
All tasks in the DAG start offbegin as {{color|red|Unavailable}}. A task becomes {{color|limegreen|Available}} once all of its predecessors are {{color|dodgerblue|Complete}}. Tasks become {{color|dodgerblue|Complete}} through conditions being met in the level scripts, and tasks become {{color|gray|Final}} through completing missions.
 
===State Forcing===
Line 22:
 
==Missions ==
Tasks in the DAG can beare grouped into ''missions''., where Aeach mission usuallyis referstypically to aone particular job in the game's story. For instance, <tt>m1_follow</tt>{{check}} is the job "Follow Dmitri". (theThe prefix <tt>m1</tt> indicates that it is a mission in Episode 1, and <tt>follow</tt> is the codename for the mission).
 
If a task belongs to a mission and the ''exit task'' in that mission is Completed, then all the tasks in that job become Final.
 
==Checkpoints==
A task is considered a ''checkpoint task'' if it has some checkpoint data associated with it, including a particular character and location in the game world. When a checkpoint task becomes Available, that checkpoint is set as the ''latest'' checkpoint.
 
== Rollbacks==
A rollback is when the game state rewinds the DAG to an earlier state (such as when the player dies). This is accomplished by:
*Resetting the world
*Placing the player at the latest checkpoint