Help with making a mod (1 Viewer)

Yokayo

Potential Patron
Joined
Apr 3, 2017
Hello, I've been playing the game for a while and it's been pretty fun, especially with mods. But what I lack is the ability to write dialogues in my native language so I don't have to be distracted by unusuality of the text. So I thought I could make a mod to add (or replace the original fonts with) my custom alphabet. Could you give me a tip, a link to a guide or something, which would tell me where to go and how to do this? Thanks.
 

stuntcock

Content Creator
Joined
Jun 5, 2012
Hello Yokayo. Welcome to the Undertow forum.

But what I lack is the ability to write dialogues in my native language so I don't have to be distracted by unusuality of the text. So I thought I could make a mod to add (or replace the original fonts with) my custom alphabet.
This might not be possible in the vanilla game. SDT is somewhat limited in its text-display features. Dialogue writers commonly use the Cyrillic character "Б" as a timing mechanism because the dialogue engine will not display it on-screen and the character's mouth will not pronounce it. SDT is unfriendly to Russian players, but English writers have a very convenient way to inject pauses into a character's speech.

It may be possible to overcome this limitation with a mod written for the SDT Loader. Alternatively, we might find that your language is already supported by SDT. Which language or character-set do you intend to use?

Could you give me a tip, a link to a guide or something, which would tell me where to go and how to do this?
This link won't help you with the character-display question. But if you intend to write and customize dialogues (rather than merely translate existing dialogues) then you'll definitely want to bookmark the Dialogue Guide.

Even if you do intend to only translate then it's still important to understand the principles involved (such as syntax and trigger types). If you translate the standard trigger names then the dialogue would work incorrectly; words such as "first_throat" should be left in English.
 

Yokayo

Potential Patron
Joined
Apr 3, 2017
Thanks, I'm familiar with the basics of dialogues writing, I've already written some.
Which language or character-set do you intend to use?
It's exactly which you mentioned SDT was the least friendly to - Russian.
 

stuntcock

Content Creator
Joined
Jun 5, 2012
It's exactly which you mentioned SDT was the least friendly to - Russian.
You'd probably benefit from speaking to people more experienced with the inner mechanisms of dialogue, particularly @Pim_gd. If any of those folks are reading this thread then please feel free to jump in. In the meantime I'll try to share some information.

As I understand there are two basic problems:
  • fonts. SDT relies on a built-in font (Raleway Thin) which includes the Latin alphabet and a few accented Latin characters for western Europe. The game includes one Kanji and a few Katakana which are used to spell the game's Japanese title.
    • the game is unable to render any other glyphs, although its code is able to handle them for file I/O and process them in String format.
    • also: the code is racist in a few places. The in-game dialogue editor doesn't even allow Cyrillic text to be inserted, but that's OK because nobody uses the in-game editor anyways.
    • people have done work on font substitution previously. I don't remember what the outcome was, and I don't think that language support was their goal (IIRC they were attempting to use different fonts in order to convey different attitudes or personalities). I'll need to lookup the results of that work.
    • we'll still need to exclude at least one visible Unicode character, so that it can be employed by dialogue writers as a "pause" marker. Maybe the dotted circle. Nobody would be offended if we sacrifice ◌, right?
  • phonemes. SDT maps English vowels and consonants onto a set of pre-established mouth shapes.
    • The shapes are: MouthShapeUH, MouthShapeFF, MouthShapeMM, MouthShapeAH, MouthShapeEE, MouthShapeUH, MouthShapeOH, MouthShapeOO, MouthShapeUH.
    • The mapping is hardcoded and cannot be extended via configuration. If you were able to fix the font issue and get Cyrillic text to appear in-game, then the girl's mouth would remain closed throughout each "spoken" line.
    • A Loader mod can be written to extend the mapping. This would not become a standard part of SDT, because the use of Cyrillic as a "pause" mechanism is too widespread. If we distribute this mod as an official "upgrade" then it would break a huge number of existing Dialogues. This mod would presumably be used by Russian players only.
    • I can probably write the mod using simple linguistic data available on the internet. But I've never studied Russian and could easily make a mistake, so the work would require review by Russian speakers. I don't even know whether AS3 regexes support Unicode (i.e. whether they can easily recognize uppercase and lowercase variations of Cyrillic characters).
    • I'm not going to begin working on this until the Font issue is resolved. There's no sense in fixing the mouth animations if the actual words remain invisible.
