Ags4 feature external dialog - #2978
ericoporto wants to merge 4 commits into
Conversation
a32404b to
0dc27e5
Compare
This comment was marked as resolved.
This comment was marked as resolved.
0dc27e5 to
9421332
Compare
c2fb925 to
e39c99e
Compare
DialogScript is made following/copying from Script class. This should not change behavior but be the initial change that will later allow to move Dialog files to be stored in separate DialogName.asd files
also adjust agsnative and handle file renaming
9d3d97e to
9933184
Compare
9933184 to
1903070
Compare
|
oh, you are right about intellisense. After your mention, I tried closing the file and running build again and it made the build work (!!!). @ivan-mogilko , if you want to play with my code, feel free, because I am lost what do I need to do for the loading in the upgrade game files and in the Dialog and DialogScript for it to work in the correct ags4 way. I wouldn't mind some light here of where to change what in my code...
You made this comment but I have no idea how to load the cdata xml stuff without the Dialog class knowing the old format. The main problem is the upgrade has I think I would need some way to access the XmlNode that contains the Dialogues before they are iterated, and then I would apply this on the node, and then I can get the dialog script with something like |
|
Can you describe the xml schema of the file in the PR description? |
|
Not sure what you mean but currently there isn’t, the current CDATA contents from the Dialog under the Script property is what would instead be migrated to its own file. Below is an example from don’t give up the cat would put a file dIntro.asd in the Dialogs directory with that content. @ivan-mogilko , I had one idea but not sure about it, but what if there was a property with a name like Legacy or Unprocessed, something like that, that had a type XmlNode that could store the unprocessed xml or point to it somehow, then the Upgrade process could pick it and use it directly. I don’t have an actual idea of how to deal with it. Also I don’t know how to fail the dialog node creation… This is because the upgrade process runs after Game object is created. |
|
The title and description in this PR may be misleading, you say that "Individual dialogues are saved with their name + ".asd" extension in a directory named Dialogs.", but it's not dialogs that are saved there, it's dialog scripts. The dialog objects are still in Game.agf. Or do you plan to move whole dialogs to separate files too? |
I could have made a mistake. As a variant, it may load script data from xml if it's present. But it needs to test if it's present, and dont treat the missing node as error. The process may be this:
You dont need to load Game again. |
|
It is currently only dialog scripts, but would it make sense to also have a pair xml file with the rest? This would ease following up version changes of the dialogs (in git). |
|
Whether it makes sense to have them separated from the project file is a question of project design. So far the rooms are only ones that have such organization to be stored in separate files. The rooms have their entries in Game.agf, that are loaded up on game load as UnloadedRoom objects, while Room objects are read from the external room file (it was the same both in 3.x with crm files and in 4.x with room folders). If dialogs follow the room-like organization, then the Game.agf should have a dialog reference that is loaded into some kind of a temporary object (UnloadedDialog?? or the Dialog object that has a indication that it is only partially loaded) which only has a dialog name and script name; and the actual Dialog object is created in memory by loading that external file later (either right after Game.agf finishes loading, or when the dialog is opened for editing / game is compiling). |
|
I can keep only the DialogScript separate as is, but the thing I really don’t like being in Game.agf is the Dialog Options, to me if they were just there in the directory they would be much easier to check in version control, merge and author. I don’t mind they not being part of the dialog script itself because I guess having them present separately allows easier check of consistency of the script. For now I don’t use them at all - I can’t just Dialog.Start(option), so what I have is a big switch clause and my own dialog system built on top, so I don’t particularly need them to be easy for me. |
|
I agree that dialog should be separate for working with multiple people. Each should have its own xml and script file, which will make it easier to track changes and reduce conflicts with game.agf. Now when it comes to bundling it all together it can be treated as it was before, where all the dialog data is available on game load (unlike rooms.) |
|
Loading on start is easy to do. You need to clarify what happens if the xml got modified externally while the project is loaded. Should it update dialog itself similar to how it updates scripts? |
I think it should be, but in my mind I was only thinking about dialog options, I have no idea how the rest of things could impact with their changes… |
|
Please add a todo note for the project upgrade: if "Dialogs" folder already exists, then it should be renamed. We do this for Rooms and Fonts alike. ags/Editor/AGS.Editor/Components/FontsComponent.cs Lines 583 to 588 in e6fe8b8 |
|
I already copy pasted that code there in the dialog components. But it runs AFTER the game is loaded, so not sure yet what happens if someone opens a project, let the upgrade run, and then don’t save the game and come back to the upgrade process, I think because of this they would lose their dialogs? |
There's exact same issue with Rooms and Fonts. |
|
Looks like common list beat us to the file extension (https://asdf.common-lisp.dev/asdf.html,) and we do have conflicts with From what I gather, "asc"/"ash" in our case was originally intended as "adventure script source/header" (as in .c/.h from C). This is an annotated but restricted "AGS Script" type of file, AGS Dialog Script? |

Fix #1008
Individual dialogues are saved with their name + ".asd" extension in a directory named Dialogs.
Still need to do: