Design Text Effects Across Multiple Languages

S

some_entity

Guest
I’m currently re-working my original textbox system to have text effects, such as shakes and color highlights. However, the way I’ve been seeing other people apply these effects is through arguments passed in as arrays (as in, “the effect should start at this character and end here” - this is done within the code). The other way I’ve been seeing people do these effects is within the strings themselves, by using a backslash and a number to determine where they want the effect to start/end. Would that be a better way to do it?

I feel that using text commands would be better, but the whole situation on building for language localization still seems a bit foggy. I’m open to any ideas - thanks in advance.
 

Yal

🐧 *penguin noises*
GMC Elder
IMO something like the BBCode used on this very forum would be the best approach - you have tags like Have you heard of the [emp=RED]high elves[/emp], criminal scum? in the text; your textboxes checks for the starting character (in my example, an opening square bracket [ ) and if it finds one, it switches to "parse tags" mode instead of typing it out verbatim; if it can interpret the command, it switches some rendering flag (e.g. text color, whether the text is animated in a special way, etc). If the tag starts with a end tag character instead ( [/ in my example) it will turn off the flag rather than turn it on.

When translating, you just need to carry over the same tags into the strings for the individual languages, around the corresponding words.
 
S

some_entity

Guest
That makes a lot more sense. I'll look in depth on how to detect said command strings (I'm sure it won't be easy). I'm assuming it's possible to go into "parsing" mode through the detection of more than one character though, as using only a bracket seems a bit inflexible - I'll try to find a way to detect "[\" or something since I probably wouldn't use that in any text. Thank you.
 

Yal

🐧 *penguin noises*
GMC Elder
That makes a lot more sense. I'll look in depth on how to detect said command strings (I'm sure it won't be easy). I'm assuming it's possible to go into "parsing" mode through the detection of more than one character though, as using only a bracket seems a bit inflexible - I'll try to find a way to detect "[\" or something since I probably wouldn't use that in any text. Thank you.
Basically, you'd draw each letter separately by looping through the entire string and reading one letter at a time... unless it's a "start of special code" character, in which case you keep reading until you reach the "end of special code" character, and then figure out what to do exactly based on the special code contents (EMP for "emphasis" in my example, I probably didn't make that clear)... and you'd skip drawing the contents of the special code entirely, of course.

Drawing each letter separately lets you animate each letter separately (text shaking randomly if someone is shivering, bouncing if they're singing, etc), and also do things like changing color or font for a particular word. You can get the size of a string using string_width / string_height, which comes in handy since you'd need to manually align the text yourself when drawing individual letters - take the size of the individual character using these functions and manually step up a position counter for each letter what ends up being drawn, basically.
 
S

some_entity

Guest
I've already coded the characters typing out individually, and I have each character fade in when it appears as a "default" effect. It was hard to figure out though since the font I'm using isn't monospaced and all of the tutorials/questions I could find online only used monospaced fonts (Used string_width for each character, counted up the width as it looped to see if it passed the width limit, counted the length of each word before a space. If that word passed the width limit, I inserted a "break" to a new line at the last space). Thanks for bringing that up though.

I was just wondering about specific text effects - the structure is already done. You've made it clear though that it shouldn't be too hard to use commands to access it, so I'll get working on that
 
Top