top of page
Search
Writer's pictureStephen Brown

Font Chaos!

Since the start of the engine, fonts have always been rendered offline into a texture sheet and then had effects applied to them. This is great for simplicity but when you start to add simplified Chinese and traditional Chinese, and then also allow those language to input text into the game, you end up with about 30-40 font textures which end up taking up 70+ mb when compressed for the game. Not only that they don't look that pretty when rendered and cannot be scaled that well.


Up until now I was happy with this approach, but I've always been keen to keep memory down. The current APK is about 108Mb and also when these fonts are loaded in game, you end up losing double the memory to the game, so on low end devices the fonts end up stealing 70*2 = 140Mb of RAM before you've even started loading cars and other things in!


I've also had to add alot more characters to the font pages, and so the memory has grown even more, so I decided to go for a different approach.


Enter Signed Distance Field rendering, which basically yields super high resolution rendering of fonts, whilst keeping texture memory down. It also enables pixel shaders to do some cool effects to save pre-rendering shadows/outlines on fonts with photoshop. Instead of each character being about 64x64 pixels in the texture, it only needs to be about 20x20, and because we can add effects in the pixel shader, it only needs to use a single channel in a texture sheet (instead of full colour), meaning I can put each character on an each individual channel (red/green/blue and alpha), thus getting 4x as many characters into a single texture sheet. The only down side is that I cannot compress these textures, but the memory saved just by implementing the steps above is that I now have an uncompressed set of textures that are only 18Mb, which is alot less than 70Mb when compressed :)


Hopefully this will enable those with super low end devices to have a much more stable build to play with. You can see looking at the progress of the following 3 screenshots how the font space is dramatically reduced, but not only this in game the fonts look super crisp at any resolution, so scaling up the text is now super easy!


Textures no SDF as they were (just using red channel to show it easier 43x1024x1024 textures!):



Textures as SDF: (14x1024x1024 textures!)


Textures as SDF/MSDF in individual channels (5x1024x1024 textures!)






355 views5 comments

Related Posts

5 Comments


Soniya Singhania
Soniya Singhania
Nov 20

Have you ever pondered the ideal way to enjoy a lavish evening in Delhi? An Delhi Call Girls service might be the solution, offering not just company but a glimpse into the high society lifestyle.

Like

Dennis Winn
Dennis Winn
Nov 11

I recently stumbled upon Winspirit De, and I can honestly say it’s a game-changer! The variety and quality of games available make it stand out, especially if you're in Germany or just a fan of great online gaming platforms. With so many slot games to choose from, I never get bored. Each game brings something unique, from incredible graphics and sound effects to engaging themes that keep you hooked. https://winspirit-de.com/

Like

Melissa Prinz
Melissa Prinz
Oct 16

Looking for pure calamansi juice? Shop now and experience the zesty, immune-boosting power of this tropical citrus juice. Get pure calamansi juice for sale – a refreshing, natural source of vitamin C to boost your wellness and vitality.

Like

Sylvia Henderson
Sylvia Henderson
Sep 18

While slot games are largely based on chance, there are a few strategies and tips that can help players maximize their chances of winning. The first step is to choose the right game. At Zoome3 Casino, players have access to a wide variety of online slots, and selecting a game with a favorable Return to Player (RTP) percentage is key https://zoome3.casino/games/slots. The higher the RTP, the better the chances of winning in the long run.

Managing your bankroll is another important aspect of maximizing wins. Setting a budget before playing and sticking to it helps prevent overspending and ensures that gaming remains enjoyable. It’s also wise to take advantage of free spins and bonuses offered by the casino. These promotions…

Like

wojuqawev
Sep 02

This can lead to leaks and structural damage. Solutions include improving attic insulation and ventilation to keep the roof cold and using heat cables to melt ice. Prompt attention to ice dams prevents metal roofing company virginia extensive damage and maintains the roof's integrity.

Like
bottom of page