overbound / SonicTimeTwisted

Source Code for a Sonic Fan Game Made in Game Maker Studio
https://overboundstudio.com/
GNU General Public License v3.0
58 stars 16 forks source link

Finish drawing fonts #72

Closed AlexKhayrullin closed 3 years ago

AlexKhayrullin commented 4 years ago

This became relevant with localization being worked on.

After removing two fonts (one redundant and one unused) we're left with 7 fonts:

The first two IMO should be complete (so annoying since the second one is just a "compressed" version of the first ^^') , and I want to complete the next two, because I like the former, and the latter cold be a cool challenge :)

No need to complete the FontTitle ones, they only ever need basic letters and numbers.

(time permitting, I'll also draw extended Latin and eventually Cyrillic characters, but not integrate them just yet)

AlexKhayrullin commented 4 years ago

image

@nkrapivin

I don't know whether a Russian font is ready on your end, but I drew this in the meantime. This covers the ASCII symbols as well as CP1252 and CP1251 extensions.

Later today I'll write a script that will allow extracting just the needed letters for one given translation as well as put them in a correct color and add shadows (because drawing those is BORING) and then move on to other fonts.

AlexKhayrullin commented 4 years ago

Also both the PHP script (this is the most convenient for me ATM) , and the GAL file (I draw this using the freeware tool GraphicsGale, using layers to draw some markers underneath the symbols, like what size should they be, how high and low can each type of letter go etc) will be committed to the repository along with the rest of the project.

AlexKhayrullin commented 4 years ago

So I finished my script that extracted just the needed characters from a font (with support for adding new characters for some languages) and made language-specific strips with contours and shadows. These strips will be distributed as part of translation packs and can be imported dynamically.

As an example of an output, here's what's produced when I generate a Russian strip (also @nkrapivin this means that if you are still waiting for a Russian font, your wait is pretty much over, I beat the other guy to the punch :) )

fontHud strip

And a code snippet:

fontHud.charlist.txt

AlexKhayrullin commented 4 years ago

As soon as I finish the other fonts, I'll import the ASCII-complete versions of the fonts into the game, document the script and commit it along with the project.

AlexKhayrullin commented 4 years ago

fontHudMin strip

Second font's Russian version , coming up.

nkrapivin commented 4 years ago

image

It's supposed to work like this. You define the alphabet string, and some extra parameters for sprite_add if you're too lazy to make the font just like the game expects :p

nkrapivin commented 4 years ago

The overall structure would look like this: image

nkrapivin commented 4 years ago

With a small hack fontHudMin = fontHud; it works: image

AlexKhayrullin commented 4 years ago

Cool 👍 I'm almost done with the "Lives" font and then I'll take a break for the day.

Just a reminder, a big requirement for externally addable translations and fonts is allowing someone to submit a translation even if they don't own GMS and can't open the project.

AlexKhayrullin commented 4 years ago

fontLives, or Font number 3 :)

fontLives strip

nkrapivin commented 4 years ago

Cool 👍 I'm almost done with the "Lives" font and then I'll take a break for the day.

Just a reminder, a big requirement for externally addable translations and fonts is allowing someone to submit a translation even if they don't own GMS and can't open the project.

I know, you don't need to own GM to add a font. You don't need GM at all to make a translation. You may need the original fonts from the game, but you can get them from the project folder in SonicTimeTwisted.gmx\sprites\images\.

AlexKhayrullin commented 4 years ago

What I meant is, can you add a JSON file and eventually font strips in a directory somewhere and have the game take it into account?

nkrapivin commented 4 years ago

What I meant is, can you add a JSON file and eventually font strips in a directory somewhere and have the game take it into account?

Yes! All you need is a valid JSON file + (optional) a font.

AlexKhayrullin commented 4 years ago

Anyhow, it's really cool to see the translation stuff is going on smoothly.

I couldn't keep myself from doing this, the final font for today, fontMicro. Some letters clearly scream "I did what I could with only 3 px wide", I mostly rely on context for the letter "Ю" to be recognizable here :)

fontMicro strip

(also the image is entirely white and transparent, so it is invisible against white background, but I swear, it is above this line :) )

nkrapivin commented 4 years ago

btw since we're not appending letters to the font, but instead using an external sprite, you can do fonts with arbitrary width/height (as long as the game will treat them correctly)

AlexKhayrullin commented 4 years ago

I'd rather translations not change they way fonts are sized.

Besides, the 3-pixel wide font doesn't come out of nowhere, it's from the "past" and "future" sign on the save screen (I plan on actually drawing translatable text on save slots, see #65 ) , and I also need such a small font for the disclaimer screen. So I don't plan on changing it ATM.

nkrapivin commented 4 years ago

isn't the font for letters in the save select screen just fontHud?

nkrapivin commented 4 years ago

image oh god it's actually a sprite?

AlexKhayrullin commented 4 years ago

Visually, yes. technically, no, because at the moment, texts are drawn in the images on the save file.

The only font that's actually used there is fontMicro, and only on Android, see this video: https://twitter.com/AlexKhayrullin/status/1288513297210314757 . On Android, it is used to display hints.

AlexKhayrullin commented 4 years ago

image oh god it's actually a sprite?

At the moment, yes. Hence #65 :)

nkrapivin commented 4 years ago

By the way, just a reminder, GameMaker: Studio only cares about Unicode/UTF-8, it has no idea what is CP1251 and etc :)

AlexKhayrullin commented 4 years ago

I know :) .

I keep using references to these codepages out of habit but I realize this is not exactly productive, since not only does GM:S not know what it is, younger users might not know neither. This has more to do with me, I tend to try to cover these two codepages every time I draw a font for my projects, even if there are characters I end up never using.

AlexKhayrullin commented 4 years ago

Referencing them is kind of a way for me to say "I included the basic character set and most characters we'll need in these groups of languages". I'll try to avoid talking about codepages from now on.

AlexKhayrullin commented 4 years ago

fontHud.charlist.txt One final request: can we use these TXT files alongside PNG font strips? Such TXT files will contain all the characters a font strip contains in order, and, more importantly, there is one per font and not per language, because while the fonts I've provided so far are complete, others, such as the big blocky fonts that appear on Zone title cards that I've yet to enrich, might only contain the basic letters and digits, and nothing else.

nkrapivin commented 4 years ago

actually I did something like that right before your comment: image

AlexKhayrullin commented 4 years ago

Great! :)

nkrapivin commented 4 years ago

also I've added a menu option to export built-in fonts as png strips (so you don't have to DL the project file), I can easily make it export all built-in sprites, but should I? image

nkrapivin commented 4 years ago

I'll finish off the translation stuff, and check for possible memory leaks. Then I'll commit the changes to surf-fix branch and submit a new PR.

AlexKhayrullin commented 4 years ago

also I've added a menu option to export built-in fonts as png strips (so you don't have to DL the project file), I can easily make it export all built-in sprites, but should I? image

No, this is redundant with what I did. I drew these four images: https://twitter.com/AlexKhayrullin/status/1310231063550189568 and made a PHP script (that's the easiest option for me ATM) that can add contours and shadows, and only export the needed letters based on what a given preset (I called languages "presets" because why not :) ) demands.

The script also supports adding new characters. For instance, I added this extension to fontHud that contains five emojis (actual Unicode emojis :)

fontHud emoji-examples

And exported a strip with just the ASCII characters and the emojis. The space at the end is from including as a requested character an emoji which wasn't in the extension or the original sprite, so the script replaced it with a blank space.

fontHud strip

I'll commit and document it as soon as I'm done with the three remaining fonts.

nkrapivin commented 4 years ago

(please wait for the new PR before committing, it should appear in a few minutes)

nkrapivin commented 4 years ago

I am 15 btw.

This should be it.

AlexKhayrullin commented 4 years ago

Merged :)

BTW, I see you translated "K.T.E" as "K.E.". It was written like this in the original games because the name "Knuckles" was too long, "Sonic" and "Tails" being five letters long each, but in Russian it also has five letters, so you can just write "Наклз" ;)

nkrapivin commented 4 years ago

it was supposed to be "Кнаклз Ехидна" but yeah "Наклз" is better.

you can edit the .json yourself if you want. I was also thinking if I should translate "tails" as "майлс"))0

AlexKhayrullin commented 4 years ago

The fonts are finished.

Just to make adding to fonts for translations in non-Latin and non-Cyrillic languages easier and/or to help export language-specific strips, I had coded a PHP script. I realize that not everyone who can draw a script can install PHP, especially on Windows :D, so I'm going to recode the tool as a small GMS project (if it's possible) .

AlexKhayrullin commented 4 years ago

Ultimately, change of plans, the executable for exporting strips is now being written in Java, only because GameMaker Studio projects are unfortunately sandboxed, and I needed something that could work with the current directory.

AlexKhayrullin commented 3 years ago

And that's all of them!

fontTitleLarge fontTitleSmall fontTitleSmallest

AlexKhayrullin commented 3 years ago

The PNG strip generation tool is done and documented: https://github.com/overbound/SonicTimeTwisted/commit/80439301f59e2f3aa1d1e7a7048cd35564c41900

romulok77 commented 3 years ago

hello, well i did a translation into portuguese, which is practically complete, so i want to know how do i upload the file to the code, or only you can do it, so i would have to send a link with the .json file and its folder with fonts. That's when i think it's done.