Page 1 of 1

Odd Quest Machine Unity Behavior

Posted: Thu Aug 04, 2022 8:40 pm
by cptscrimshaw
Hi Tony,

I've been doing some thorough testing on the beginning portions of my game and have run into some unexpected behavior; it's a bit hard to describe, so I recorded a short video.



Here are the steps I used to recreate the issue:

1. Open Unity and start game
2. Run through dialogue that gives a quest, run out to mailbox, read mail which changes a Lua variable and the quest HUD (top right) updates to say "Return to Bartholomew"
3. Delete save game file and start game again. Do the exact same thing, but the quest HUD isn't updating (still shows "Check mailbox), even though the variable is showing true in the watch menu.

If I close and restart unity the exact same above steps yield the same results.

Not really sure how to diagnose the issue, so hoping you can help out. Happy to provide more information. I'm not getting any QM errors with Debug turned on. QM is giving me a ton of warnings saying that all of my quest instances aren't registered with QM, but I'm pretty sure that always happens.

Thanks!

Re: Odd Quest Machine Unity Behavior

Posted: Fri Aug 05, 2022 7:54 am
by Tony Li
Hi,
cptscrimshaw wrote: Thu Aug 04, 2022 8:40 pmQM is giving me a ton of warnings saying that all of my quest instances aren't registered with QM, but I'm pretty sure that always happens.
This happens most often when loading a game but the quests aren't assigned to your quest database. Are they all assigned to the quest database? Is that database assigned to the Quest Machine GameObject?

Are you restarting the game within the same play session? If so, how are you restarting it? SaveSystem.RestartGame() in C# or the equivalent SaveSystemMethods.RestartGame?

If this happens when you end a play session (e.g., exit play mode) and play again, then maybe it's related to AutoSaveLoad.

Re: Odd Quest Machine Unity Behavior

Posted: Sun Aug 07, 2022 1:41 pm
by cptscrimshaw
Hi Tony,

Thanks for the reply. All quests are assigned to the database and the database is assigned to Quest Machine.

I'm encountering this problem when exiting play mode, deleting the save game file, and starting over. Here is my AutoSaveLoad setup: https://ibb.co/d76NLGH

I tooled around with adjusting some settings, but nothing seems to fix the issue. I've noticed at other times QM seems to forget where it is in a quest (i.e., all node conditions are met and it doesn't move on to the next node even though it's true).

Anything else I might try?

Re: Odd Quest Machine Unity Behavior

Posted: Sun Aug 07, 2022 2:56 pm
by Tony Li
Please remind me -- what's the reason for the TimedEvent that enables AutoSaveLoad? You could try setting it to 2 frames if the reason is to wait for the SaveSystem's FramesToWaitBeforeApplyData.

If quests aren't being saved correctly, is it possible that some savers have wrong keys, such as keys with the same name but on different savers? Or QuestJournals in different scenes that don't have the same key?

Re: Odd Quest Machine Unity Behavior

Posted: Sun Aug 07, 2022 3:38 pm
by cptscrimshaw
The QuestJournal in each scene didn't have a key, so I tried adding one and that didn't help. It's on a prefab, so it is the same in every scene.

The TimedEvent was to account for some issues with UIS saving/loading properly - a suggestion you made a long time ago, which I unfortunately can't remember exactly why we did it. I tried setting it to 2 frames and removing it entirely and that didn't affect anything.

I have narrowed down the problem a bit. When repeating the steps at the top of the thread on a full build of the game, I don't have any issues. So it's only occurring in the editor.

Re: Odd Quest Machine Unity Behavior

Posted: Sun Aug 07, 2022 9:45 pm
by Tony Li
It could be one of two things (although I can't entirely discount some other possibility):

1. Some code is running only in the editor. Have you disabled domain reloading? If so, what version of the Dialogue System are you using?

2. Or it's a race condition. For methods of the same type -- such as Start() methods in scripts -- Unity generally doesn't guarantee the order in which it will run those methods. It could run them in one order in the editor and in a completely different order in a build. If this is the case, then there's still a danger that it could run them in the wrong order in some future build made for a different platform or some other significant difference like that. In this case, we'd need to identify which methods are running "at the same time" (e.g., both in Start()) and configure them to always run in the correct order.

Re: Odd Quest Machine Unity Behavior

Posted: Mon Aug 08, 2022 1:26 pm
by cptscrimshaw
I disabled domain reloading ages ago. DS version is 2.2.28.

Here is my script execution order if this offers any insight.

https://ibb.co/f4TDTpm
https://ibb.co/s2gG7KS

Any other ideas for me to try?

Thanks for all your sleuthing and help on this one.

Re: Odd Quest Machine Unity Behavior

Posted: Mon Aug 08, 2022 2:06 pm
by Tony Li
Hi,

To eliminate the possibility of a disabled domain reload issue, would you please back up your project and update DS and QM? Then try again in the editor to see if that fixes it.

If not, it's probably the second possibility. To help get to the bottom of that, here are two options:

1. Restart Unity to create a fresh Editor.log file.

2. Tick the Quest Machine GameObject's Debug Settings > Debug checkbox.

3. Reproduce the issue. Then send me the Editor.log file, along with a note about what data isn't right (e.g., quest id, quest node id).

Or zip up your Assets, Packages, and ProjectSettings folders and send those to tony (at) pixelcrushers.com along with reproduction steps.

Re: Odd Quest Machine Unity Behavior

Posted: Mon Aug 08, 2022 4:37 pm
by cptscrimshaw
Good news! I upgraded to the most recent version of DS and QM and the editor problem was fixed. Also, before I did that for testing purposes, I turned domain reloading back on and that also solved the problem. But with it off and the new versions, it appears to be working too.

Thanks again for your help!

Re: Odd Quest Machine Unity Behavior

Posted: Mon Aug 08, 2022 5:00 pm
by Tony Li
Hi,

Great! I was hoping that might be the issue. In the latest version, I updated a script that I had missed when updating the save system to support disabled domain reloading.