Few words about plots.
In the original Dragon age origins the plots are standalone scripts attached to objects similarly with Unity.
Unreal engine and C++ do not use similar patterns, so implementing plots required some sort of conversion mechanism.
Plots in Dragon age origins are basically a list of main and defined flags and the script itself handles getters and setters of said flags and the actions associated with them.
Now the porting to unreal engine and C++ was a bit tricky. This is the current approach:
- plots in DAO have a resource ID and a GUID.
- The plots resource ID is an integer that was used to track it in the DAO toolset SQL database
- the plots GUID was used by the DAO engine to find the plots and its elements in the various custom resource files such as GFF or ERF files
- in unreal engine I took the resource ID and I created a Json file with the plot flags that I named XXX.json, where the XXX is the resource ID
- after that I took the GUID, converted it to string, FNV64 hash it into int64 (with very low hash collision) and used the new 64- bit integer into a switch table.
- I created a C++ script to keep track of all the plots hash, and their flags.
- I keep track of the flags by using the plot resource ID(int32) and appending the plot ID with three zeros in between so that I avoid plot flags ID collisions
- for example let’s say that I have a plot with resource ID 12345.
- The flags associated with this plot would be integers using the following form: 12345000X
- so a main flag 1 would become 123450001 and a defined flag 256 would become 12345000256
- in the switch table I keep track of the plots getters and setters and the actions associated with them
- Plots are being saved and persistent when traveling between levels, so for example if I talk to the barkeep in level I and decline to take his sword quest, and traveled to level II and talk to the bandit and then come back to level I, the barkeep conversation starts from the declined quest branch, based on plot flags that are persistent between levels
And that’s pretty much all.