tl;dr - we can probably fix this, but it will take a little while.

I must admit that we've definitely excluded Russian players in the past, but that's due to laziness rather than prejudice. Please feel free to continue writing in the meantime, but if you prefer to take a break then that's fine. I can't guarantee that this work will be successful, and if you want to avoid any risk of wasted effort then waiting is the safest course.

Note: if the work is successful then I would also encourage you to share your dialogues on the Undertow website. You're free to share them on Russian-speaking forums or websites of course, but there may be other native Russians here who would your work.
 

stuntcock

Content Creator
Joined
Jun 5, 2012
I don't have a definite solution for the font issue, but there's an easy workaround.

Various people had previously experimented with font switching. It's fairly easy to do because it's a standard parameter at the top of the Dialogue file. Unfortunately, users had reported that the text would be cut off at the end of the first line; any additional text would be lost. This was very inconvenient for writers because they would need to manually chop their writing into one-line fragments.

Fortunately, this isn't an inherent problem with word wrapping. It's just a quirk of the vertical scrolling behavior of the TextField class. The replacement fonts which people tested (such as Arial and Comic Sans) were slightly taller than the default one (Raleway Thin). We would expect Flash to scroll down automatically (e.g. obscuring a few upper pixels from the first line of text, in order to display the second line of text) but it doesn't do so. It can only scroll in whole-line increments and it doesn't want to do so (because "hardcoding", I assume. I'm still looking into the details).

But we can easily avoid this problem by using a shorter font. "Console" works for me. The following tests were run on vanilla 1.21.1b.

Code:
dialogue_name:"Font Test"
font:"Console"
all:"CLEAR"
intro:"Lorem ipsum dolor sit amet, cum an agam aeque argumentum, ne duo dicat ceteros menandri. Nam rebum utroque similique cu, ut labores veritus intellegat per. Quem propriae recteque cum at, at hinc aliquam nam. Cu numquam accumsan vituperatoribus vel, eu pro dolores nominavi vituperatoribus."
first_throat:"Лорем ипсум долор сит амет, фалли яуидам неморе вих ет, цум нуллам алиенум цонцлудатуряуе но. Аутем лудус ет вим, те меис дебитис хас. При долоре бонорум партиендо ет, ид про иллум доценди симилияуе. Ан веро сале сит, меа ид анциллае сусципиантур. Ад минимум пробатус вим, темпор молестие инцидеринт хас еа. Яуо дицта сусципит елояуентиам ад, при репудиаре адолесценс ид."

893aPZu.jpg

English speech, default font


FXM7cHZ.jpg

Attempting to speak Russian, default font


HcMZVHk.jpg

English speech, Console custom font


zgW8jDo.jpg

Russian speech, Console custom font​

Yokayo Yokayo : could you please repeat this test on your PC? You don't need to use my test file; you should be able to include the font:"Console" line in one of your own custom dialogue files. If Console doesn't work then please feel free to choose another. The goal is to demonstrate that you're able to view multi-line Cyrillic text using at least one font. We don't care whether it's an ugly font; the point is to prove that it works.

I'll poke around at the scrolling behaviour in the hope of getting it to behave properly with taller fonts. Any such fix would almost certainly involve a Loader mod (sorry vanilla folks) but most of the advanced stories rely on the dialogueActions mod anyways, so we can't expect to avoid the Loader entirely.

If we can confirm that the workaround is effective on a Russian PC, then you should be able to proceed with dialogue writing. I'll proceed with the vertical-scrolling and jaw-animation stuff.
 

Yokayo

Potential Patron
Joined
Apr 3, 2017
stuntcock stuntcock : I tried it for like 7 times, changing the font every time, but kept getting this:
d22a37d2c7ee.png
And the lines appeared every few seconds, as you said, with the next line instantly replacing previous, no typing effect. I also tried saving the file with the default Notepad and Notepad++, but there was still no difference. Could I have done something else wrong?
 

stuntcock

Content Creator
Joined
Jun 5, 2012
stuntcock stuntcock : I tried it for like 7 times, changing the font every time, but kept getting this:
That's not Raleway Thin, nor is it Console. Presumably it's a default/standard font for your OS. Perhaps you're seeing it because you've chosen a font name which Flash doesn't recognize or can't access.

This might occur because your OS is set to Russian and so you're expected to provide the Russian translated names of fonts. Or perhaps you're running SDT from a protected location (e.g. Incognito browser session) and so it's being denied access to any system fonts. I'm just guessing here; I would need to change my OS language in order to test this stuff properly, and I'm not eager to do that.

Or perhaps you're running a different OS. I've assumed that you're using Windows ... but if that's incorrect then I can't offer much direct assistance. I can potentially test Russian Windows stuff, but I don't have access to any Apple or Linux hardware at the moment.

I have no idea why the game would replace Cyrillic characters with accented Latin ones. Maybe a file-save mistake?

Also: please double-check the syntax in your dialogue file. Please note that this:
Code:
font:"Comic Sans"
is NOT the same thing as this:
Code:
font:Comic Sans
If you remove the quotations marks then the font name won't be parsed correctly.

I also tried saving the file with the default Notepad and Notepad++, but there was still no difference. Could I have done something else wrong?
If you saved the file in Notepad first then it would have been "damaged". Reopening the file in Notepad++ and re-saving it would not fix the damage.

You'll need to create a new file in Notepad++, copy-paste the text from the Undertow webpage, then save the file. Close it and reopen to verify that it still looks like Cyrillic. Then you can try opening it in-game and swapping out various font:"FontName" settings in the hope of finding one which works.

Actually -- let's just discard my text. Assume that it's damaged. Instead, please create a new Dialogue file and then type in your own content using Cyrillic characters, following the general format of the sample file. Then try the font-swapping stuff and in-game testing. If you still encounter accented Latin characters ... then I'll consider adjusting my OS settings in order to reproduce the error and investigate it.
 

Yokayo

Potential Patron
Joined
Apr 3, 2017
Actually -- let's just discard my text. Assume that it's damaged. Instead, please create a new Dialogue file and then type in your own content using Cyrillic characters, following the general format of the sample file. Then try the font-swapping stuff and in-game testing.
That actually worked out! Damn, after many years of using PC I'm still a complete noob at such basic things.
c4d563b65e4d.jpg
And yes, I'm using Win7.
Thank you for minding this, by the way. I'm not used to such detailed answers.
 

stuntcock

Content Creator
Joined
Jun 5, 2012
That actually worked out!
Okay, that sounds good. If you encounter trouble with longer sentences (spanning 2+ vertical lines of text in the dialog box) then you can try to adjust the font size.

Otherwise, please feel free to proceed with writing. I'll try to setup the mouth-animation stuff for Cyrillic characters. It will definitely need review (and possibly linguistic help) when it's near completion, but for now you can just focus on your own stories.
 

stuntcock

Content Creator
Joined
Jun 5, 2012
Still working on this. The core features are in-place. The delay is due to a scope increase.

Considering the background of SDT, I thought that it would be silly to release this mod without adding support for Japanese. But we quickly run into a problem: the code is racist. It implicitly assumes that each glyph corresponds to one or fewer phonemes. That's fine in English; we employ diphthongs and many silent consonants in our speech. But katakana/hiragana is different; a glyph denotes a syllable and therefore it usually describes one or more phonemes. Kanji is even more extreme but I'm not going to touch that.

I can inject additional mouth-shapes into the animation sequence without difficulty, but the game's timing logic is built around the original assumption. If you give it a word which contains three glyphs and six phonemes, then it will animate the first three mouth-shapes as it prints the first three glyphs. It will then discard/ignore the remaining mouth-shapes, and move on to the next word.

Banana (バナナ) would be "voiced" as ban (バン). We can compensate by ignoring the consonants and animating only the vowels, but the result is still stupid. バナナ becomes アアア. A delicious fruit has been replaced by a scream of terror.

The game is also "tuned" based on the expectation of silent letters, which allow the facial features to relax or hold still for a few frames. When every glyph forces a change in mouth-shape, the resulting animation seems to be uncomfortably rapid. If we double the animation pace (2 shapes per glyph) then the girl's speech would seem to be hyperactive. We can solve that problem by altering the output speed: 2 shapes per glyph is fine so long as the number of glyphs per second is reduced. This fix might annoy Japanese readers, because the dialogue text is now printed at an unreasonably slow pace. Meh; if they don't like it then they can open up the Settings file and alter the typingSpeed parameter.

-------------​

The proper fix for the linguistic problems would involve a many-to-many relation between glyphs and animations (with some additional options for timing and sync, because the SDT code is fairly weak in that department). The proper fix is technically feasible (lProxy is a very powerful and flexible tool) but it's not going to happen here. It simply isn't worthwhile to add 1000 lines of code in order to manage seven mouth-shapes. But I'll keep it in mind for the future.

So this is going to be a hack. There are a few different ways to do it; I'm still searching for the least-disruptive option. Fortunately it looks like there's minimal overlap between this mod and dialogueActions, so compatibility shouldn't be too much of a concern.
 

stuntcock

Content Creator
Joined
Jun 5, 2012
The initial build has been released. There are probably a few bugs remaining in the code, and the linguistic stuff was copied from Wikipedia. I don't understand these two glyphs: ъ Ь and so I haven't included them yet. If you'd like to suggest any improvements (or report bugs) then please feel free to do so.

And of course, please go ahead and share any Russian-language dialogue files which you create :)
 

