Jump to content
The Dark Mod Forums

Subtitles - Possibilities Beyond 2.11


Geep

Recommended Posts

And here is v4 "Geep", based on your code from four posts above.

  • Background enabled
  • Text centered
  • New graphic
  • White color (let me know if you want to test other colors)

newjob-2024-01-03-00-02-46-46-03-351-68-

Choose between any v3 or v4. We will take your choice to @stgatilov for a sanity check afterwards.

EDIT: Download removed. Check this post for the latest version.

 

Edited by snatcher

TDM Modpack 4.0

Link to comment
Share on other sites

Padding on the right is necessary because text rendering engine allows one-character overflow.
And trying to fix it breaks many readables in many missions.
So unless background is disabled, padding will stay.

As for how large it is, I think it was minimum plausible at some moment.
But then the font was changed and maybe it can be reduced now --- history digging is required here.

I believe background will stay by default.
There is no other simple way to make sure text is visible in all circumstances.

As for size and spacing, I doubt you'll be able to reduce anything without making font even smaller and potentially less readable (especially in Windowed mode).

Link to comment
Share on other sites

One last chance!

In the two mock-ups attached to this post I am printing out each block of text a total of 9 times. In my humble opinion this is as close as we can get to a true outline.

9 times may sound excessive but I recall very complex in-game digital screens with tons of text and graphics in Doom 3 and I assume my approach cannot hinder performance in any way. I can be wrong, though.

Download a pk4 and place it in your TDM root folder. Do not use quicksaves/loads, start a new mission when switching pk4. Delete the pk4 once you are done with testing.

Some missions to give this a go:

  • Seeking Lady Leicester: Intro
  • Braeden Church: Beginning
  • The Black Mage: Intro + Beginning
  • A New Job: Intro + whole mission

Here is a comparison in extreme situations (better to experience it in-game because of image compression):

Outlined white [z_Subs_212_NoBG_Yellow_v5.pk4]:

White.jpg

Outlined yellow [z_Subs_212_NoBG_Yellow_v5.pk4]:

Yellow.jpg

And also attached the original, improved version [z_Subs_212_YesBG_Geep_v4.pk4]:

ori.jpg

z_Subs_212_NoBG_Yellow_v5.pk4 z_Subs_212_NoBG_White_v5.pk4

z_Subs_212_YesBG_Geep_v4.pk4

Edited by snatcher
  • Like 2

TDM Modpack 4.0

Link to comment
Share on other sites

2 hours ago, snatcher said:

9 times may sound excessive

I wonder if you could test 9x versus 4x-diagonals and 4x-non-diagonals? Maybe the extra 5 renders don't add much. There probably is some minor performance effect.

I think you're still showing the widget too high, so it seems to be associated with the wrong subtitle. I prefer @stgatilov's original vertical positioning, even though it pushes the widget's lower edge against the top of the caption lettering.

I wasn't sure what you where trying to point out as a problem... was it the word wrap? Yeah, the automatic word wrap with centered text can look ugly at times. An FM author can choose to insert a manual line break in that case. I do that routinely all the time for barks.

5 hours ago, stgatilov said:

Padding on the right is necessary because text rendering engine allows one-character overflow.
And trying to fix it breaks many readables in many missions.
So unless background is disabled, padding will stay.

Since padding is part of the background box, sure.

It occurs to me now that maybe, to improve the appearance of text centering, the background box should also have equal-size padding on the left. That is, the location and size of the inner box is unchanged, but the outer box is wider and its origin shifted left, so the inner box is centered horizontally within.

Quote

As for how large it is, I think it was minimum plausible at some moment.
But then the font was changed and maybe it can be reduced now --- history digging is required here.

The padding can certainly be made smaller. I imagine the seed value of 17px was for a worse-case character like "W", that was then rounded up to 20. We could shrink it by:

- choosing the seed character as the widest that might actually be at the end of a line followed by space to cause word wrap. Probably "w" or "A".

- not rounding up

- scaling by the compression aspect ratio

I'll try to come up with a new number.

Quote

I believe background will stay by default.
There is no other simple way to make sure text is visible in all circumstances.

No problem here with having the background by default. But recognize there's a compromise between world visibility and text readability. Can't we make it possible to turn the background off for people who hate it so much that they avoid using subtitles because of it? "...visible in all circumstances" may be too high a bar.

