This document discusses state-based scripting in games. It provides an introduction and history of state scripts, including their use on the Uncharted series. The author discusses why scripts are used in games and characteristics of scripting languages. Extending game object models through scripting and Naughty Dog's approach are also covered.
Talk by Yuriy O’Donnell at GDC 2017.
This talk describes how Frostbite handles rendering architecture challenges that come with having to support a wide variety of games on a single engine. Yuriy describes their new rendering abstraction design, which is based on a graph of all render passes and resources. This approach allows implementation of rendering features in a decoupled and modular way, while still maintaining efficiency.
A graph of all rendering operations for the entire frame is a useful abstraction. The industry can move away from “immediate mode” DX11 style APIs to a higher level system that allows simpler code and efficient GPU utilization. Attendees will learn how it worked out for Frostbite.
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero DawnGuerrilla
Download the full presentation here: http://www.guerrilla-games.com/read/putting-the-ai-back-into-air
Abstract: In this talk, we explain the technology behind the aerial navigation in Horizon Zero Dawn. In Horizon, we've represented the flyable air space by use of a run-time generated height map. Queries can be done on this height map for positional information and navigation. We present a hierarchical path planning algorithm for finding a progressively more detailed path between two points. Additionally, we will touch on some gameplay related subjects, to show the additional challenges we faced in implementing the different flying behaviors, such as transitioning from air to ground and guided crash-landing.
Scene Graphs & Component Based Game EnginesBryan Duggan
A presentation I made at the Fermented Poly meetup in Dublin about Scene Graphs & Component Based Game Engines. Lots of examples from my own game engine BGE - where almost everything is a component. Get the code and the course notes here: https://github.com/skooter500/BGE
Talk by Yuriy O’Donnell at GDC 2017.
This talk describes how Frostbite handles rendering architecture challenges that come with having to support a wide variety of games on a single engine. Yuriy describes their new rendering abstraction design, which is based on a graph of all render passes and resources. This approach allows implementation of rendering features in a decoupled and modular way, while still maintaining efficiency.
A graph of all rendering operations for the entire frame is a useful abstraction. The industry can move away from “immediate mode” DX11 style APIs to a higher level system that allows simpler code and efficient GPU utilization. Attendees will learn how it worked out for Frostbite.
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero DawnGuerrilla
Download the full presentation here: http://www.guerrilla-games.com/read/putting-the-ai-back-into-air
Abstract: In this talk, we explain the technology behind the aerial navigation in Horizon Zero Dawn. In Horizon, we've represented the flyable air space by use of a run-time generated height map. Queries can be done on this height map for positional information and navigation. We present a hierarchical path planning algorithm for finding a progressively more detailed path between two points. Additionally, we will touch on some gameplay related subjects, to show the additional challenges we faced in implementing the different flying behaviors, such as transitioning from air to ground and guided crash-landing.
Scene Graphs & Component Based Game EnginesBryan Duggan
A presentation I made at the Fermented Poly meetup in Dublin about Scene Graphs & Component Based Game Engines. Lots of examples from my own game engine BGE - where almost everything is a component. Get the code and the course notes here: https://github.com/skooter500/BGE
Killzone Shadow Fall: Threading the Entity Update on PS4jrouwe
On the PS3 the SPUs were too limited for doing typical entity logic (e.g. humanoids walking around and shooting), so all of our entity logic was running on a single thread. For the PS4 we adopted the "entity as a job" approach and developed a set of rules that entities have to adhere to. We also developed a way to validate these rules at runtime so that no race conditions occur. This presentation will also show how we spread out entity updates across frames. The resulting system has proven itself on the PS4 -- and there have been surprisingly few race conditions that were not easily caught.
A technical deep dive into the DX11 rendering in Battlefield 3, the first title to use the new Frostbite 2 Engine. Topics covered include DX11 optimization techniques, efficient deferred shading, high-quality rendering and resource streaming for creating large and highly-detailed dynamic environments on modern PCs.
We present the technology and ideas behind the unique lighting in MIRRORS EDGE from DICE. Covering how DICE adopted Global illumination into their lighting process and Illuminate Labs current toolbox of state of the art lighting technology.
Scalability for All: Unreal Engine* 4 with Intel Intel® Software
Unreal Engine* 4 is a high-performance game engine for game developers. Learn how Intel and Epic Games* worked together to improve engine performance both for CPUs and GPUs and how developers can take advantage of it.
For Battlefield 3, DICE took on its most difficult challenge so far. To raise the bar for character quality in games we developed our own deformation rig, combined it with the powerful ANT animation system (used in FIFA) and extensive motion capture usage. To create a believable experience we built and managed enormous amount of assets and ways of keeping these organized. The rigging process was one of the most challenging aspects of production, with the smallest change requiring an update for almost every single asset. With a modular rigging system and a flexible animation pipeline the production team could deliver on time and quality.
GDC 2011 Level Design in a Day. Summary & Introduction: Coray Seifert, Senior...LevelDesign InADay
Please note: There is a ton of good information in the notes sections of these presentations. Please download locally and view in PowerPoint to experience all the juicy details.
Killzone Shadow Fall: Threading the Entity Update on PS4jrouwe
On the PS3 the SPUs were too limited for doing typical entity logic (e.g. humanoids walking around and shooting), so all of our entity logic was running on a single thread. For the PS4 we adopted the "entity as a job" approach and developed a set of rules that entities have to adhere to. We also developed a way to validate these rules at runtime so that no race conditions occur. This presentation will also show how we spread out entity updates across frames. The resulting system has proven itself on the PS4 -- and there have been surprisingly few race conditions that were not easily caught.
A technical deep dive into the DX11 rendering in Battlefield 3, the first title to use the new Frostbite 2 Engine. Topics covered include DX11 optimization techniques, efficient deferred shading, high-quality rendering and resource streaming for creating large and highly-detailed dynamic environments on modern PCs.
We present the technology and ideas behind the unique lighting in MIRRORS EDGE from DICE. Covering how DICE adopted Global illumination into their lighting process and Illuminate Labs current toolbox of state of the art lighting technology.
Scalability for All: Unreal Engine* 4 with Intel Intel® Software
Unreal Engine* 4 is a high-performance game engine for game developers. Learn how Intel and Epic Games* worked together to improve engine performance both for CPUs and GPUs and how developers can take advantage of it.
For Battlefield 3, DICE took on its most difficult challenge so far. To raise the bar for character quality in games we developed our own deformation rig, combined it with the powerful ANT animation system (used in FIFA) and extensive motion capture usage. To create a believable experience we built and managed enormous amount of assets and ways of keeping these organized. The rigging process was one of the most challenging aspects of production, with the smallest change requiring an update for almost every single asset. With a modular rigging system and a flexible animation pipeline the production team could deliver on time and quality.
GDC 2011 Level Design in a Day. Summary & Introduction: Coray Seifert, Senior...LevelDesign InADay
Please note: There is a ton of good information in the notes sections of these presentations. Please download locally and view in PowerPoint to experience all the juicy details.
Developing applications and games in Unity engine - Matej Jariabka, Rudolf Ka...gamifi.cc
gamifi.cc team - Rudolf & Matej presented on local tech/mobile/games conference experience with Unity & game development in general.
We also list some other tools that might help you. First part covers business tips & reasons to use Unity.
How can we use Adobe Flash Stage 3D to make a multiplayer game on multiple devices using the same codebase?
This session will detail the challenges encountered when attempting to maintain high performance specifications on mobile devices and the guidelines used to succeed.
We will talk about the required production pipeline, provide performance tips and techniques, provide guidelines for deploying and debugging on iOS and Android and give an overview of the process, from start to finish
Maximize Your Production Effort (English)slantsixgames
Efficient Content Authoring Tools and Pipeline for Inter-Studio Asset Development
With the complexity of today's video games and their associated tight timelines, it is paramount for video game studios to have a highly efficient content authoring process and production workflow. With a trend towards outsourced development of game assets, there are additional considerations that are important for achieving optimal workflow between studios that are co-developing or sharing assets. This lecture gives valuable insight into how to create new content authoring tools and data transformation pipelines that promote efficient work flow for both internal and remote production teams. Specific considerations for outsourcing and worldwide development are made along the way.
Every video game runs on what’s called an ‘engine,’ which determines what the game can and cannot do.
In other words, the game engine is a set of tools for game development.
The tools available to the creator shape what kinds of creative work they’re going to end up making.
Similar to State-Based Scripting in Uncharted 2: Among Thieves (20)
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
State-Based Scripting in Uncharted 2: Among Thieves
1. State-Based Scripting in
Jason Gregory
Generalist Programmer
Naughty Dog, Inc.
Monday, April 6, 2009
2. Agenda
• Introduction to game scripting
• Extending the game object model
• State script syntax
• Case studies from
Uncharted 2: Among Thieves
• Implementation discussion
• Summary and some tips
Game Developers Conference 2009 2
Monday, April 6, 2009
4. Brief History of State Scripts
• Script system on Uncharted: Drake’s Fortune originally developed
for in-game cinematics (IGCs)
• Evolved into general gameplay scripting system
Game Developers Conference 2009 4
Monday, April 6, 2009
5. Brief History of State Scripts
• UDF IGC system revamped for heavy
use on Uncharted 2: Among Thieves
• Inspirations:
GOAL language used on Crash and Jak series
State objects from God of War engine
TM
Game Developers Conference 2009 5
Monday, April 6, 2009
6. Why Script?
• Scripting languages used in games since Quake C
• Primary benefits of script:
Takes pressure off engineering team
Code becomes data—rapid iteration
Empowers content creators
Key enabler of mod community
Game Developers Conference 2009 6
Monday, April 6, 2009
7. Why Script?
• Scripting languages used in games since Quake C
• Primary benefits of script:
I feel empowered!
Takes pressure off engineering team
Code becomes data—rapid iteration
Empowers content creators
Key enabler of mod community
Game Developers Conference 2009 6
Monday, April 6, 2009
8. Scripting Language Characteristics
• Two kinds of game scripting languages:
data definition languages
runtime languages
• Runtime scripting languages typically:
interpreted by virtual machine (VM)
simple and small—low overhead
accessible to designers and other “non-programmers”
powerful—one line of code = big impact
Game Developers Conference 2009 7
Monday, April 6, 2009
9. Choice of Language
• At Naughty Dog, we make heavy use of both data definition
and runtime script
Both based on PLT Scheme (a Lisp variant)
• Key benefits of Lisp-like languages:
Easy to parse
Data def and runtime code can be freely intermixed
Powerful macro system—easy to define custom syntax
Naughty Dog has a rich Lisp heritage—comfortable
Game Developers Conference 2009 8
Monday, April 6, 2009
10. Choice of Language
• Of course you don’t have to use Lisp!
• Data definition languages:
custom text format,
Excel comma-separated values (.csv),
XML, ...
• Runtime languages:
Python, Lua, Pawn (Small C), OCaml, F#, ...
• Many popular engines already provide a scripting language:
Quake C, UnrealScript, C# (XNA), ...
Game Developers Conference 2009 9
Monday, April 6, 2009
11. Extending the Game Object Model
• Every game engine has some kind of game object model
Defines all object types in game world
Often (but not always) written in an object-oriented language
• Scripting language often used to extend the native object model
• Many ways to accomplish this...
Game Developers Conference 2009 10
Monday, April 6, 2009
12. Game Object Model References
• Rob Fermier, “Creating a Data Driven Engine,” GDC, 2002
• Scott Bilas, “A Data-Driven Game Object System,” GDC, 2002
(http://www.drizzle.com/~scottb/gdc/game-objects.ppt)
• Alex Duran, “Building Object Systems: Features, Tradeoffs and
Pitfalls,” GDC, 2003
• Doug Church, “Object Systems,” presented at a game development
conference in Seoul, Korea, 2003
(http://chrishecker.com/images/6/6f/ObjSys.ppt)
• Jason Gregory, “Game Engine Architecture,” AK Peters, 2009
(http://gameenginebook.com)
Game Developers Conference 2009 11
Monday, April 6, 2009
13. Unreal’s Approach
• UnrealScript tightly integrated with C++ object model
Single-root class hierarchy with some add-on components
Classes defined in UnrealScript (.uc)
C++ header file (.h) automatically generated
Implementation in C++ or entirely in UnrealScript
Pawn.h Actor
generate
Pawn.uc
Pawn.cpp
Info Pawn Pickup ...
implement
implement
Scout Vehicle ...
Game Developers Conference 2009 12
Monday, April 6, 2009
14. Property-Centric / Componentized Designs
• Property-centric design used on Thief, Dungeon Siege, Age of
Mythology, Deus Ex 2 and others
Game object just a unique id (UID)
“Decorated” with various properties
(health, armor, weaponry, etc.)
Property encapsulates data + behavior
Armor: Light
Health: 200
Object Weapon: BFG
(UID)
AI: PlayerAlly
Weapon: Pistol
Game Developers Conference 2009 13
Monday, April 6, 2009
15. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components
Process
SsTrackGroupProcess SsProcess ProcessGameObject DynLight CameraControl ...
Character SimpleEnOty ...
...
Game Developers Conference 2009 14
Monday, April 6, 2009
16. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
Objects
host of add-on components that update
over Dme
Process
SsTrackGroupProcess SsProcess ProcessGameObject DynLight CameraControl ...
Character SimpleEnOty ...
...
Game Developers Conference 2009 14
Monday, April 6, 2009
17. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components Objects
with transform
and mesh
Process
SsTrackGroupProcess SsProcess ProcessGameObject DynLight CameraControl ...
Character SimpleEnOty ...
...
Game Developers Conference 2009 14
Monday, April 6, 2009
18. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components Base class for
all characters
Process
SsTrackGroupProcess SsProcess ProcessGameObject DynLight CameraControl ...
Character SimpleEnOty ...
...
Game Developers Conference 2009 14
Monday, April 6, 2009
19. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components Simple
animaDng
Process
object
SsTrackGroupProcess SsProcess ProcessGameObject DynLight CameraControl ...
Character SimpleEnOty ...
...
Game Developers Conference 2009 14
Monday, April 6, 2009
20. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components
Process
SsTrackGroupProcess SsProcess ProcessGameObject DynLight CameraControl ...
Character SimpleEnOty ...
Manages a State
Script instance ...
Game Developers Conference 2009 14
Monday, April 6, 2009
21. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components
Process
SsTrackGroupProcess SsProcess ProcessGameObject DynLight CameraControl ...
Manages a Character SimpleEnOty ...
chunk of
running script
...
code
Game Developers Conference 2009 14
Monday, April 6, 2009
22. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components
Process
SsProcess
Game Developers Conference 2009 14
Monday, April 6, 2009
23. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components
Process
SsProcess
SsInstance
Game Developers Conference 2009 14
Monday, April 6, 2009
24. Uncharted Engine’s Object Model
• Uncharted class hierarchy:
relatively shallow, single-root
host of add-on components
Process
ProcessGameObject
SsInstance DrawControl AnimControl ...
Game Developers Conference 2009 14
Monday, April 6, 2009
25. Charter
• World editor for
Uncharted is called
Charter
Place game objects
Edit object
properties
Control level
streaming
Game Developers Conference 2009 15
Monday, April 6, 2009
26. Uncharted State Scripts
• State scripts similar in many respects to property-centric model...
adds finite state machine (FSM) support
not specifically tied to “properties”
coarser-grained (one script per object)
• More like scripted extension to existing entity type...
... or a “director” that orchestrates actions of other entities
Game Developers Conference 2009 16
Monday, April 6, 2009
27. Anatomy of a State Script
• A state script is comprised of:
attributes
states
• States define object’s behavior via runtime script code:
response to events
natural behavior over time (update event)
transitional actions between states (begin/end events)
Game Developers Conference 2009 17
Monday, April 6, 2009
28. Anatomy of a State Script
State Script 1
Variables
State A State Script 2
On Update Variables
On Event1
State C
State B On Begin
On Begin On Event4
Game Developers Conference 2009 18
Monday, April 6, 2009
29. Anatomy of a State Script
State Script 1
Variables Event1
State A State Script 2
On Update Variables
On Event1
State C
State B On Begin
On Begin On Event4
Game Developers Conference 2009 18
Monday, April 6, 2009
30. Anatomy of a State Script
State Script 1
Variables Event1
State A State Script 2
On Update Variables
On Event1
State C
go to
On Begin
State B State B
On Begin On Event4
Game Developers Conference 2009 18
Monday, April 6, 2009
31. Anatomy of a State Script
State Script 1
Variables Event1
State A State Script 2
On Update Variables
On Event1
State C
go to
On Begin
State B State B
On Begin Event4 On Event4
Game Developers Conference 2009 18
Monday, April 6, 2009
32. Instantiating a State Script
• Attached to a native (C++) game object: Game
Object
designers extend or modify native
C++ object type State Script 1
define entirely new object types
Game Developers Conference 2009 19
Monday, April 6, 2009
33. Instantiating a State Script
• Attached to a native (C++) game object: Game
Object
designers extend or modify native
C++ object type State Script 1
define entirely new object types
• Attached to a trigger region:
convex volume Trigger Region
detects enter, exit and occupancy
State Script 2
Game Developers Conference 2009 19
Monday, April 6, 2009
34. Instantiating State Scripts
SsProcess • Placed as stand-alone object:
State Script 3
“director” orchestrates actions of
(stand‐alone) other objects (e.g. IGC)
Game Developers Conference 2009 20
Monday, April 6, 2009
35. Instantiating State Scripts
SsProcess • Placed as stand-alone object:
State Script 3
“director” orchestrates actions of
(stand‐alone) other objects (e.g. IGC)
• Associated with a task:
Task A
task = check point
Task B1 Task B2 script manages associated task
orchestrates AI encounters
Task C
State Script 4 controls player objectives
Task D
Game Developers Conference 2009 20
Monday, April 6, 2009
36. Instantiating State Scripts
SsProcess • Placed as stand-alone object:
State Script 3
“director” orchestrates actions of
(stand‐alone) other objects (e.g. IGC)
• Associated with a task:
Task A
task = check point
Task B1 Task B2 script manages associated task
orchestrates AI encounters
Task C
State Script 4 controls player objectives
Task D • Spawned by another state script
Game Developers Conference 2009 20
Monday, April 6, 2009
39. State Script Syntax
• State script defined as follows:
Don’t let Lisp syntax throw you!
Lisp syntax is all (parentheses)
(define-state-script ("kickable-gate")
Think C/C++ { } blocks (state ("locked")
• Parenthesized blocks highly )
...
context-sensitive in Lisp/Scheme (state ("opening")
...
)
(state ("open")
...
)
)
Game Developers Conference 2009 23
Monday, April 6, 2009
40. State Script Syntax
• State script defined as follows:
Don’t let Lisp syntax throw you!
Lisp syntax is all (parentheses)
(define-state-script ("kickable-gate")
Think C/C++ { } blocks (state ("locked")
• Parenthesized blocks highly )
...
context-sensitive in Lisp/Scheme (state ("opening")
...
)
(state ("open")
...
)
)
Game Developers Conference 2009 23
Monday, April 6, 2009
41. State Script Syntax
• State script defined as follows:
Don’t let Lisp syntax throw you!
Lisp syntax is all (parentheses)
(define-state-script ("kickable-gate")
Think C/C++ { } blocks (state ("locked")
• Parenthesized blocks highly )
...
context-sensitive in Lisp/Scheme (state ("opening")
...
)
(state ("open")
...
)
)
Game Developers Conference 2009 23
Monday, April 6, 2009
42. State Script Syntax
• State script defined as follows:
Don’t let Lisp syntax throw you!
Lisp syntax is all (parentheses)
(define-state-script ("kickable-gate")
Think C/C++ { } blocks (state ("locked")
• Parenthesized blocks highly )
...
context-sensitive in Lisp/Scheme (state ("opening")
...
)
(state ("open")
...
)
)
Game Developers Conference 2009 23
Monday, April 6, 2009
43. Event Handler Blocks
(define-state-script ("kickable-gate")
(state ("locked")
(on (event "kick")
... ;; handle "kick" event
• Each state contains zero or more )
(on (begin)
event handler blocks ... ;; do when state entered
)
(on (update)
... ;; do every frame
)
(on (end)
... ;; do when state exited
)
)
Game Developers Conference 2009 24
Monday, April 6, 2009
44. Event Handler Blocks
(define-state-script ("kickable-gate")
(state ("locked")
(on (event "kick")
... ;; handle "kick" event
• Each state contains zero or more )
(on (begin)
event handler blocks ... ;; do when state entered
)
(on (update)
... ;; do every frame
)
(on (end)
... ;; do when state exited
)
)
Game Developers Conference 2009 24
Monday, April 6, 2009
45. Event Handler Blocks
(define-state-script ("kickable-gate")
(state ("locked")
(on (event "kick")
... ;; handle "kick" event
• Each state contains zero or more )
(on (begin)
event handler blocks ... ;; do when state entered
)
(on (update)
... ;; do every frame
)
(on (end)
... ;; do when state exited
)
)
Game Developers Conference 2009 24
Monday, April 6, 2009
46. Event Handler Blocks
(define-state-script ("kickable-gate")
(state ("locked")
(on (event "kick")
... ;; handle "kick" event
• Each state contains zero or more )
(on (begin)
event handler blocks ... ;; do when state entered
)
(on (update)
... ;; do every frame
)
(on (end)
... ;; do when state exited
)
)
Game Developers Conference 2009 24
Monday, April 6, 2009
47. Event Handler Blocks
(define-state-script ("kickable-gate")
(state ("locked")
(on (event "kick")
... ;; handle "kick" event
• Each state contains zero or more )
(on (begin)
event handler blocks ... ;; do when state entered
)
(on (update)
... ;; do every frame
)
(on (end)
... ;; do when state exited
)
)
Game Developers Conference 2009 24
Monday, April 6, 2009
48. Runtime Script Code
• Runtime script code inside (on ...) (state ("locked")
(on (begin)
blocks [print-string "Starting idle!"]
[animate "self" "locked-idle"]
• Simplified Scheme/Lisp )
(on (event "kicked")
Most “commands” are native calls [when [lock-broken?]
into C++ code [print-string "BAM!"]
]
Conditional expressions [if [task-complete? "wave2"]
[print-string "Complete!"]
Simple looping via label/goto [print-string "NOT!!!"]
]
)
)
Game Developers Conference 2009 25
Monday, April 6, 2009
49. Runtime Script Code
• Runtime script code inside (on ...) (state ("locked")
(on (begin)
blocks [print-string "Starting idle!"]
[animate "self" "locked-idle"]
• Simplified Scheme/Lisp )
(on (event "kicked")
Most “commands” are native calls [when [lock-broken?]
into C++ code [print-string "BAM!"]
]
Conditional expressions [if [task-complete? "wave2"]
[print-string "Complete!"]
Simple looping via label/goto [print-string "NOT!!!"]
]
)
)
Game Developers Conference 2009 25
Monday, April 6, 2009
50. Runtime Script Code
• Runtime script code inside (on ...) (state ("locked")
(on (begin)
blocks [print-string "Starting idle!"]
[animate "self" "locked-idle"]
• Simplified Scheme/Lisp )
(on (event "kicked")
Most “commands” are native calls [when [lock-broken?]
into C++ code [print-string "BAM!"]
]
Conditional expressions [if [task-complete? "wave2"]
[print-string "Complete!"]
Simple looping via label/goto [print-string "NOT!!!"]
]
)
)
Game Developers Conference 2009 25
Monday, April 6, 2009
51. Runtime Script Code
• Runtime script code inside (on ...) (state ("locked")
(on (begin)
blocks [print-string "Starting idle!"]
[animate "self" "locked-idle"]
• Simplified Scheme/Lisp )
(on (event "kicked")
Most “commands” are native calls [when [lock-broken?]
into C++ code [print-string "BAM!"]
]
Conditional expressions [if [task-complete? "wave2"]
[print-string "Complete!"]
Simple looping via label/goto [print-string "NOT!!!"]
]
)
)
Game Developers Conference 2009 25
Monday, April 6, 2009
52. User-Defined Functions
(defun verbose-anim ((anim string))
[print-string "Starting " anim]
[animate "self" anim]
)
• Script functions can be defined
and called by script programmer (define-state-script ("kickable-gate")
(state ("locked")
(on (begin)
[verbose-anim "locked-idle"]
)
)
...
)
Game Developers Conference 2009 26
Monday, April 6, 2009
53. User-Defined Functions
(defun verbose-anim ((anim string))
[print-string "Starting " anim]
[animate "self" anim]
)
• Script functions can be defined
and called by script programmer (define-state-script ("kickable-gate")
(state ("locked")
(on (begin)
[verbose-anim "locked-idle"]
)
)
...
)
Game Developers Conference 2009 26
Monday, April 6, 2009
54. User-Defined Functions
(defun verbose-anim ((anim string))
[print-string "Starting " anim]
[animate "self" anim]
)
• Script functions can be defined
and called by script programmer (define-state-script ("kickable-gate")
(state ("locked")
(on (begin)
[verbose-anim "locked-idle"]
)
)
...
)
Game Developers Conference 2009 26
Monday, April 6, 2009
55. User-Defined Functions
(defun verbose-anim ((anim string))
[print-string "Starting " anim]
[animate "self" anim]
)
• Script functions can be defined
and called by script programmer (define-state-script ("kickable-gate")
(state ("locked")
(on (begin)
[verbose-anim "locked-idle"]
)
)
...
)
Game Developers Conference 2009 26
Monday, April 6, 2009
56. User-Defined Functions
(defun verbose-anim ((anim string))
[print-string "Starting " anim]
[animate "self" anim]
)
• Script functions can be defined
and called by script programmer (define-state-script ("kickable-gate")
(state ("locked")
(on (begin)
[verbose-anim "locked-idle"]
)
)
...
)
Game Developers Conference 2009 26
Monday, April 6, 2009
57. The “Self” Argument
• Any command operating on a game object takes its unique id
(UID) as its first argument
• Magic UID "self" refers to the object to which script is attached
gate‐17
Game
Object
State Script 1
Game Developers Conference 2009 27
Monday, April 6, 2009
58. The “Self” Argument
• Any command operating on a game object takes its unique id
(UID) as its first argument
• Magic UID "self" refers to the object to which script is attached
(on (begin)
gate‐17
[animate "self" "locked-idle"]
Game )
Object
State Script 1
self
Game Developers Conference 2009 27
Monday, April 6, 2009
59. The “Self” Argument
• Any command operating on a game object takes its unique id
(UID) as its first argument
• Magic UID "self" refers to the object to which script is attached
gate‐17 (on (begin)
Game [animate "gate-17" "locked-idle"]
Object )
State Script 1
Game Developers Conference 2009 27
Monday, April 6, 2009
60. The “Self” Argument
• Any command operating on a game object takes its unique id
(UID) as its first argument
• Magic UID "self" refers to the object to which script is attached
gate‐17
(on (begin)
Game [animate "lock-6" "fall-off"]
Object )
State Script 1 lock‐6
Game
Object
Game Developers Conference 2009 27
Monday, April 6, 2009
61. Changing States
(define-state-script ("kickable-gate")
(state ("locked")
• Transitions to other states via ...
(go "state-name") command (on (event "kicked")
[when [lock-broken?]
• State transitions cause current ]
[go "opening"]
state’s (on ...) blocks to be )
)
aborted (state ("opening")
(on (begin)
• Use (on (exit) ...) block for ...
clean-up )
...
)
)
Game Developers Conference 2009 28
Monday, April 6, 2009
62. Changing States
(define-state-script ("kickable-gate")
(state ("locked")
• Transitions to other states via ...
(go "state-name") command (on (event "kicked")
[when [lock-broken?]
• State transitions cause current ]
[go "opening"]
state’s (on ...) blocks to be )
)
aborted (state ("opening")
(on (begin)
• Use (on (exit) ...) block for ...
clean-up )
...
)
)
Game Developers Conference 2009 28
Monday, April 6, 2009
63. Changing States
(define-state-script ("kickable-gate")
(state ("locked")
• Transitions to other states via ...
(go "state-name") command (on (event "kicked")
[when [lock-broken?]
• State transitions cause current ]
[go "opening"]
state’s (on ...) blocks to be )
)
aborted (state ("opening")
(on (begin)
• Use (on (exit) ...) block for ...
clean-up )
...
)
)
Game Developers Conference 2009 28
Monday, April 6, 2009
64. Tracks
• (on ...) blocks contain one or more tracks
• A track is a bit like a thread or fiber
• Tracks can be put to sleep
Wait for duration
• e.g., wait 5 seconds,
• wait until frame 23, ...
Wait for an action to be done
• duration-agnostic
• Tracks can be synchronized via signals
Game Developers Conference 2009 29
Monday, April 6, 2009
65. Tracks
(state ("shake-hands") State "shake‐hands"
(on (begin) On Begin
(track ("player"))
[wait-move-to "player" "waypoint7"] Track Track
P S
[signal "player-at-waypoint"]
[wait-for-signal "sully-at-waypoint"]
[wait-animate "player" "shake-sullys-hand"] s‐a‐w
)
(track ("sullivan"))
[wait-move-to "sullivan" "waypoint7"]
[signal "sully-at-waypoint"] p‐a‐w
[wait-for-signal "player-at-waypoint"]
[wait-animate "sullivan" "shake-drakes-hand"]
)
)
)
Game Developers Conference 2009 30
Monday, April 6, 2009
66. Tracks
(state ("shake-hands") State "shake‐hands"
(on (begin) On Begin
(track ("player"))
[wait-move-to "player" "waypoint7"] Track Track
P S
[signal "player-at-waypoint"]
[wait-for-signal "sully-at-waypoint"]
[wait-animate "player" "shake-sullys-hand"] s‐a‐w
)
(track ("sullivan"))
[wait-move-to "sullivan" "waypoint7"]
[signal "sully-at-waypoint"] p‐a‐w
[wait-for-signal "player-at-waypoint"]
[wait-animate "sullivan" "shake-drakes-hand"]
)
)
)
Game Developers Conference 2009 30
Monday, April 6, 2009
67. Tracks
(state ("shake-hands") State "shake‐hands"
(on (begin) On Begin
(track ("player"))
[wait-move-to "player" "waypoint7"] Track Track
P S
[signal "player-at-waypoint"]
[wait-for-signal "sully-at-waypoint"]
[wait-animate "player" "shake-sullys-hand"] s‐a‐w
)
(track ("sullivan"))
[wait-move-to "sullivan" "waypoint7"]
[signal "sully-at-waypoint"] p‐a‐w
[wait-for-signal "player-at-waypoint"]
[wait-animate "sullivan" "shake-drakes-hand"]
)
)
)
Game Developers Conference 2009 30
Monday, April 6, 2009
68. Tracks
(state ("shake-hands") State "shake‐hands"
(on (begin) On Begin
(track ("player"))
[wait-move-to "player" "waypoint7"] Track Track
P S
[signal "player-at-waypoint"]
[wait-for-signal "sully-at-waypoint"]
[wait-animate "player" "shake-sullys-hand"] s‐a‐w
)
(track ("sullivan"))
[wait-move-to "sullivan" "waypoint7"]
[signal "sully-at-waypoint"] p‐a‐w
[wait-for-signal "player-at-waypoint"]
[wait-animate "sullivan" "shake-drakes-hand"]
)
)
)
Game Developers Conference 2009 30
Monday, April 6, 2009
69. Tracks
(state ("shake-hands") State "shake‐hands"
(on (begin) On Begin
(track ("player"))
[wait-move-to "player" "waypoint7"] Track Track
P S
[signal "player-at-waypoint"]
[wait-for-signal "sully-at-waypoint"]
[wait-animate "player" "shake-sullys-hand"] p‐a‐w
)
(track ("sullivan"))
[wait-move-to "sullivan" "waypoint7"]
[signal "sully-at-waypoint"] s‐a‐w
[wait-for-signal "player-at-waypoint"]
[wait-animate "sullivan" "shake-drakes-hand"]
)
)
)
Game Developers Conference 2009 30
Monday, April 6, 2009
70. Track Execution Over Time
• Rules for execution of code within a track:
Greedily consume instructions sequentially...
... until a [wait* ...] command encountered...
... then relinquish control until the action is complete
• NOTE: A [wait* ...] command doesn’t have to wait; for example:
[wait-seconds 0]
[wait-npc-move-to "pos-4"] when she’s already there
Game Developers Conference 2009 31
Monday, April 6, 2009
71. Options and Variable Declarations
• Options declared at top of
(define-state-script ("kickable-gate") script:
:initial-state "closed"
:declarations (decl-list
initial state
(var "num-attempts" :type int32)
(var "is-locked" :type boolean :default #t)
variable declarations
) debugging options
(state ("kicked")
...
)
...
)
Game Developers Conference 2009 32
Monday, April 6, 2009
72. Options and Variable Declarations
• Options declared at top of
(define-state-script ("kickable-gate") script:
:initial-state "closed"
:declarations (decl-list
initial state
(var "num-attempts" :type int32)
(var "is-locked" :type boolean :default #t)
variable declarations
) debugging options
(state ("kicked")
...
)
...
)
Game Developers Conference 2009 32
Monday, April 6, 2009
73. Options and Variable Declarations
• Options declared at top of
(define-state-script ("kickable-gate") script:
:initial-state "closed"
:declarations (decl-list
initial state
(var "num-attempts" :type int32)
(var "is-locked" :type boolean :default #t)
variable declarations
) debugging options
(state ("kicked")
...
)
...
)
Game Developers Conference 2009 32
Monday, April 6, 2009
79. Configuration Parameters
• All game objects have
properties (key-value pairs)
Property values edited in
Charter
Game Developers Conference 2009 34
Monday, April 6, 2009
80. Configuration Parameters
• All game objects have
properties (key-value pairs)
Property values edited in
Charter
Game Developers Conference 2009 34
Monday, April 6, 2009
81. Configuration Parameters
• Designers can create their
own free-form properties,
called tags meaning-of-life = 42
Simply type “key = value”
in Tags field
Game Developers Conference 2009 34
Monday, April 6, 2009
82. Configuration Parameters
• State scripts have read-only access to game object properties...
... and free-form tags
Game Developers Conference 2009 35
Monday, April 6, 2009
83. Configuration Parameters
• State scripts have read-only access to game object properties...
... and free-form tags
(define-state-script ("kickable-gate")
(state ("kicked")
(on (begin)
[wait-animate "self"
[tag-string "kick-anim"]
]
)
...
)
Game Developers Conference 2009 35
Monday, April 6, 2009
84. Configuration Parameters
• State scripts have read-only access to game object properties...
... and free-form tags
(define-state-script ("kickable-gate")
(state ("kicked")
(on (begin)
[wait-animate "self"
[tag-string "kick-anim"]
]
)
...
)
Game Developers Conference 2009 35
Monday, April 6, 2009
85. Configuration Parameters
• State scripts have read-only access to game object properties...
... and free-form tags
(define-state-script ("kickable-gate")
(state ("kicked")
(on (begin)
[wait-animate "self"
[tag-string "kick-anim"]
]
)
...
)
Game Developers Conference 2009 35
Monday, April 6, 2009
86. Data Definition and Runtime
(define-state-script ("kickable-gate")
• Offline data-definition language (state ("locked")
(on (begin)
(Scheme) is intermingled with [print-string "Starting idle!"]
[animate "self" "locked-idle"]
runtime code )
(on (event "kicked")
[when [lock-broken?]
[print-string "BAM!"]
]
[if [task-complete? "wave2"]
[print-string "Complete!"]
[print-string "NOT!!!"]
]
)
)
...
)
Game Developers Conference 2009 36
Monday, April 6, 2009
87. Data Definition and Runtime
(define-state-script ("kickable-gate")
• Offline data-definition language (state ("locked")
(on (begin)
(Scheme) is intermingled with [print-string "Starting idle!"]
[animate "self" "locked-idle"]
runtime code )
(on (event "kicked")
[when [lock-broken?]
[print-string "BAM!"]
]
[if [task-complete? "wave2"]
[print-string "Complete!"]
[print-string "NOT!!!"]
]
)
)
...
)
Game Developers Conference 2009 36
Monday, April 6, 2009
88. Data Definition and Runtime
class Vector3
{
private:
float x, y, z;
• Really no different than the public:
float Dot(const Vector3& b)
distinction between declarations {
return (x * b.x
and definitions in C++ + y * b.y
+ z * b.z);
}
...
};
Game Developers Conference 2009 36
Monday, April 6, 2009
89. Data Definition and Runtime
class Vector3
{
private:
float x, y, z;
• Really no different than the public:
float Dot(const Vector3& b)
distinction between declarations {
return (x * b.x
and definitions in C++ + y * b.y
+ z * b.z);
}
...
};
Game Developers Conference 2009 36
Monday, April 6, 2009