Yokayo

Potential Patron
Joined
Apr 3, 2017
Wow, that seems quite a work, sure it will be useful for many players of both countries.
But I again seem to not understand how to use the mod properly :/ I placed the settings file in the corresponding folder and loaded the swf with SDT Loader. The game says some setting is invalid:
f36f0f26b9fa.png
and then doesn't want to pronounce most letters. From about 20 letters she mouthshaped like 3.
By the way, Ь and Ъ simply make the previous letter be pronounced slightly different sometimes. And sometimes they don't change anything (especially Ъ). I can't find any serious difference in my mouth shape when comparing Ь'd and un-Ь'd phonemes, so I guess we won't lose much by ignoring these two.
 
Last edited:

stuntcock

Content Creator
Joined
Jun 5, 2012
The game says some setting is invalid:
Probably a formatting complication. Could you please download the following files?

UTF-8
UTF-16 Big Endian
UTF-16 Little Endian

Then try to open up each of them in a text editor and check whether the contents appear normal or scrambled.

You can then try to replace the original Settings file with each of them. That is: move (or delete) the phonemeShaperV1settings.txt file, then move the phonemeShaperV1settings - UTF8.txt file into your Settings folder and rename it to phonemeShaperV1settings.txt. And then restart the game and try to load the mod again.

