Sly 2:Game state: Difference between revisions

Add gallery of Sly 2 DAGs
m (Minor text fixes)
(Add gallery of Sly 2 DAGs)
 
(12 intermediate revisions by the same user not shown)
Line 1:
{{Infobox game mechanic
The '''DAG''' ('''D'''irected '''A'''cyclic '''G'''raph) is a data structure used in Sly 2 and Sly 3 to control the current state of 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>
|image=Sly 2 Palace DAG official.png
|caption=The official DAG for Sly 2 Episode 2
}}
 
The '''DAG'''game (state'''D'''irected '''A'''cyclic '''G'''raph) is a data structure used in Sly 2 and Sly 3 to control the current state of everything in 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 DAGcurrent game state is represented by a '''directed acyclic graph''' of nodes('''DAG'''), wherewhich eachis a directed graph with no cycles. Each node on the DAG is called a "{{Sly 2|Task|task"}}. For instanceexample, <codett>t1_follow_dmitri_on_streets</codett> is the task of tailing Dimitri in the "Follow Dimitri" job (the prefix <codett>t1</codett> indicates that it is a task in Episode 1, and <codett>follow</codett> 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}}
* {{color|dodgerbluelimegreen|1 – Available}}
* {{color|limegreendodgerblue|2 – Complete}}
* {{color|gray|3 – Final}}
 
All tasks in the DAG start offbegin as {{color|red|Unavailable}}. A task becomes {{color|dodgerbluelimegreen|Available}} once all of its predecessors are {{color|limegreendodgerblue|Complete}}. Tasks become {{color|limegreendodgerblue|Complete}} through conditions being met in the level scripts, and tasks become {{color|gray|Final}} through completing missions.
 
=== State Forcing ===
At all times, every task ''before'' an Available task must be Complete or Final. Additionally, every task ''after'' an Available task must be unavailable. It is possible to "force" a task to a particular state, which propagates throughout the DAG to ensure those conditions are always met.
 
== Missions ==
Tasks in the DAG can beare grouped into ''{{Sly 2|Mission|missions''.}}, Awhere each mission usually refersis totypically a particular job in the game's story. For instance, <codett>m1_follow</codett>{{check}} is the job "Follow Dmitri". (theThe prefix <codett>m1</codett> indicates that it is a mission in Episode 1), and <tt>follow</tt> is the codename for the mission.
 
IfWhen athe task belongsmarked to a mission andas the "exit" task" infor thata mission is Completed, then all the tasks in that jobmission become Final.
 
== Checkpoints ==
Some tasks are "checkpoint tasks". A task is considered a ''checkpoint task'' if it has some checkpoint data associated with it, including a particular character a location in the game world. When a{{Sly 2|Checkpoint|checkpoint task becomes Availabledata}}, thatwhich checkpoint is set as the ''latest'' checkpoint.includes
* the character to respawn as
* a location to spawn at
 
When a rollbackcheckpoint occurs,task thebecomes gameAvailable, uses the latestthat checkpoint tois set as the currentlatest character and their locationcheckpoint.
 
== 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
* Forcing the checkpoint task to Available (which may result in the states of other tasks being updated)
 
== ReferencesGallery ==
The following are all DAGs for Sly 2. The DAG for Episode 2 is the official DAG as the developers would have seen it. The rest are reconstructed from data structures in the game's memory.
 
<gallery mode="nolines" widths=200px heights=200px>
File:Sly2 Intro DAG.png|Sly 2 Intro (Cairo)
File:Sly2 Ep1 Nightclub DAG.png|Sly 2 Ep 1 (Nightclub)
File:Sly 2 Palace DAG official.png|Sly 2 Ep 2 (Palace)
File:Sly2 Ep3 Temple DAG.png|Sly 2 Ep 3 (Temple)
File:Sly2 Ep4 Prison DAG.png|Sly 2 Ep 4 (Prison)
File:Sly2 Ep5 Castle DAG.png|Sly 2 Ep 5 (Castle)
File:Sly2 Ep6 Train DAG.png|Sly 2 Ep 6 (Train)
File:Sly2 Ep7 Sawmill DAG.png|Sly 2 Ep 7 (Sawmill)
File:Sly2 Ep8 Blimp DAG.png|Sly 2 Ep 8 (Blimp)
</gallery>
 
== See also ==
 
*[[DAGviz]] - A tool for viewing and editing the DAG in real time
*[[Sly 1:GS]] - The game state struct in {{Sly 1}}.
 
==References==
<references />
 
[[Category:Game mechanics]][[Category:Game mechanics in Sly 2]][[Category:Game mechanics in Sly 3]]
{{Navbox Sly 2}}
 
[[Category:Game mechanics]]
[[Category:Game mechanics in Sly 2]]
[[Category:Game mechanics in Sly 3]]