So today I'm trying to get ORK framework working, and find where it stores stuff.
Their
getting started tutorial was last updated two years ago, which likely means there'll be glitches with Unity 2020. I tried it with 2019 and the scene wizard didn't appear in the relevant menu after importing the framework: instead there were errors in the console that a quick google-search suggested were Unity-2019-specific.
Unity 2020 works better, though the animation in part 3 of the tutorial does not play: not sure if that's a version thing, or just something I broke somehow.
Yikes, there are 50 tutorials in this chain, I'm only at tutorial 9. Some other day, then. I'll download the finished project, and see what I can learn from it.
Libraries
First, let's compile it, and see what libraries get included, just as part of ORK and Unity.
Wow, OK, there is NO Assembly-CSharp.dll or Assembly-CSharp-managed.dll! That's a shocker! Looks like the ORK framework works entirely without C#!
Equally, the only DLLs I see are core Unity ones, plus the ORK Framework. That suggests that all the libs we see in the Corven demo were either added by Corv, or by some other package he's using.
This blows most of my plans for reverse-compiling C# stuff right out of the water!
Well, now I've compiled it, that means I can find out where ORK stores its stuff...
Comparing
To find where stuff is stored, we need to, tweak some things to see which files change. First, let's change NOTHING.
I'm using this command from within a "Build" folder, to identify differences between the files in there, and the files in a "Build2" folder:
Code: Select all
find . | while read -d $'\n' file; do if [ -f "../Build2/$file" ] ; then diff "$file" "../Build2/$file"; fi ; done
That finds only:
Code: Select all
Binary files ./ORK Demo_Data/globalgamemanagers and ../Build2/./ORK Demo_Data/globalgamemanagers differ
Comparing them, it seems that file
contains a per-build unique hash (BuildGUID), which is the only thing that differs. I can apparently set a build option to zero out the GUID, so they wouldn't differ, but I don't know how to set that build option, and can't find it in a quick search. I can likely safely ignore changes in this file, though: ORK is unlikely to store its settings here.
Strings
I think Corven uses a different conversation library, so this may well be different... but strings are strings, so I expect them to be stored at least roughly in the same position.
Changing just a text string in dialog, I get:
Code: Select all
Binary files ./ORK Demo_Data/sharedassets1.assets and ../Build2/./ORK Demo_Data/sharedassets1.assets differ
That's where I expected text to be stored, so that doesn't really tell me anything new, though it does confirm that the "diff" process is working!
Events
Most of the complexity in ORK is abstracted away behind a clicky-clicky thing called "events" which are chained-together sequences of boxes in the editing UI, each box having properties.
So next, I'll change a simple boolean flag in an event script: turning off "Block Player Control" in the dialog event script.
Interesting. Still only the sharedassets1.assets file differs. Are event scripts stored as assets, then? Yes they are!
The above simple dialog event gets stored in the asset file as a bunch of Unity asset strings, which I call "UStrings", each comprised of: leading nulls to align to 4 bytes; a 4-byte little-endian int length; then the characters of the string.
Each event object seems to have a header of four strings, all fields that I recognize from the event's .asset file that ORK saves in the project folder when you create it. My comments after the dash, with the fieldname from the ORK file:
Code: Select all
simpleDialogue - the name of the event, "m_Name".
7/19/2020 8:35:54 PM - seems to be the time that I saved the event, "time".
2.29.3 - ORK framework version, not necessarily dotted numbers, I see Corven has "2.29.2 BETA". "time".
gameEvent - event type. "data.name".
Then comes this XML block, "data.xmlData" from the event .asset file, though in that file, the string contains many escape codes like \", \n and \t: in the sharedassets1.assets file, all those codes are replaced by the character they were encoding. The XML contains all the settings for the event, the whole thing again held in a UString. My comments after a dash:
Code: Select all
<gameEvent startIndex="0" > - Event type. In the Corven Demo I see startIndex sometimes being non-zero, not sure what it does.
<_bool blockingEvent="True" blockMoveAI="False" blockActorMoveAI="False"
blockControlMaps="False" clearFoundObjects="True" closeAllDialogues="False"
blockPlayer="True" blockCamera="True" clearBlocks="False" mainCamera="True"
cameraTag="False" destroyPrefabs="False" overrideNodeName="False" /> - Checkboxes from event properties, except the last three are new to me.
<_floatarrays>
<nodePosition 38 38 />
</_floatarrays> - Where the box is shown in the editor UI, in pixels.
<_string>
<cameraName><![CDATA[]]></cameraName>
<nodeName><![CDATA[]]></nodeName>
</_string>
<_subarrays>
<actor>
<0 type="1" memberIndex="0" > - Details of who is talking. In this case, type=1 means the player is talking.
<_bool isEventObject="False" isFindObject="False" onlyBattle="False"
useRoot="False" useSceneName="False" setName="False" />
<_string>
<childName><![CDATA[]]></childName>
</_string>
<_subarrays>
<portrait>
</portrait>
</_subarrays>
</0>
</actor>
<waypoint>
</waypoint>
<prefab>
</prefab>
<audioClip>
</audioClip>
<step>
<0 next="-1" > - This is the second box in the event.
<_bool active="True" overrideNodeName="False" />
<_floatarrays>
<nodePosition 38 133 />
</_floatarrays>
<_string>
<nodeName><![CDATA[]]></nodeName>
<_type><![CDATA[ShowDialogueStep]]></_type>
</_string>
<dialogue type="0" guiBoxID="1" notificationQueue="2" actorID="0"
portraitType="0" consoleTypeID="0" clipID="0" cancelNext="-1" >
<_bool waitClose="True" waitCloseNotControlable="False" lockFocus="False"
useSpeaker="True" atActorPosition="False" speakerName="True"
speakerPortrait="False" ownPortraitPosition="False" useTitle="False"
outputToConsole="False" useAudio="False" stopAudio="True"
onSpeaker="False" updateChoiceStates="False" allowCancel="False"
blockAccept="False" afterAudio="False" wait="False" />
<_floatarrays>
<posOff 0 0 />
</_floatarrays>
<_string>
<posChildName><![CDATA[]]></posChildName>
<childName><![CDATA[]]></childName>
</_string>
<_stringarrays>
<message>
<0><![CDATA[Hi, this is a simple dialogue!
It has been edited.]]></0> - Here's the text I modified in the Strings part of this post.
</message>
</_stringarrays>
</dialogue>
</0>
</step>
</_subarrays>
</gameEvent>
Most of this makes sense. XML implies there's a DOM, at least briefly when this data is read in and converted to some other in-memory format, which implies that script events MIGHT be modifiable using DOM manipulation?
The next step for events will be showing that they can be modified, and new ones created... preferably at runtime!
Other Settings
Events are kinda special in that they are saved as external files. Most other stuff in ORK is just "Settings". A lot of these seem to be saved in sharedassets0.assets, with a similar structure to the above: a header (usually just a name identifying the setting, eg "inputKeys", "battleEvent", "statusValues", etc), then a block of XML. So hopefully these can be handled much like events.
Next steps
That's enough for today, I think, but the next step probably has to be to find a way to find, modify and create events and other ORK values *at runtime*.
For this, it turns out there's a C# API at
http://api.orkframework.com/namespace_o ... ework.html.
It's a big API, but a guide to "where to find what" exists at
http://orkframework.com/tutorial/howto/ ... e-is-what/
But while there's an API, I don't know yet how to call the API on an existing project. Much to research!