Merging code from different developers
Merging code from different developers
We have two programmers working on a project - I was wondering if you have any suggestions on merging code that uses the dialogue system? Thanks!
Re: Merging code from different developers
Hi,
Yes. My biggest suggestion is to not directly modify any Dialogue System scripts. The Dialogue System has hooks and virtual methods for just about anything you'd need to customize. If you ever come across a case where you think you might need to modify a Dialogue System script, please contact me first. I may be able to point you to a way to do it without customizing. And, if not, I'll add a way.
Apart from that, just use version control for code.
Assets such as dialogue databases are another matter. Think of them like any other asset, such as an image, audio clip, or animator controller. Only one person at a time should, for example, modify and push up a modified version of an audio clip. Version control can't reliably merge assets. If you need to have multiple people writing dialogue at the same time, use multiple databases or a multi-user authoring tool such as articy:draft, Arcweave, or Celtx.
Yes. My biggest suggestion is to not directly modify any Dialogue System scripts. The Dialogue System has hooks and virtual methods for just about anything you'd need to customize. If you ever come across a case where you think you might need to modify a Dialogue System script, please contact me first. I may be able to point you to a way to do it without customizing. And, if not, I'll add a way.
Apart from that, just use version control for code.
Assets such as dialogue databases are another matter. Think of them like any other asset, such as an image, audio clip, or animator controller. Only one person at a time should, for example, modify and push up a modified version of an audio clip. Version control can't reliably merge assets. If you need to have multiple people writing dialogue at the same time, use multiple databases or a multi-user authoring tool such as articy:draft, Arcweave, or Celtx.
Re: Merging code from different developers
Thanks - I'm setting up a system for multiple developers. The main problem is being able to display quests in the menu, which needs to take quest data from 2 or more databases.
The main problem is the Quest Log menu window. Is it possible to set up the project so that the static QuestLog class has data from more than one database?
The main problem is the Quest Log menu window. Is it possible to set up the project so that the static QuestLog class has data from more than one database?
Re: Merging code from different developers
I'm assuming you're using an Extra Databases component to load the databases at runtime.
At runtime, the Dialogue System creates a master database (DialogueManager.masterDatabase) in memory containing the contents of the Dialogue Manager's Initial Database and any other databases added by Extra Databases components, all lumped into the master database.
The QuestLog class operates on DialogueManager.masterDatabase, so it has access to all quests in all databases.
At runtime, the Dialogue System creates a master database (DialogueManager.masterDatabase) in memory containing the contents of the Dialogue Manager's Initial Database and any other databases added by Extra Databases components, all lumped into the master database.
The QuestLog class operates on DialogueManager.masterDatabase, so it has access to all quests in all databases.
Re: Merging code from different developers
I'm still having problems with the quests. The quest log menu only shows quests from the main database referenced by the Dialogue Manager in the scene.
I've had general problems with saving quests - I'm saving quest data outside the Dialogue System and then re-adding it to the database every time the scene is changed, otherwise the data is lost.
These are all ticked:
Dialogue Manager > include all item and quest data
Dialogue System Saver > Save across scenes
Dialogue System Saver > Restore state on start
I must be missing something.
I've had general problems with saving quests - I'm saving quest data outside the Dialogue System and then re-adding it to the database every time the scene is changed, otherwise the data is lost.
These are all ticked:
Dialogue Manager > include all item and quest data
Dialogue System Saver > Save across scenes
Dialogue System Saver > Restore state on start
I must be missing something.
Re: Merging code from different developers
Hi,
Is your Extra Databases component on the Dialogue Manager, and is it configured to only add the database(s) on Start and not remove them? If you're removing them on scene changes, for example, then their data wouldn't be in saved games.
What do you mean by the quest log menu? Do you mean dropdowns somewhere, such as in the "..." dropdown menus in dialogue entry nodes' Script and Conditions fields, or the dropdowns in a Dialogue System Trigger's Conditions > Quest Conditions? If you're referring to a Dialogue System Trigger, assign the database with the quest to the Dialogue System Trigger's Reference Database field. This field isn't used at runtime; it's only used to show options in the dropdowns. If you mean dialogue entry Script and Conditions fields, I recommend putting your quests in a main database (assigned to the Dialogue Manager's Initial Database) and using syncing the quests to the other databases so they'll be accessible in all databases.
Is your Extra Databases component on the Dialogue Manager, and is it configured to only add the database(s) on Start and not remove them? If you're removing them on scene changes, for example, then their data wouldn't be in saved games.
What do you mean by the quest log menu? Do you mean dropdowns somewhere, such as in the "..." dropdown menus in dialogue entry nodes' Script and Conditions fields, or the dropdowns in a Dialogue System Trigger's Conditions > Quest Conditions? If you're referring to a Dialogue System Trigger, assign the database with the quest to the Dialogue System Trigger's Reference Database field. This field isn't used at runtime; it's only used to show options in the dropdowns. If you mean dialogue entry Script and Conditions fields, I recommend putting your quests in a main database (assigned to the Dialogue Manager's Initial Database) and using syncing the quests to the other databases so they'll be accessible in all databases.
Re: Merging code from different developers
It won't work unfortunately. I must be missing something. For the Quest Log Menu - I just mean the one you can access from the main menu on pressing escape. Do you have any demos to show this working with two databases?
Re: Merging code from different developers
Ah, sorry, I thought you were talking about the QuestLog C# class or a Unity editor menu.
Make sure your quests' are in the active state (or the success/failure state if showing Completed quests), and that they have unique IDs.
Side note: For the quest tracker HUD (a different UI), tick the quest's Trackable and Track On Start checkboxes.
Here's an example scene:
DS_QuestsInTwoDBsExample_2022-09-22.unitypackage
(Note: I just updated the example to include 2 scenes to test out the save system's scene loading function. Make sure to add "Quests In Two DBs Scene 2" to build settings.)
Make sure your quests' are in the active state (or the success/failure state if showing Completed quests), and that they have unique IDs.
Side note: For the quest tracker HUD (a different UI), tick the quest's Trackable and Track On Start checkboxes.
Here's an example scene:
DS_QuestsInTwoDBsExample_2022-09-22.unitypackage
(Note: I just updated the example to include 2 scenes to test out the save system's scene loading function. Make sure to add "Quests In Two DBs Scene 2" to build settings.)
Re: Merging code from different developers
Thanks - your version does work. But this version doesn't seem to work - where the quests are set to the active state dynamically.
- Attachments
-
- quests_notworking.zip
- (10.54 KiB) Downloaded 26 times
Re: Merging code from different developers
Hi,
You probably noticed this warning in the Console window:
Dialogue System: Quest 'Quest In DB 2' doesn't exist. Can't set state to active
This is because Extra Databases adds the database(s) in Start, and you've set the Dialogue System Triggers to On Start. That would work if the 'Quest in DB 2' Dialogue System Trigger were in a subsequent scene. But since it's in the same scene as the Extra Databases, the Dialogue System Trigger is running its Start method first, before Extra Databases has loaded the database.
Instead, set the Dialogue System Trigger to On Save Data Applied, or use a Timed Event to trigger the Dialogue System Trigger after a frame, or do something equivalent. On Save Data Applied is similar to On Start except that it will wait until save data has been applied (if loading a saved game or changing scenes) or for the equivalent number of frames specified by the Save System component's Frames To Wait Before Apply Data property. If there's no Save System component or if Frames To Wait Before Apply Data is zero, it will wait until the end of the Start frame.
You probably noticed this warning in the Console window:
Dialogue System: Quest 'Quest In DB 2' doesn't exist. Can't set state to active
This is because Extra Databases adds the database(s) in Start, and you've set the Dialogue System Triggers to On Start. That would work if the 'Quest in DB 2' Dialogue System Trigger were in a subsequent scene. But since it's in the same scene as the Extra Databases, the Dialogue System Trigger is running its Start method first, before Extra Databases has loaded the database.
Instead, set the Dialogue System Trigger to On Save Data Applied, or use a Timed Event to trigger the Dialogue System Trigger after a frame, or do something equivalent. On Save Data Applied is similar to On Start except that it will wait until save data has been applied (if loading a saved game or changing scenes) or for the equivalent number of frames specified by the Save System component's Frames To Wait Before Apply Data property. If there's no Save System component or if Frames To Wait Before Apply Data is zero, it will wait until the end of the Start frame.