This idea is haunting me for a long time. I’ve been working on an awesome open source BPM and workflow software and after making a complex helpdesk process I finally experienced the benefit of the BPMN standard.
For those who just heard of it, according to Wikipedia:
Business Process Model and Notation (BPMN) is a standard for business process modeling that provides a graphical notation for specifying business processes in a Business Process Diagram (BPD), based on a flowcharting technique very similar to activity diagrams from Unified Modeling Language (UML). The objective of BPMN is to support business process management, for both technical users and business users, by providing a notation that is intuitive to business users, yet able to represent complex process semantics. The BPMN specification also provides a mapping between the graphics of the notation and the underlying constructs of execution languages, particularly Business Process Execution Language (BPEL).
The idea is to create game logic / puzzle dependency (GLPD) charts but to take it one step further:
If we can stick to an standard then we can use any BPNM graph tool to create our GLPD map. After we have our map we could export it in a native BPNM file and parse it somehow on the game engine.
With this we will not only be able to see our current gamestate, but use it as a multithreaded state machine!
The engine will take care of advancing between states (BPMN tasks) and we will update only variables through scripting.
We then can benefit from scripting to check whether we are in a certain GameState or a puzzle is active/started/completed.
This is handy to avoid complex individual checks. For example:
[S001] ::McNulty:: I need to visit the crime scene, interview the wife and look for historical records on the library”
[S002] ::McNulty:: I got everything I need now, I should go to the station.
Similarly this may help setting up conditionals pretty quick:
[S002] ::McNulty:: I don’t need to go there again.
This sounds great, but what does the BMPN format provide to us?
Let’s try to draw a this example on yEd and see what can we use in our engine.
Ate the very least we need:
- Connection From
- Connection To
- Connection Label (this will be our conditionals)
This will mean that when the game start will be at the state S001 which will be completed after the intro. After that, 3 parallel tasks are set active (Find Evidence, Find Records, Interview Wife)
When each task condition is fulfilled, we reach a new state S002
We can poll at any time the game state and use it as conditions in our script executions:
[S001] ::Omar:: Hello --> Will say the line if the task S001 is active
[!FindEvidence] ::Omar:: Hello --> Will say the line if the task FindEvidence is not started
[*Interview] ::Omar:: Hello --> Will say the line if the task Interview is completed
With this approach we can segmentate our logic into virtual “chapters” making it easier for the devs to plan progress. We found that it is easy to mess things up or miss possibles scenarios if we check for the conditions instead.
[S002] is simpler than
[FindEvidence && FindSnippet && AskedMoney]
Another advantage is the future inclusion of a condition, lets say we wish to add a new requirement to advance to S002, that would mean checking all the scripts that reference the conditionals and update them. A total caos.
Of course this approach is not new (Good Reading: http://thewebsiteisdown.com/twidblog/puzzle-dependency-graph-primer/) but being backed up by the BPMN standard we can transform a simple graphic into a multi threaded state machine that keep tracks of our run-time game logic!!!
We just need to parse the graph XML output into a custom script in our engine (in our case unity) and we suddenly have a visual game planner.
And once in game we just update or conditional variables:
[VisitCrimeScene = true]
In the following post we will explore the graphs formats and we will try a simple implementation of this idea.