Game
fezEngine


2 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

Big Update: Done

Docs: Done

We getting the PR with this one

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

Getting back to working on fezLang... Yeah, assembly is probably easier at memory juggling than whatever this is, I need to dig up my notebooks.

Happy #WIPWednesday!

Are you working on a game?

Making some art?

Practicing a song?

Something else?

Tell us in the comments!

I usually don't do this but for my timezone it's about to hit 2024 and I wish you guys a happy new year

Happy #WIPWednesday!

Are you working on a game?

Making some art?

Practicing a song?

Something else?

Tell us in the comments!

Hmmm...

Happy #WIPWednesday!

Are you working on a game?

Making some art?

Practicing a song?

Something else?

Tell us in the comments!

Me rn