Underhell is a Source Engine game developed by the Underhell Team in collaboration with We Create Stuff. Underhell Chapter 1 requires ONLY Source SDK Base 2007 installed. No Source game is required.

Report article RSS Feed Custom Titles System

After hitting a hard limitation on the TITLES.TXT file, we have created our own system that allows us to not only create as many TITLES as we want, but also to save them and read them through multiple files.

Posted by Mxthe on Nov 7th, 2012
Basic Mapping/Technical.

Underhell has text, a lot of text, Main Objectives, Secondary Objectives, Item Names, Area Names, Comments ect...
 
There are so many text entries, that the poor titles.txt file that is used to store localized text, stopped working!
It took us days to figure out exactly what was going on, and even after we figured it out, we realized we could not edit or increase that limitation, because the actual inner workings of this file are located inside a .DLL that was not included within the SDK Valve released.

So, we had to come up with a plan, and Charly did just that.

New Titles, New Format !


So, we had all the text already placed in the levels, already referenced in the multiple localized .RES files, so re-creating a new entity would have been more than a pain.
We discussed that the main problem was "Too Many Entries in ONE single file".
So even if we managed to re-create our own titles.txt file, we would still have an issue.

The engine would have to, search through the "pool" of text entries, and "fish" the one called by the game.

So as new Chapters would have been released, this pool of text would have kept growing and growing, therefore increasing text loading times at each display.

So, Charly came up with an idea, to "Slice" the files where the text would be call, into multiple files.

This not only makes calling texts faster, but it also allows people who want to create their own maps/stories to make their personalized text files they can include with the download.

Using only one UNIQUE titles.txt would have been a problem for all the people that wanted to create their own maps and add their own objectives, if everyone includes their own titles.txt, they will overwrite each other.

Through our new system, anyone can create their own titles file, and include it with the download.

Here's how it works :

ENV_MESSAGE


First, go read the Env_Message section of the New Message Entities Inputs Tutorial.

The new titles system still uses our modded Env_Message entity.

Except it comes with a new twist.

This was the previous Target Parameter to enter, to display a message:

code:
InputMessage House_Comment_MusicBox

Here, we Input to the env_message to display the title "House_Comment_MusicBox"

If we enter this previous format, the engine will still look through the original scripts/titles.txt file.

Here's where the magic comes in, there is our NEW input with file specification :

code:
InputMessage @YOURFILE.txt_House_Comment_MusicBox

Let's break this down shall we?

@YOURFILE.TXT = The @ tells the engine to look for specified the file in the Scripts folder.
_                      = Is used as a String Parser between the File Search, and the actual message
House_Comment_MusicBox = The ACTUAL message entry within the specified file.

Not only does our new system works with the "InputMessage" input, but it also works with every other input we have modded into env_message, which are :

code:
"SetMessage"
"SetMessagePriority1"
"SetMessagePriority2"
"SetMessagePriority3"
...(1-16)
"RemoveMessagePriority"    "1-16"  


CUSTOM TITLES


Now that we know how to CALL a message through a file, let's see how the actual file formatting is, for practical reasons, we have created our own format that allows us to choose unique styles for each entries.

Here is the format for "Titles_House.txt" :

code:
Titles_House
{

  House_Comment_MusicBox
  {
    "positionx"   "-1"
    "positiony"   "0.6"
    "fadein"    "0.5"
    "fadeout"   "0.5"
    "effect"    "0"
    "holdtime"    "8.0"
    "fxtime"    "0.25"
    "r1"      "230"
    "g1"      "230"
    "b1"      "125"
    "a1"      "0"
    "r2"      "255"
    "g2"      "255"
    "b2"      "180"
    "a2"      "0"
    "Message"   "#Underhell_House_Comment_MusicBox"
  }
}

 

Let's break THAT down :

Titles_House
          : The Name of the file
{

House_Comment_MusicBox  : The Name of the Entry, to write in your env_message
{
positionx                : The X position of the Display
positiony                : The Y position of the Display
fadein                    : Message fade in time - per character in effect 2
fadeout                  : Message fade out time
effect                    : The Effect Number
// effect 0 is fade in/fade out
// effect 1 is flickery credits
// effect 2 is write out (objectives)
holdtime                 : Stay on the screen for this long
fxtime                     : This is the amount of time the highlight lags behind the leading edge of the text
r1                           : Primary Red Value ( 0 - 255 )
g1                           : Primary Green Value ( 0 - 255 )
b1                           : Primary Blue Value ( 0 - 255 )
a1                           : Primary Alpha Value (0 - 255 )
r2                           : Secondary Red Value ( 0 - 255 )
g2                           : Secondary Green Value ( 0 - 255 )
b2                           : Secondary Blue Value ( 0 - 255 )
a2                           : Secondary Alpha Value (0 - 255 )
Message                   : The Actual Message, enter #MessageName to localize through resource folder.
}
(Other Entries here)
< End of file


So, as you can see, the format differs a bit from the original titles.txt, but the values are the same.
This new system allows for users who want to create their own adventures with their own comments/objectives to do so, without overwriting the original titles.txt file.
Everyone can now create his own, and link it through their env_message within the level.

Localization


As you can see in the "Message" field, we have entered "#Underhell_House_Comment_MusicBox" .

The "#Underhell_" part refers to the #Underhell_YourLanguage files that are located in the resource folders.
These language files are part of the Localization system.

If you want to create your own localized files for your levels, simply create a file called "YourLevelName_YourLanguage " and place it in the resource folder.

Say you want to create a Level called "Overheaven", you just need to create a file called Overheaven_English.txt in the resource folder, and in there create your English entries, which your Custom Titles will refer to.

So in the Message field, you will enter "#Overheaven_MessageName", and it will look for the message name within the file you have created.

This way, if someone wants to translate your level, all they have to do is copy "Overheaven_english" and rename it to "Overheaven_TheirLanguage and translate the content.

Programming by Carlos "Charly" Sotelo
Post comment Comments
JoshZemlinsky
JoshZemlinsky Nov 7 2012, 3:02pm says:

Hehe, awesome work guys. Im really impressed by Carlos' work :D
And this indeed will be usefull. Goodjob!

+8 votes     reply to comment
Gregthegen
Gregthegen Nov 7 2012, 3:07pm says:

Each time the engine hands you a new problem, you surpass it and give other modders the resources to do the same. You sir and your team are not only geniuses but class A modders. Well done and thank you for overcoming every obstacle to make this mod grand.

+16 votes     reply to comment
Rus[T]
Rus[T] Nov 7 2012, 5:31pm replied:

Uhu, a great mod in the making + valuable info? = WIN!

+7 votes     reply to comment
Rob12772
Rob12772 Nov 9 2012, 2:36pm replied:

I totally agree.

+7 votes     reply to comment
MattyBoi
MattyBoi Nov 8 2012, 5:39pm says:

If this **** doesn't get greenlit, I will go download this mod unto a portable hard-drive and launch it through Valve HQ's window with a canon.

+12 votes     reply to comment
Rus[T]
Rus[T] Nov 10 2012, 5:06pm replied:

haha, amen sir, amen :D.

+6 votes     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Half-Life 2 Icon
Platform
Windows
Developed By
Mxthe
Contact
Send Message
Release Date
Released Mar 5, 2011
Mod Watch
Track this mod
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Mods
Underhell (Half-Life 2)
Underhell Half-Life 2 - Single Player Adventure
Related Games
Half-Life 2
Half-Life 2 Single & Multiplayer First Person Shooter