By the way, Ь and Ъ simply make the previous letter be pronounced slightly different sometimes. And sometimes they don't change anything (especially Ъ). I can't find any serious difference in my mouth shape when comparing Ь'd and un-Ь'd phonemes, so I guess we won't lose much by ignoring these two.
That's a relief. Regular expressions allow for look-ahead, as we're currently doing to check for ЛлЉљРрС́с́ preceding vowels. So we can modify shapes based on the presence of a suffix ... but if the linguistic rules are complicated (or if the shape changes are very minor) then I'm happy to just ignore it :)
 

Yokayo

Potential Patron
Joined
Apr 3, 2017
Sorry for the delay, I was away from home for a while.
I tested the files you offered, but kept getting the same error. In the text editor all 3 of them look identical. To be sure, I reloaded the game after every attempt (without closing the projector). That is, I got the error, tested the dialogue to ensure the problem remains, closed the game, replaced the options file with the next one and then opened the game again, of course loading the swf and dialogue. Test dialogue file was created from scratch with Notepad++. Every time the girl voiced only some random letters (may be they aren't random, but I couldn't figure out the dependency).
 

stuntcock

Content Creator
Joined
Jun 5, 2012
I tested the files you offered, but kept getting the same error.
Could you please post your dialogue text file? I don't care about the content or the syntax; it doesn't matter whether the file is even usable in-game. I just need to compare some of the character formatting in order to figure out what I'm doing incorrectly.