The simple implementation would be a single CVar that toggles the background on/off and possibly, conversely toggles fake drop shadows off/on.

Link to comment
Share on other sites

I reviewed the Stone font spacing vis a vis padding:

Worst-case spacing for Stone 24pt for ASCII lower-case characters = 20 (and "A" is less than this)
Scale by 50% to 12 pt = 10
Compress-width of font by 0.75 = 7.5

So I'm thinking a reduced right padding, now 7.5 px, plus a new left padding of 7.5 px to improve centering.

Link to comment
Share on other sites

@snatcher, I meant to mention, I do like your sector sound-source widget. I'd be happy going with that. As to its ring color.... while my personal pref tends toward some color that would contrast with text color, I guess most folks would prefer white, to match the current text color (and likely default if text color is made variable). That would be fine.

Link to comment
Share on other sites

1 hour ago, Geep said:

I wonder if you could test 9x versus 4x-diagonals and 4x-non-diagonals? Maybe the extra 5 renders don't add much. There probably is some minor performance effect.

Tested it and it doesn't look as good. Similar to v3.

1 hour ago, Geep said:

I think you're still showing the widget too high, so it seems to be associated with the wrong subtitle. I prefer @stgatilov's original vertical positioning, even though it pushes the widget's lower edge against the top of the caption lettering.

Sure. Settle on an style first please (background and color).

1 hour ago, Geep said:

I wasn't sure what you where trying to point out as a problem... was it the word wrap? Yeah, the automatic word wrap with centered text can look ugly at times. An FM author can choose to insert a manual line break in that case. I do that routinely all the time for barks.

Overlapping elements is what looks bad.

1 hour ago, Geep said:

The simple implementation would be a single CVar that toggles the background on/off and possibly, conversely toggles fake drop shadows off/on.

I think players should also be able to toggle the situational graphic off and on. It is well executed but it draws too much attention. I rather not focus on it but on the text and my surroundings. Personally, regular subs is all I need but hey, that's just me.

TDM Modpack 4.0

Link to comment
Share on other sites

14 minutes ago, Geep said:

@snatcher, I meant to mention, I do like your sector sound-source widget. I'd be happy going with that. As to its ring color.... while my personal pref tends toward some color that would contrast with text color, I guess most folks would prefer white, to match the current text color (and likely default if text color is made variable). That would be fine.

The widget needs a background or a shadow or outline otherwise it cannot be seen in some situations. I am not sure how to deal with this.

At this point, I think you are leaning to:

  • The existing background and background color (but from your code that includes a narrower background for barks)
  • Original white text color
  • Newest widget in white color closer to the text it belongs to, similar to the original
  • More centered text

TDM Modpack 4.0

Link to comment
Share on other sites

8 minutes ago, snatcher said:

I think players should also be able to toggle the situational graphic off and on. It is well executed but it draws too much attention. I rather not focus on it but on the text and my surroundings.

So maybe new CVars along the lines of the following would do the job for 2.12:

subtitleColorR 0.00-1.00

subtitleColorG ditto

subtitleColorB ditto

subtitleBackground 1/0

subtitleSoundSource 1/0

Link to comment
Share on other sites

13 hours ago, snatcher said:

One last chance!

In the following example (ws3), the subtitles are a bit more difficult to read:

White:

ws3_cleighmoor(2024-01-0404-17-43)(4312.161293.74694.13).thumb.jpg.eaf002f369c91f67e7db257c9212d234.jpg

Yellow:

ws3_cleighmoor(2024-01-0404-23-33)(4311.811299.59700.77).thumb.jpg.138aa3a997e9780a5e8ebe5d0e81d74a.jpg

 

Btw. your yellow pk4 still gives me white text, but the position marker circle is in yellow..

Edited by datiswous
Link to comment
Share on other sites

6 hours ago, datiswous said:

Btw. your yellow pk4 still gives me white text, but the position marker circle is in yellow..

Don't use quickload when switching pk4. For some reason the save keeps the font color. Start a new mission each time you have a new pk4.

  • Like 1

TDM Modpack 4.0

Link to comment
Share on other sites

For the record, here is another version of tdm_subtitles_message.gui and the standard backing field, now improved with the right horizontal padding reduced to 7.5 px, and a new left padding to match, for better visual text centering. I also removed a comment about a possible CVar subtitle_narrowfield_nonstory, which seems less important than the other potential CVars.
 

Spoiler

/**
 * stgatilov: This GUI header is included many times into subtitles GUI
 *
 * Mission Authors: DO NOT EDIT, INCLUDE OR OVERRIDE THIS FILE IN YOUR MISSION PK4.
 */

//must be defined outside: which subtitle slot to generate
//#define SUBTITLE_IDX 3
//#define SUBTITLE_DIGIT "3"

//preprocessor magic for composing window names
#define SUBTITLES_CONCAT3X(a, b, c) a##b##c
#define SUBTITLES_CONCAT3(a, b, c) SUBTITLES_CONCAT3X(a, b, c)

#define SUBTITLE_BASE_Y (370 - 50 * SUBTITLE_IDX)
#define SUBTITLE_NONEMPTY SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_nonempty")
#define SUBTITLE_ALPHA SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_alpha")
#define SUBTITLE_SPATIALIZED SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_spatialized")
#define SUBTITLE_LOCATION_X SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_locationXclamped")
#define SUBTITLE_LOCATION_Y SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_locationYclamped")

// SUBTITLE_MARGIN_DIFF's value will be 0 with a "story" subtitle or [planned] if Cvar subtitle_narrowfield_nonstory is false (0); otherwise, value is 100.
// 100 is the difference between horizontal field margin for nonstory (200) and story (100):
#define SUBTITLE_VERBOSITY SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_verbosity")
#define SUBTITLE_MARGIN_DIFF ((SUBTITLE_VERBOSITY) == 1 ? 0 : 100)

windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesTextHolder, SUBTITLE_IDX)
{
    rect        (102.5 + SUBTITLE_MARGIN_DIFF), SUBTITLE_BASE_Y, 435 - (2 * SUBTITLE_MARGIN_DIFF), 45
    backcolor    SUBTITLES_TEXT_BACKCOLOR
    bordercolor    SUBTITLES_TEXT_BORDERCOLOR
    visible        SUBTITLE_NONEMPTY

    windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesText, SUBTITLE_IDX)
    {
        // #5914: engine allows overflowing textbox size by one character. As of 2.12,
        // maximum likely character width is 7.5 (among lower-case ASCII, Stone at textscale 0.25, width-compressed by 0.75)
        // so leave horizontal padding 7.5 on the right, and same on left to improve text centering appearance.
        rect        7.5, 0, 420 - (2 * SUBTITLE_MARGIN_DIFF), 45
        text        SUBTITLES_CONCAT("gui::subtitle", SUBTITLE_DIGIT)
        font        SUBTITLES_TEXT_FONT
        textscale    SUBTITLES_TEXT_SCALE
        textAlign    1
        forecolor    SUBTITLES_TEXT_FORECOLOR
    }
}

windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesLocationRing, SUBTITLE_IDX)
{
    rect        310, SUBTITLE_BASE_Y - 8, 20, 14
    visible        SUBTITLE_NONEMPTY && SUBTITLE_SPATIALIZED
    background    "guis/assets/common/subtitle_location_ring"
    matcolor    1,1,1,SUBTITLE_ALPHA
}
windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesLocationPoint, SUBTITLE_IDX)
{
    rect        317.5 - 9 * SUBTITLE_LOCATION_Y, SUBTITLE_BASE_Y - 4 - 6 * SUBTITLE_LOCATION_X, 5, 5
    visible        SUBTITLE_NONEMPTY && SUBTITLE_SPATIALIZED
    background    "guis/assets/common/frobhelper"
    matcolor    1,0,0,1
}

windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesDebugText, SUBTITLE_IDX)
{
    rect        100 + SUBTITLE_MARGIN_DIFF, SUBTITLE_BASE_Y + 40, 440 - (2 * SUBTITLE_MARGIN_DIFF), 45
    text        SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_debug")
    visible        SUBTITLE_NONEMPTY
    font        SUBTITLES_TEXT_FONT
    textscale    0.15
    forecolor    0.5,1,0.5,1
}


#undef SUBTITLE_IDX
#undef SUBTITLE_DIGIT

