[Utility] Encoder for creating basic (but extensive) new dialogues between player and one npc
Hello everybody,
here's a dialogue cli encoder for creating extensive dialogues between the player and one npc to be usable in your mods (as a w2scene). ONLY subtitle dialogues are supported. There is NO integration of any new audio samples. Also NO support for mouth/lipsync animations at this point.
This is not a beginners modding tool. I will provide some tutorials for presenting the features but you should have intermediate or advanced W3 modding knowledge.
I will upload the encoder to nexusmods as soon as I finish the tutorials to prevent questions which will be covered by the tutorials. I reconsidered since it takes too long to write the tutorials and the most important stuff is already covered, see link below.
The tool is compiled for 64bit windows.
Here's an overview:
the good:
the bad:
the ugly:
If any of these points is a deal-breaker for you then save your time by skipping the rest.
So here we are. You are willing to invest some time to add some depth to npc interactions in your mod by creating new dialogues. But first some prerequisites. I assume:
Since in the tutorials some directories are used as examples for configurations you have to exchange them accordingly with your local counterparts. So for the tutorials I assumed:
What the tutorials will cover
CRC for w2scene.exe
---------- Updated at 09:22 PM ----------
Part 1 - Basics + Encoding and in-game-testing
In this first part you will get some background (how dialogues are used in game) and step by step instructions how to get one of the provided dialogue examples into the game and how to test it.
First some theory
The W3 dialogue system is very powerful and is an essential part to the story telling of the game. Besides defining multiple flows of a conversation it also incorporates a flexible and configurable system for presenting conversations to the gamer. This includes amongst other things camera changes and defining animation and mimics for all participating actors. All pre configured settings (conversation flow, camera definitions/transitions, animation parameters, etc) are encoded as a w2scene file. All used strings/speech samples are stored as ids and reference the actual strings/speech samples in w3strings and w3speech files.
A w2scene can be played directly from scripts and can be triggered to be played by quest phases, too. In both cases the w2scene must be included as a dlc mod (adding it as a resource in the normal mods directory does NOT work).
Describing how a scene is triggered by quests is out of scope for this tutorial. So we will concentrate on playing it by using a w3 script. Unfortunately scripts cannot be included in dlc mods. This means the installation of a mod with w2scene dialogues requires to install two parts:
How to get a new dialogue into the game
To create new dialogues with this encoder the dialogue must be defined using a special text file format (more about this in the next part). Let's assume you already have all your definitions for a dialogue ready and want to try it out in the game. To demonstrate how this works we will create a new dialogue project and take the mini example from the encoder package named "minimal.example.yml".
First setup the dialog project directories and files
1. Copy the file "minimal.example.yml" from the "docs\minimal.example" directory into a new dialog project directory "c:\w3modding\dialog_tutorials\tutorial_1"
2. Create a new modeditor project named "moddlg_tut_1" in the modeditor project base directory, set the "Install as DLC" option in Mod/Mod Settings and save the project. This will create the subdirectories required for the next steps.
3. Copy the "reencode.bat" and "reencode-with-strings.bat" files from the encoder package into the tutorial_1 directory. These are some convenience batch files which perform multiple necessary steps at once.
4. Edit both batch files in the new directory and adjust the following path settings (don't worry if the dir_output and dir_dlc directories do not exist at this moment as they will be created on first batch usage):
Encode the example dialogue to a w2scene file and create a dlc mod
1. Open the windows command prompt, adjust the layout and history buffer of the window in the window properties to double the width and increased height to see the output unmangled. Then navigate to your dialog project folder dialog_tutorials\tutorial_1 using the command prompt, e.g:
2. Start the reencode-with-strings.bat file with the minimal.example as parameter (without the extension!) in the command prompt. This will load the example dialogue definitions, make some sanity checks, create a w2scene file and copy it to the destination path. It will also convert the strings csv created by the w2scene encoder to a w3strings file and copy it to the final dlc directory. Non existing target paths will be automatically created.
You should see more or less the following output:
Check your output for any errors! If there are errors you can add a --verbose or a --very-verbose parameter to the above batch command line. It may help to identify the error but be prepared to be flooded with debug messages. But you probably just have a typo somewhere in the batch file paths.
Please note: the batch files are only for development purpose. Normally, if you have multiple scenes and/or other strings you use in your mod you should merge all those strings into one csv, make sure you have no duplicate ids and create all localized w3strings files from this before publishing your mod.
3. Create a dlc mod with the modeditor
3.1 Reopen the dialog project with the modeditor. You should see your newly created w2scene in the dlc\moddlg_tut_1 directory in the mod editor explorer.
3.2 Pack and install the mod as dlc with the modeditor
At this point you should have the following files in the c:\The Witcher 3 Wild Hunt\dlc\moddlg_tut_1\content directory
Test the scene
1. Setup a dummy mod for the sceneplayer script by creating a new mod_dlgtest subdirectory in your Witcher 3 mods directory. The name is not really important as this is only for testing.
2. Create the content\scripts directory in the new mod dir and copy the "dummyScenePlayer.ws" script from the encoder root dir to it.
3. Edit and adjust the w2scene path and name in the dummy player script so the script looks like:
Note: If you want to create and test multiple scenes later on you have to make sure the names of your dummyplayer functions differ!
4. Start the game, enable subtitles, load a savegame, open the console, start the scene with "playscene()" and close the console.
If everything worked you should see the mini dialog scene at this point.
Hello everybody,
here's a dialogue cli encoder for creating extensive dialogues between the player and one npc to be usable in your mods (as a w2scene). ONLY subtitle dialogues are supported. There is NO integration of any new audio samples. Also NO support for mouth/lipsync animations at this point.
This is not a beginners modding tool. I will provide some tutorials for presenting the features but you should have intermediate or advanced W3 modding knowledge.
The tool is compiled for 64bit windows.
Here's an overview:
the good:
- easy creation of 1 vs 1 dialogues with multiple conversation flows based on player choices
- supports script calls from specific points in dialogues
- supports conditional conversation flow based on (quest)fact checking
- supports most choice icons
- automatic camera changes during dialogue (optional)
- supports custom camera changes
- supports defining custom camera settings
- supports attaching of animations and mimics (facial animation) from the game to actors
- supports dumping of camera settings, animation/mimic settings from existing scenes to examine how it was done by CDPR
the bad:
- the stage is set: positioning of player and npc is hardcoded at this moment (1.6m apart facing each other)
- no gui, so no visual feedback for camera definitions besides testing in-game. it's ok if you have good spatial imagination but nevertheless time consuming/difficult
- no support for adding new audio and no lipsync/mouth movement
- only rudimentary checks for validity of the dialogue definitions. You will have to use your brain (although society would argue that's a good thing)
the ugly:
- no visual feedback for animation timing and blending. You will strain your imagination skills. It's possible to get some nice results here and there but don't expect top notch results. And no results at all without pain.
- the generated w2scene file header still contains unknown bytes (e.g. wrong checksum) but the game ignores this anyway
If any of these points is a deal-breaker for you then save your time by skipping the rest.
So here we are. You are willing to invest some time to add some depth to npc interactions in your mod by creating new dialogues. But first some prerequisites. I assume:
- you are familiar with creating and installing a dlc mod (e.g. with Sarcen's editor)
- you have the debug console installed (required for testing)
- you have basic knowledge about using the windows command line
- you have notepad++ installed (other editors with YAML support are fine, too)
- you have read and understood the part about idspace in the w3strings encoder info
Since in the tutorials some directories are used as examples for configurations you have to exchange them accordingly with your local counterparts. So for the tutorials I assumed:
- your Witcher 3 installation is located in: c:\The Witcher 3 Wild Hunt\
- you have unzipped the encoder package into: c:\w3modding\dialog_encoder\
- you have a dialogue tutorial project base directory: c:\w3modding\dialog_tutorials\
- your modeditor project base directory for the tutorials will be: c:\w3modding\modeditor\
What the tutorials will cover
- Part 1 - some basics + encoding and in-game-testing
- Part 2 - creating your own dialogue - what's necessary
- Part 3 - creating a more interesting conversation - about dialogscript
- Part 4 - dialogue presentation - about cameras (difficulty: moderate/advanced)
- Part 5 - advanced presentation - actors in motion (difficulty: high tolerance of frustration required)
CRC for w2scene.exe
- size: 5083903 bytes
- md5: c6cb6b41adfe29480ed6d63bc5e17df5
- sha256: 66ba81b93b35dcba133856e93b82c93ca523d336c3b39d545c4abb171865f0a7
- size: 5041071 bytes
- md5: 10a09e41b1fc732dd6ac5e574de78361
- sha256: 6f06cd3dab38d515298a7d0ae22545c7038607360941d99891c871464cfb9f28
---------- Updated at 09:22 PM ----------
Part 1 - Basics + Encoding and in-game-testing
In this first part you will get some background (how dialogues are used in game) and step by step instructions how to get one of the provided dialogue examples into the game and how to test it.
First some theory
The W3 dialogue system is very powerful and is an essential part to the story telling of the game. Besides defining multiple flows of a conversation it also incorporates a flexible and configurable system for presenting conversations to the gamer. This includes amongst other things camera changes and defining animation and mimics for all participating actors. All pre configured settings (conversation flow, camera definitions/transitions, animation parameters, etc) are encoded as a w2scene file. All used strings/speech samples are stored as ids and reference the actual strings/speech samples in w3strings and w3speech files.
A w2scene can be played directly from scripts and can be triggered to be played by quest phases, too. In both cases the w2scene must be included as a dlc mod (adding it as a resource in the normal mods directory does NOT work).
Describing how a scene is triggered by quests is out of scope for this tutorial. So we will concentrate on playing it by using a w3 script. Unfortunately scripts cannot be included in dlc mods. This means the installation of a mod with w2scene dialogues requires to install two parts:
- a dlc mod with the w2scene and w3strings file into the witcher dlc directory
- a scripting mod with the scene playing script (and all other scripts required for your mod) into the witcher mods directory
How to get a new dialogue into the game
To create new dialogues with this encoder the dialogue must be defined using a special text file format (more about this in the next part). Let's assume you already have all your definitions for a dialogue ready and want to try it out in the game. To demonstrate how this works we will create a new dialogue project and take the mini example from the encoder package named "minimal.example.yml".
First setup the dialog project directories and files
1. Copy the file "minimal.example.yml" from the "docs\minimal.example" directory into a new dialog project directory "c:\w3modding\dialog_tutorials\tutorial_1"
2. Create a new modeditor project named "moddlg_tut_1" in the modeditor project base directory, set the "Install as DLC" option in Mod/Mod Settings and save the project. This will create the subdirectories required for the next steps.
3. Copy the "reencode.bat" and "reencode-with-strings.bat" files from the encoder package into the tutorial_1 directory. These are some convenience batch files which perform multiple necessary steps at once.
4. Edit both batch files in the new directory and adjust the following path settings (don't worry if the dir_output and dir_dlc directories do not exist at this moment as they will be created on first batch usage):
reencode-with-strings.bat:
set dir_encoder=c:\w3modding\dialog_encoder
set dir_output=c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1
set dir_dlc=c:\The Witcher 3 Wild Hunt\dlc\moddlg_tut_1
reencode.bat:
set dir_encoder=c:\w3modding\dialog_encoder
set dir_output=c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1
set dir_encoder=c:\w3modding\dialog_encoder
set dir_output=c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1
set dir_dlc=c:\The Witcher 3 Wild Hunt\dlc\moddlg_tut_1
reencode.bat:
set dir_encoder=c:\w3modding\dialog_encoder
set dir_output=c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1
Encode the example dialogue to a w2scene file and create a dlc mod
1. Open the windows command prompt, adjust the layout and history buffer of the window in the window properties to double the width and increased height to see the output unmangled. Then navigate to your dialog project folder dialog_tutorials\tutorial_1 using the command prompt, e.g:
cd \w3modding\dialog_tutorials\tutorial_1
2. Start the reencode-with-strings.bat file with the minimal.example as parameter (without the extension!) in the command prompt. This will load the example dialogue definitions, make some sanity checks, create a w2scene file and copy it to the destination path. It will also convert the strings csv created by the w2scene encoder to a w3strings file and copy it to the final dlc directory. Non existing target paths will be automatically created.
reencode-with-strings.bat minimal.example
You should see more or less the following output:
w2scene producer v0.3.2
INFO - ENCODING minimal.example to c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w2scene (strings csv: c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv)
INFO - scanning for repository files in c:\w3modding\dialog_encoder\repo
INFO - parsing yaml file: c:\w3modding\dialog_encoder\repo\example.animation.mimics.women.repo.yml
INFO - parsing yaml file: c:\w3modding\dialog_encoder\repo\example.animations.women.repo.yml
INFO - parsing yaml file: c:\w3modding\dialog_encoder\repo\example.repo.yml
INFO - assets in repository: 102
INFO - parsing yaml file: minimal.example.yml
INFO - sections in dialogscript: 6
INFO - special blocks in dialogscript: 0
INFO - production manifest:
INFO - settings:
INFO - > sceneid: 1
INFO - > strings idspace: 9999 start: 0
INFO - assets in scene: 4
INFO - > camera assets: 2
INFO - > actor assets: 2
INFO - > animation assets: 0
INFO - > mimic assets: 0
INFO - > mimic animation assets: 0
INFO - events in storyboard: 0
INFO - > sections with events: 0
INFO - building scene from definitions...
INFO - adding start section: section_start_input
INFO - adding dialog section ( 2 lines, 0 pause elements): section_geralts_choice_1
INFO - adding dialog section ( 2 lines, 0 pause elements): section_geralts_choice_2
INFO - adding dialog section ( 1 lines, 0 pause elements): section_start
INFO - adding choice section ( 3 choice elements): section_choice_start
INFO - adding end section: section_exit
INFO - creating w2scene
INFO - creating c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w2scene...
INFO - stored raw strings data chunk (offset: 000000a0 size: 2239b crc: df330d2f elements: 2239)
INFO - stored string mappings data chunk (offset: 0000095f size: 1120b crc: ee541880 elements: 140)
INFO - stored import mappings data chunk (offset: 00000dbf size: 16b crc: e5d9cabf elements: 2)
INFO - stored buffer mappings data chunk (offset: 00000dcf size: 16b crc: ecbb4b55 elements: 1)
INFO - stored object mappings data chunk (offset: 00000ddf size: 792b crc: 257db694 elements: 33)
INFO - stored objects data chunk (offset: 000010f7 size: 3779b crc: 17c9e0dd elements: 33)
INFO - finalizing header information
INFO - creating c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv...
INFO - storing 8 strings
w3strings decoder/encoder v0.3.2
INFO - ENCODING c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv to c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv.w3strings (testscript: c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv.w3strings.ws)
INFO - opening c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv...
INFO - identified language: en
INFO - verifying string ids are within [2119999000..2119999999]
INFO - creating c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv.w3strings...
INFO - storing language: en
INFO - storing 8 strings
INFO - creating c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv.w3strings.ws...
INFO - ENCODING minimal.example to c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w2scene (strings csv: c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv)
INFO - scanning for repository files in c:\w3modding\dialog_encoder\repo
INFO - parsing yaml file: c:\w3modding\dialog_encoder\repo\example.animation.mimics.women.repo.yml
INFO - parsing yaml file: c:\w3modding\dialog_encoder\repo\example.animations.women.repo.yml
INFO - parsing yaml file: c:\w3modding\dialog_encoder\repo\example.repo.yml
INFO - assets in repository: 102
INFO - parsing yaml file: minimal.example.yml
INFO - sections in dialogscript: 6
INFO - special blocks in dialogscript: 0
INFO - production manifest:
INFO - settings:
INFO - > sceneid: 1
INFO - > strings idspace: 9999 start: 0
INFO - assets in scene: 4
INFO - > camera assets: 2
INFO - > actor assets: 2
INFO - > animation assets: 0
INFO - > mimic assets: 0
INFO - > mimic animation assets: 0
INFO - events in storyboard: 0
INFO - > sections with events: 0
INFO - building scene from definitions...
INFO - adding start section: section_start_input
INFO - adding dialog section ( 2 lines, 0 pause elements): section_geralts_choice_1
INFO - adding dialog section ( 2 lines, 0 pause elements): section_geralts_choice_2
INFO - adding dialog section ( 1 lines, 0 pause elements): section_start
INFO - adding choice section ( 3 choice elements): section_choice_start
INFO - adding end section: section_exit
INFO - creating w2scene
INFO - creating c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w2scene...
INFO - stored raw strings data chunk (offset: 000000a0 size: 2239b crc: df330d2f elements: 2239)
INFO - stored string mappings data chunk (offset: 0000095f size: 1120b crc: ee541880 elements: 140)
INFO - stored import mappings data chunk (offset: 00000dbf size: 16b crc: e5d9cabf elements: 2)
INFO - stored buffer mappings data chunk (offset: 00000dcf size: 16b crc: ecbb4b55 elements: 1)
INFO - stored object mappings data chunk (offset: 00000ddf size: 792b crc: 257db694 elements: 33)
INFO - stored objects data chunk (offset: 000010f7 size: 3779b crc: 17c9e0dd elements: 33)
INFO - finalizing header information
INFO - creating c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv...
INFO - storing 8 strings
w3strings decoder/encoder v0.3.2
INFO - ENCODING c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv to c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv.w3strings (testscript: c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv.w3strings.ws)
INFO - opening c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv...
INFO - identified language: en
INFO - verifying string ids are within [2119999000..2119999999]
INFO - creating c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv.w3strings...
INFO - storing language: en
INFO - storing 8 strings
INFO - creating c:\w3modding\modeditor\moddlg_tut_1\files\dlc\moddlg_tut_1\minimal.example.w3strings-csv.w3strings.ws...
Check your output for any errors! If there are errors you can add a --verbose or a --very-verbose parameter to the above batch command line. It may help to identify the error but be prepared to be flooded with debug messages. But you probably just have a typo somewhere in the batch file paths.
Please note: the batch files are only for development purpose. Normally, if you have multiple scenes and/or other strings you use in your mod you should merge all those strings into one csv, make sure you have no duplicate ids and create all localized w3strings files from this before publishing your mod.
3. Create a dlc mod with the modeditor
3.1 Reopen the dialog project with the modeditor. You should see your newly created w2scene in the dlc\moddlg_tut_1 directory in the mod editor explorer.
3.2 Pack and install the mod as dlc with the modeditor
At this point you should have the following files in the c:\The Witcher 3 Wild Hunt\dlc\moddlg_tut_1\content directory
blob0.bundle
metadata.store
en.w3strings
metadata.store
en.w3strings
Test the scene
1. Setup a dummy mod for the sceneplayer script by creating a new mod_dlgtest subdirectory in your Witcher 3 mods directory. The name is not really important as this is only for testing.
2. Create the content\scripts directory in the new mod dir and copy the "dummyScenePlayer.ws" script from the encoder root dir to it.
3. Edit and adjust the w2scene path and name in the dummy player script so the script looks like:
PHP:
exec function playscene() {
var scene : CStoryScene;
scene = (CStoryScene)LoadResource( "dlc\moddlg_tut_1\minimal.example.w2scene", true);
theGame.GetStorySceneSystem().PlayScene(scene, "Input");
}
Note: If you want to create and test multiple scenes later on you have to make sure the names of your dummyplayer functions differ!
4. Start the game, enable subtitles, load a savegame, open the console, start the scene with "playscene()" and close the console.
If everything worked you should see the mini dialog scene at this point.
Last edited:


