Posts

Showing posts from September, 2026

Credits screen

Image
F inally, the credits screen is done and working. But, let's start from the beginning. As I've mentioned in the previous post, the work has already started for the credits screen. As the fonts were working I switched my attention for the faces with the blinking eyes and sliding credits. At first, all the "eyes" were implemented as solo sprites. But then I thought why not use a sprite atlas after all? There was just one problem and it was, that sprites, that should be used in the atlas, should be a regular assets. But in my case, they were "embedded" in the .sti file. New asset type was added to StciImporter . Then the whole process of extraction and atlas generation is done in 2 passes. First, the texture sub-assets in the  .sti  file are remapped to the external assets. That is, the textures are extracted to solo asset files and in the  .sti file only sprites are left. Then in the second pass, the textures are marked as dependencies for the sprite and spr...

Fonts updates and sound

Image
I  n the previous entry I mentioned the how font support was implemented. But after some testing it's just not finished yet. The one problem is, that  AssetJa2Font class represents just one concrete font, like 10 pt Arial bold . What is also needed is a class that will group various font assets like normal, bold and italic. Therefor new class was created,  AssetFontClass . This has also another benefit - if in future I would like to replace for instance font10arial.sti  with some other open-source alternative, it would be no problem. I would just create the  AssetFontClass  asset with another font and it will work. The default font classes (from JA2 assets) are generated using menu option. There was also another change regarding the fonts and it was metrics computation. When I initially implemented font support, I didn't bother using right values for various properties of the font metrics (like ascentline , descentline , ...) which resulted in wrong r...

Font support

Image
I n this blog entry we would talk about fonts. Fonts are now supported and are used in the main menu screen (the copyright text). The fonts in JA2 are stored in the .sti files (as sub-images), along with shadow support and palettes. Each font letter image therefor has the main color letter and shadow letter (encoded differently). In the Ja2Unity those image are imported as separate color channels: R is for the main color,  B  is for the shadow color and in the G channel, the background color is stored, but I don't know if it is used anywhere in the original game. Each font asset ( AssetJa2Font class - which is the main asset) therefor has those sub-assets: Texture atlas with all the supported letters (it's just the tiny subset of the UNICODE) Palette used for font coloring (as Texture2DArray assigned to the font material) Font asset ( TMP_FontAsset ) Font material asset with custom shader assigned Font asset Because  TMP_FontAsset isn't used directly, the new UI.T...