of course loading the swf and dialogue.
If the scrambled error message is appearing when the mod is loaded, then the message (and any subsequent mouth-animation problems) are not your fault. You won't be able to fix these problems by changing your dialogue file; I'll need to correct the character formatting (and/or code) on my end.
 

stuntcock

Content Creator
Joined
Jun 5, 2012
Sure, here it is.
I cannot find any inconsistencies. Your file uses UTF-8 formatting and contains a mixture of Cyrillic and Latin characters. One of the configuration files used UTF-8 format.

I tried changing my system settings to Russian but I was unable to reproduce the error, regardless of whether I used a UTF-16 or UTF-8 settings file.

zFMgNqe.jpg
uJz0SpY.jpg


Let's break some rules. Here's a version of the mod which doesn't rely on any external configuration files. The behavior is entirely hardcoded, so you won't be able to correct any of my linguistic mistakes. But perhaps this version will at least be able to function in-game. Please give it a try.
phonemeShaper_hardcoded.mod

If you still run into trouble then could you please try using the Flash Player Projector content debugger to check for runtime exceptions? You would close the game, start the debugger tool (which looks identical to the usual Flash Player Projector) and then select File > Open and choose Loader.swf. You can then run through the game as usual (e.g. customizing the girl, choosing dialogue files, loading mods) until a special error message pops up. If a popup window appears then please take a screenshot and post it here.
 

Yokayo

Potential Patron
Joined
Apr 3, 2017
With this file the error looks different:
a4c2c6f6d163.jpg
The content debugger doesn't show any error message, only providing the same in-game warning.
Might I be doing something wrong? I don't remember using the loader for this before. I just go to the Loader tab and press the "load" button.
 

stuntcock

Content Creator
Joined
Jun 5, 2012
With this file the error looks different:
The new file doesn't load any external settings. The error that you're seeing probably comes from somewhere else.

I don't remember using the loader for this before.
Can you explain this point in greater detail?

I just go to the Loader tab and press the "load" button.
To activate this mod, you should select the "Modding" tab and then click the "Swf Mod..." button. Choose the phonemeShaper_hardcoded.mod file via the Browse window.

If the red-text error message are appearing automatically whenever the game starts up, then that's a different issue. You can ignore them for now (while trying to test the mod) but you should take a look at your $INIT$ folder in order to determine what's going wrong.

If you're actually pressing the "Load" button on the "Loader" tab then you're attempting to open the mouth-animation mod as a sexual position. That's always going to fail because animtools is expecting a plain TXT file full of numbers, and instead you're giving it AS3 code. If this is what you've been attempting to do previously, then you can probably ignore the second (hardcoded) mod file. Just switch back to the first mod file and try to play through one of your dialogues. Hopefully everything should work OK now :)
 

Yokayo

Potential Patron
Joined
Apr 3, 2017
Yes, that's what I was talking about - I had no idea what that "load" button was there for. I never used it to load positions since the readme only described how to do it with the number keys. I didn't even see it was there until I failed to load the original .mod file with the default "Swf mod..." button. I can't remember what it was, but after that I recalled reading somewhere that some mods do not work correctly with the vanilla mods system, so I started looking for an alternative way to load it.
*couple of minutes later*
I tried the original file, and now I remember - this error occured the previous times I tried loading the mod with the default button.
b93ac4ae1518.jpg
But the hardcoded one seems to work normally, she seems to voice all the letters I provide.
By the way, can I edit the settings file with the standard Notepad or something similar without having to run Notepad++?
And yes, sorry for being foolish again :/
 
Last edited:

Users who are viewing this thread

Top


Are you 18 or older?

This website requires you to be 18 years of age or older. Please verify your age to view the content, or click Exit to leave.