Game
fezEngine


3 years ago

How I managed to optimize my text engine by 500%


Recently, I posted my #fezEngine's text engine progress and it was... disasterous. So I tried to completely reengineer it and I've come up to a conclusion:

Most of the time the text you render is static, unless you render timers or variables that are constantly changing, the more frequent changes you can do to a text is change it's position, scale or it's rotation, and the old engine I made took all that into account while dynamically rendering the text. The problem with that is that it was very unoptimized since it had to do that every frame, practically returning the same values, just offset, scaled and rotated, which was really reducing the performance.

The solution was quite simple, actually. Basically what it does, the function gets the text, pre-renders it at normal values, stores the result into a list and then renders the needed text using data from that list with adjusted values according to it's position, scale and rotation.

You might be confused and say:

-Wait fezman isn't that just the same thing but with extra steps and lists involved?

Actually not, instead of rendering the text every frame, it pre-renders it once, stores the result in a list and then reuses that list data when it's needed, practically doing the actual render once per runtime.

The result is huge: Instead of 100, it can run 500 text functions while maintaining 60 fps (screenshots provided), that's 5x faster!

And you know what is the best part, the code is much cleaner now, I've splitted it into 2 functions for now but soon I will combine them and you will see the result on the #screenshotsaturday or later.

Anyway, that is all I wanted to showcase, fezEngine is near to being finished, as always, stay tuned for the updates!

Upd:

Just noticed that the debug panel has the same values on both screenshots so it might look fake, but it's just an unlucky coincidence lol. I can post a package on the fezEngine's page so you can see the improvement yourselves.



1 comment

Loading...

Next up

Now would you look at that, it's fixed! That means that the 4th demo of #fezEngine is near, stay tuned!

#screenshotsaturday is near, here is a little sneak peek to what I will be posting

New advanced batch blocks and debug blocks coming soon!

Did you miss out on any of the games we highlighted from Steam Next Fest? They're all listed in the article. Check out their demos before Next Fest ends!

Scratch not being able to recognize capital letters ruins my text engine

Akatori is an epic metroidvania where you wield your staff to fight, jump, and explore diverse realms across different eras.

It's also one of the games that's part of Steam Next Fest!

Play the Steam Next Fest demo now: https://bit.ly/Akatori

Big Update: Done

Docs: Done

We getting the PR with this one

New time blocks, old one hidden so ur projects won't break Coming soon

Take a trip to Nostalgia Land in @JacksonG13 's Sky World 64, a cozy sandbox game that harkens back to the 64-bit era.

This survival experience takes heavy inspiration from Minecraft’s Skyblock!

Play the Steam Next Fest demo now: https://bit.ly/SkyWorld64

I went a bit too far when I started implementing pointers and jumps in scratch using lists

all this to basically make a parser

have a bizzare graph and dont @ me