Importing articy draft strips

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Importing articy draft strips

Post by Tony Li »

That sounds like a good approach. If the lookup is time critical, you could make a lookup dictionary by Articy ID when the game starts. Then just look up the entry in the dictionary whenever you need to.
Raidenthequick
Posts: 34
Joined: Mon Jul 02, 2018 5:00 pm

Re: Importing articy draft strips

Post by Raidenthequick »

I ended up going with a different approach, I'm starting at the start node of the conversation and following links up to a number of times (ala a linked list basically) in order to "index" by number. Working well like that. Just thought I'd report back. Thanks for your guidance!
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Importing articy draft strips

Post by Tony Li »

I think that should work, but you might still want to double-check with the entry's Articy ID in case articy puts entries in a different order when do a lot of editing on a dialogue, such as adding and removing nodes.
Raidenthequick
Posts: 34
Joined: Mon Jul 02, 2018 5:00 pm

Re: Importing articy draft strips

Post by Raidenthequick »

Everything is working well now, but we are still getting a bunch of errors on InitializeLuaSubtables. We have strips of images still, like with "AlternatePortraits", and these cause errors in the attempted subtable parse. Is there any way to flag these to "ignore" somehow? Either in the importer (to not make them SUBTABLE__) or in the code. We don't actually need to parse these lua tables in our code, they're used by Dialogue System internally instead. Also in general in case we do have any other unrelated strips of unsupported data types, we'd like them to not error on this command call, since we still need it for other normal entity strips. Thanks!

EDIT: Nevermind, your strips patch you just gave me fixes this, DUH. Sorry, lol. Will this be going into a future update? Just curious. Thank you again, really appreciate it!!!
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Importing articy draft strips

Post by Tony Li »

Hi,

It's already committed to the release branch for the next release, which I'm trying to get out by the end of next week.
Raidenthequick
Posts: 34
Joined: Mon Jul 02, 2018 5:00 pm

Re: Importing articy draft strips

Post by Raidenthequick »

Hi Tony,

Thank you for your hard work on this so far.

I now have a problem regarding these strips and I'm wondering if you could provide some guidance. When we launch our game like normal in the editor with all our scenes pre-loaded in, the strips work fine. However, when testing from a fresh launch that goes to the title screen and then we do either "New Game" or "Continue", I believe something is blowing away the lua tables, as we're getting all empty tables rather than the initialized subtables. What could possibly be doing this? I suspect the save system is, but I've tried to track it down myself a bit and it's tough to know where/when these tables get cleared.

I'm doing InitializeSubtables() at runtime on a global init, it is DEFINITELY running only one time at the very beginning in both cases. It's just that a fresh launch somehow blows those tables away. Thanks.
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Importing articy draft strips

Post by Tony Li »

Hi,

By default, the first Dialogue Manager to come into existence in play mode will survive scene changes and replace any Dialogue Systems that would otherwise be loaded in subsequent scenes. Is it possible that the first Dialogue Manager (perhaps in the main menu or start scene) is configured differently and is not initializing subtables?
Raidenthequick
Posts: 34
Joined: Mon Jul 02, 2018 5:00 pm

Re: Importing articy draft strips

Post by Raidenthequick »

I don't believe we have any more than one Dialogue Manager. How would I check this to be certain? I breakpointed at Awake() on DialogueSystemController and it only ran once.

I'll explain a bit more about the difference between the two configurations. There are primarily 2 scenes that matter here, one is called "Launch" and the other "Global". Launch just has a script that loads in the beginning scenes needed for the beginning of the game:

Code: Select all

namespace Launch
{
    public class LaunchInit : MonoBehaviour
    {
        private void Awake()
        {
            Time.timeScale = 1.0f;
            SceneManager.LoadSceneAsync(1);
            SceneManager.LoadSceneAsync(2);
            SceneManager.LoadSceneAsync(3);
        }
    }
}
The first scene (index 1) is Global. Global scene has the Dialogue Manager, which is marked Don't Destroy On Load as well as "Allow Only One Instance", and there is only one I believe unless something is creating some dummy default instance of one (but again, I cannot see any evidence of that).

If I just launch Unity with Global already loaded in, everything works fine. It is when I use Launch as the only starting scene that the subtables seem to be blown away. Here's what I mean by that more explicitly:

I have debugged and found that in both cases, the InitializeLuaSubtables() is doing its job properly at first. But, come time to actually READ those tables, here is the difference:

With Global as a loaded-in scene off the get-go:

Code: Select all

public static List<Item> GetStrip(string itemName, string fieldName)
        {
            return DialogueLua.GetItemField(itemName, fieldName)
                .AsTable.Values.ToList().ConvertAll(item =>
                {
                    var wrapper = item as LuaTableWrapper;
                    return DialogueManager.MasterDatabase.GetItem((string)wrapper[Consts.Articy.Name]);
                }
            );
        }
This code returns a list of 4 Items. When using Launch as first scene, the same code returns 0 Items. So I can only assume that the tables have been blown away somehow. Any other tips would be most appreciated, thanks!
User avatar
Tony Li
Posts: 21059
Joined: Thu Jul 18, 2013 1:27 pm

Re: Importing articy draft strips

Post by Tony Li »

Hi,

Since you're loading Global asynchronously, is it possible that you're calling ArticyTools.InitializeLuaSubtables() before the Global scene is loaded? (Although I suspect not, since you said InitializeLuaSubtables() appears to be working correctly in both cases.)

Could something be initializing the Actor[] and Item[] tables again? Try setting the Dialogue Manager's Other Settings > Debug Level to Info. Then run from the Launch scene. Check the Console window to see where it's initializing the subtables. Then see if any subsequent lines reset the Actor[] and Item[] tables.

If that doesn't help, please feel free to send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look.
Raidenthequick
Posts: 34
Joined: Mon Jul 02, 2018 5:00 pm

Re: Importing articy draft strips

Post by Raidenthequick »

Hi, that helped, I found a point where it's resetting as you said. I checked the call stack and it was during this code:

Code: Select all

        /// <summary>
        /// Loads a saved game by applying a saved-game string.
        /// </summary>
        /// <param name='saveData'>
        /// A saved-game string previously returned by GetSaveData().
        /// </param>
        /// <param name='databaseResetOptions'>
        /// Database reset options.
        /// </param>
        public static void ApplySaveData(string saveData, DatabaseResetOptions databaseResetOptions = DatabaseResetOptions.KeepAllLoaded)
        {
            if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Resetting Lua environment.", new System.Object[] { DialogueDebug.Prefix }));
            DialogueManager.ResetDatabase(databaseResetOptions);
            if (DialogueDebug.LogInfo) Debug.Log(string.Format("{0}: Updating Lua environment with saved data.", new System.Object[] { DialogueDebug.Prefix }));
            Lua.Run(saveData, DialogueDebug.LogInfo);
            ExpandCompressedSimStatusData();
            RefreshRelationshipAndStatusTablesFromLua();
            if (initializeNewVariables)
            {
                InitializeNewVariablesFromDatabase();
                InitializeNewQuestEntriesFromDatabase();
                InitializeNewSimStatusFromDatabase();
            }
            Apply();
        }
It's during the "ResetDatabase" I believe.

So my suspicions were right, it had to do with save / persistent data stuff (one of the two, wasn't sure which). Should I add "InitializeLuaSubtables" just after this? Maybe in the "if (initializeNewVariables)" condition? (or is that unrelated?) Thank you.
Post Reply