Posts

Showing posts from 2026

Preferences screen once more

Image
I thought that the preferences screen is all done, but then I noticed there are still some things missing, like confirmation dialog on "Quit" button, audio preview when changing speech/sfx volume and more. When I was proofreading the previous entry I noticed the typo in bootstrapping class, it was named as BootsrapManager  (missing "t") so I've renamed it to BootstrapManager . Well, it is funny that I didn't find it earlier, but with autocomplete in IDE you don't check typos. The next thing I was working on was message dialog. But as first, the support for 9-slice sprite was needed. Therefore, new import type was defined in StciImporter which will take the sprites from the .sti file and create the one 9-sliced sprite from it (it is actually 8-slice sprite, as the "content" is transparent, because each dialog could have its own background image). Message dialogs are implemented using solo canvas, with stacking dialog supported. Each dialog pr...

Finishing the Preferences screen

Image
N ot much has happened (as in new features) since the last blog entry. There are 2 main things, that needs mentioning. AssetRefMockerManager was moved to the BootstrapManager class. Because  BootstrapManager is now a singleton then there is no need to be  AssetRefMockerManager in each scene. Therefor, it was made as part of the  BootstrapManager class. Because of this, the code required some changes. The one reason was, that while the  AssetRefMockerManager was in the each scene, then on the start of scene  all the ref mockers could be loaded. But now, the Start() method is run only in the bootstrap scene so therefor batching mode was implemented. That is, when the batching mode is on, the asset ref mockers are just registered. And only after all the mocker are present they are loaded. Implementation of the fast help text ( FHT , a.k.a. tooltips). This was implemented using separate canvas in the bootstrap scene. There the  FHT  would be shown, a...

Preferences screen and some rewrites

Image
T oday, I'll talk about progress in preferences screen (and all the relevant changes directly affecting it). When I started implemented a preferences screen I stumbled on one problem regarding assets mocks. Till now, all the AssetRef were stored in the AssetRefMockerManager  GO in the scene. This was sufficient with main menu, as there were practically no prefabs with embedded AssetRefMocker . But as soon I've started working on the preferences screen, the problem appeared: How to handle asset ref mocks inside the prefab when  AssetRef  is stored in the scene object? So the solution was to store it in the asset ref mocker component itself and then register the instance to the  AssetRefMockerManager  during Awake() . IAssetRefMocker interface was converted to base class for asset mocks and lot of other changes was done. It should be done like this from the start. Another feature implemented was on-demand loading of the mocks. Till now, all the registered mocks ...

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...

Main menu updates

Image
W ell, another "long time no see". I'm still working on the project as much as I can. But it's not a steady work. During summer I was doing some other things (like bike touring) and mostly work. So, what's new? Well the main menu is working. While working on it the need arise for some sort of "mockups" components for various asset and mockup manager. Let me explain why. Because the assets of JA2 are proprietary, it means that you need to extract and build the asset bundles by yourself. Therefor all the assets in the GameObjects needs to be referenced indirectly (because they may not exist yet). This is where mockup come on scene. The mockups are just references to the real assets (like pointers in C++). And when the scene is loaded, the mockup manager primary role is to load the real assets from the mockups. Also, the main menu is implemented using Aspid.MVVM package (MIT licensed). Some other minor changes is custom Script edImporter for .pcx and .st...