#undef SUBTITLES_CONCAT3X
#undef SUBTITLES_CONCAT3

#undef SUBTITLE_BASE_Y
#undef SUBTITLE_NONEMPTY
#undef SUBTITLE_ALPHA
#undef SUBTITLE_SPATIALIZED
#undef SUBTITLE_LOCATION_X
#undef SUBTITLE_LOCATION_Y

#undef SUBTITLE_VERBOSITY
#undef SUBTITLE_MARGIN_DIFF

Beyond that, as you guys have noted, vertical dimensions could be adjusted to improve the appearance of the widgets. I'll try to come up with something concrete next, keeping conflicts with other adjustable-size HUD elements in mind.

Another question for you: To cover a case where the backing field is suppressed, should the sector widget interior still be largely transparent, or would translucent or opaque be better?

Link to comment
Share on other sites

Hmm... the background image seems to be doing a naive relative attenuation. I wonder if we could configure a shader with a max rgb that is always some percentage darker than the text color

min ( value, ( textcolor * 0.7 ))

I'll see if I can locate where the behavior is defined.

  • Like 2

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

In this next version, the vertical height of the backing field is 1px taller (at the expense of gap space below each field), and the text and widget are vertically repositioned within it.
testSubtitlesDrunk(2024-01-0411-59-20)(075_54.25).thumb.jpg.3f477cfb7ccba4e92ffa0927b588c769.jpg

Spoiler

/**
 * stgatilov: This GUI header is included many times into subtitles GUI
 *
 * Mission Authors: DO NOT EDIT, INCLUDE OR OVERRIDE THIS FILE IN YOUR MISSION PK4.
 */

//must be defined outside: which subtitle slot to generate
//#define SUBTITLE_IDX 3
//#define SUBTITLE_DIGIT "3"
// Currently, lowest slot is 0, highest is 2

//preprocessor magic for composing window names
#define SUBTITLES_CONCAT3X(a, b, c) a##b##c
#define SUBTITLES_CONCAT3(a, b, c) SUBTITLES_CONCAT3X(a, b, c)

#define SUBTITLE_BASE_Y (370 - 50 * SUBTITLE_IDX)
#define SUBTITLE_NONEMPTY SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_nonempty")
#define SUBTITLE_ALPHA SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_alpha")
#define SUBTITLE_SPATIALIZED SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_spatialized")
#define SUBTITLE_LOCATION_X SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_locationXclamped")
#define SUBTITLE_LOCATION_Y SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_locationYclamped")

// SUBTITLE_MARGIN_DIFF's value will be 0 with a "story" subtitle; otherwise, value is 100.
// 100 is the difference between horizontal field margin for nonstory (200) and story (100):
#define SUBTITLE_VERBOSITY SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_verbosity")
#define SUBTITLE_MARGIN_DIFF ((SUBTITLE_VERBOSITY) == 1 ? 0 : 100)

windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesTextHolder, SUBTITLE_IDX)
{
    rect        (102.5 + SUBTITLE_MARGIN_DIFF), SUBTITLE_BASE_Y, 435 - (2 * SUBTITLE_MARGIN_DIFF), 46
    backcolor    SUBTITLES_TEXT_BACKCOLOR
    bordercolor    SUBTITLES_TEXT_BORDERCOLOR
    visible        SUBTITLE_NONEMPTY

    windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesText, SUBTITLE_IDX)
    {
        // #5914: engine allows overflowing textbox size by one character. As of 2.12,
        // maximum likely character width is 7.5 (among lower-case ASCII, Stone at textscale 0.25, width-compressed by 0.75)
        // so leave horizontal padding 7.5 on the right, and same on left to improve text centering appearance.
        rect        7.5, 9, 420 - (2 * SUBTITLE_MARGIN_DIFF), 37
        text        SUBTITLES_CONCAT("gui::subtitle", SUBTITLE_DIGIT)
        font        SUBTITLES_TEXT_FONT
        textscale    SUBTITLES_TEXT_SCALE
        textAlign    1
        forecolor    SUBTITLES_TEXT_FORECOLOR
    }
}

windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesLocationRing, SUBTITLE_IDX)
{
    rect        310, SUBTITLE_BASE_Y, 20, 14
    visible        SUBTITLE_NONEMPTY && SUBTITLE_SPATIALIZED
    background    "guis/assets/common/subtitle_location_ring"
    matcolor    1,1,1,SUBTITLE_ALPHA
}
windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesLocationPoint, SUBTITLE_IDX)
{
    rect        317.5 - 9 * SUBTITLE_LOCATION_Y, SUBTITLE_BASE_Y + 4 - 6 * SUBTITLE_LOCATION_X, 5, 5
    visible        SUBTITLE_NONEMPTY && SUBTITLE_SPATIALIZED
    background    "guis/assets/common/frobhelper"
    matcolor    1,0,0,1
}

windowDef SUBTITLES_CONCAT3(SUBTITLES_NAMEPREFIX, SubtitlesDebugText, SUBTITLE_IDX)
{
    rect        100 + SUBTITLE_MARGIN_DIFF, SUBTITLE_BASE_Y + 40, 440 - (2 * SUBTITLE_MARGIN_DIFF), 45
    text        SUBTITLES_CONCAT3("gui::subtitle", SUBTITLE_DIGIT, "_debug")
    visible        SUBTITLE_NONEMPTY
    font        SUBTITLES_TEXT_FONT
    textscale    0.15
    forecolor    0.5,1,0.5,1
}


#undef SUBTITLE_IDX
#undef SUBTITLE_DIGIT

#undef SUBTITLES_CONCAT3X
#undef SUBTITLES_CONCAT3

#undef SUBTITLE_BASE_Y
#undef SUBTITLE_NONEMPTY
#undef SUBTITLE_ALPHA
#undef SUBTITLE_SPATIALIZED
#undef SUBTITLE_LOCATION_X
#undef SUBTITLE_LOCATION_Y

#undef SUBTITLE_VERBOSITY
#undef SUBTITLE_MARGIN_DIFF

 

  • Like 1
Link to comment
Share on other sites

I know this is semi on-topic and likely guaranteed to never happen. But I still can't help dreaming of TDM someday getting a cinematic dialogue system like in DeusEx: If you get close to or frob an important character that has something to say, movement is blocked and you go into a third person view staring you both down while the music changes, every few lines the angle shifts so you see yourselves from a different direction as you talk to each other.

The most awesome thing would be dialogue options still, those I'd dream of seeing even more. Imagine being able to tell different things to a character in a prompt, changing some choices based on what you say! Could be used both as a simple store for street corner vendors... or to tell friendly AI to take different actions like waiting or following you or fleeing, I know TDM doesn't go for those types of missions but I still see it as a worthy possibility.

Technically both could be done with a script. So if I ever need it I might put together such a dialogue system myself in a custom entity. Would definitely be fun to see someone else experiment with this through the new subtitles though.

Link to comment
Share on other sites

20 minutes ago, snatcher said:

I am sure you can still borrow a few pixels here an there and let the widget breathe a little.

I could move the text down 1 pixel more, but then the text descenders don't have much to breathe.

The overall problem is that the bottom-most subtitle slot, if moved further down, begins to conflict too much with other HUD items. For wider story subtitles, this is the corner inventory and weapon items. For all subtitle types, it is the lower informational messages that can appear above the breathe bar. Keep in mind that all these conflicting HUD elements can be enlarged at user discretion through Settings.

One solution is to have the engine change the order in which it fills empty subtitle slots. Currently it is: 0 (lowest), 1, 2.

If instead it did either of these policies:

  1. Fill order: 1, 2, 0 for all subtitle types; or
  2. Fill order: 1, 2, 0 for story subtitles. 0, 1, 2 for non-story subtitles

Then the frequency of conflict would be significantly lessened - particularly with (1) - since having 3 subtitles shown at the same time is rare. With a revised policy, the backing fields could be made taller, allowing more widget room, with slot 0 (and slot 1 to a lesser extend) lowered

Link to comment
Share on other sites

How about we proceed next with something like this?

next-step.jpg

If done right the widget can have its own background, and blocks will naturally stand out from one another. Please note the above pic comes from a quick an dirty hack to illustrate the idea so I won't share any code.

Backgrounds can eventually be replaced with images with round corners or whatever.

  • Like 1

TDM Modpack 4.0

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recent Status Updates

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 2 replies
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 3 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...