v0.5.2 (or Framerate Walk with Me)
Took a few weeks, but I finally understand the source of most of my performance issues. Allow me to illustrate the problem with one specific example. Here's a bit of code from my "CheckAttackInputs()" function:
If the player pressed B, we can continue checking if they were airborne (to perform a jump kick!). The "IsAirborne()" function looks like this:
Inside, we call "GetHistoryFrame()", which looks like this:
And that calls "history:GetFrame()", which looks like this:
Hopefully, you're beginning to see the problem.
I had tons of helper functions like this, all which called "GetHistoryFrame()" in some way. Turns out this Function:Daisy:Chaining() is actually pretty slow in Lua. This sucks for me, who likes having lots of little helper functions to keep the code tidier and more readable. All those "GetHistoryFrame()" calls were adding 10-20ms on average during an update, which slowed things down significantly.
I've since removed a lot of those helper functions, and am now accessing the history directly. This resulted in me doing a lot of ad-hoc checks:
This isn't the worst thing in the world, but I really liked keeping logic centralized in those little helper functions. Now, if I ever need to re-factor airborne checking, I'm gonna have to do it in multiple places. :\
Still lots of bugs to fix, but the worst one is under control now. Give it a shot, and let me know it plays for you!
Files
Get Untitled Fighting Game
Untitled Fighting Game
Status | In development |
Author | robobeau |
Genre | Fighting |
Tags | Playdate, tiled |
More posts
- v0.6.5 (in which I reveal my versioning system isn't semantic, but a general vib...Mar 23, 2024
- v0.6.0 (or It's Never Too Early To Polish)Jan 15, 2024
- v0.5.0 (or A Million Little Refactors)Jul 08, 2023
- Learning how to code QCB/F inputsApr 21, 2023
- v0.4.0!!!11!1Apr 09, 2023
- Been a while!Mar 09, 2023
- Got Butler set up, so here's v0.3.2!Jan 29, 2023
- Pre-alpha!Jan 22, 2023
- The Right Tool for the Job (or How I Learned to Stop Worrying and Love Tiled)Oct 02, 2022
Leave a comment
Log in with itch.io to leave a comment.