Addled, a classic puzzle with some new twists

Thanks Nino! Yes, I'm looking at using frame based animations instead.

Not a bad idea daprice, I might do some investigating!

A quick update: I've switched to using animated frames for the backgrounds and have swapped out the mp3s for pulp songs. Some other minor performance improvements too, hopefully will fix some / all of the performance issues.

A gif of the new animated backgrounds:-

addled

2 Likes

A few performance notes for your latest build:

In most cases, the new animated background performs the same on device as in your gif.

Looks like maybe the rotation of the title is still causing a pretty major slowdown (of the frame rate and the music) which goes back to normal when the title finishes animating in.

The large spaceship level select screen is still smooth before playing a level, but worse (only 5-10fps) when returning to it after playing a level.

The animation of the ship flying down to the planet when starting a level still freezes partway through. If you can’t avoid the delay when loading the level, I’d suggest having it wait until the ship has completely disappeared into the planet and the “whoosh” sound finishes playing, then letting it pause to load while only the planet is visible. That way it will look to the player like a normal pause in the animation, rather than a frozen game. I don’t think the loading time is excessive at all – the season games and the OS itself take similar amounts of time to load things – but it shouldn’t happen in the middle of an animation and sound.

The animation of the level scrolling in and the level name scrolling off the screen looks ok on the device (5fps?) but nowhere near as smooth as it does in your gif.

During gameplay, any time a tile is dropped, it falls more slowly (at a lower frame rate) than what your gif shows, but I might not have noticed without the gif to compare against. If I do something to trigger a chain reaction (e.g. moving the middle ghost to the left so it falls down at the start of level A-2), performance slows to a crawl until it finishes.

The animation when I pick “quit level” while in a level runs at maybe 1fps and leaves some things behind on the screen.

I left the level select screen with the large spaceship running on my device while writing this, and at some point a few minutes in, it froze for 5 seconds (both graphics and music), then came back and played the music ridiculously fast to catch up.

Sometimes the game doesn’t register quick repeated presses on the dpad, but other times it does, which might be performance related.

The level cleared screen still runs poorly (maybe 2-5fps?) all the way through.

A few notes that aren’t performance related: (sorry if these are things you just aren’t finished with yet)

Pressing B to undo a move sometimes leaves things in a weird state (e.g. on level A-2 when I moved the ghost as described above, then press B, it only undoes part of the chain reaction and leaves tiles floating in midair). Pressing B all the way back to the level name screen causes the background of the level name overlay to get stuck on screen.

Choosing “About” from the menu while on the title screen crashes with attempt to call a nil value followed by an empty stack trace. Choosing “skipped levs” from the menu on the level select screen also causes this.

Choosing “Quit level” from the menu while a tutorial is on screen crashes with:

game.lua:1342: attempt to index a nil value (global 'hintPanel’)
stack traceback:
  game.lua:1342: in function
    ‘animateLevelOffscreen’
  game.lua:1309: in function ‘quitLevel'

Hi daprice.

Thanks again for the detailed response :slight_smile: It looks like my biggest problems are caused by performing scaling and/or rotation in screen updates to perform animations. The playdate is ok doing scaling and rotating occasionally but doing it every frame kills the cpu, I'm guessing. I can get rid of most times I use this, but I really like how it works with the spaceship landing so I might try some more tricks to keep this bit in.

The slowdowns in-game are worrying, I'm not doing anything flash when moving the blocks about. And as you've noted, some parts of the game aren't finished yet, there's no About screen and I've still got some bugs to iron out like the 'undo' move recording sometimes when it shouldn't. But I'm happy with the progress :slight_smile:

thanks again :smiley:

This looks like a good test case for the "only profile slow frames feature" (Profile slow frames only), also trying to figure out what's going on with that occasional hang (garbage collection, almost certainly), so I'm playing around with this today. Should I post bug reports here as I hit them, or would you rather have them in DM?

First thing I noticed running it under the profiler: In that laggy title screen it's spending almost all of its time calling sprite:setScale() and sprite:setRotation(). Those functions redraw the sprite's images immediately, which means you're doing redundant drawing if you're using them both on the same sprite. setRotation() has optional scale arguments so you can handle both scale and rotation in one go. The other thing there is it might be more efficient to skip the image backing and instead use a draw function that calls drawScaled() or drawRotated(). That will draw directly to the screen's frame buffer instead of adding an extra step of drawing to an image, and will clip off-screen drawing if the rotated image is bigger than the screen.

I'm tempted to add that as an option for image-based sprites, like a "cache transformed image" flag you'd turn off to have it do the scaling/rotating at draw time. I'll file it and think about it. Generally I'm against fiddly bits that make things more complicated, but I can see this being pretty useful.

2 Likes

Hi Dave,

thanks for looking into this. After looking at the suggestions from yourself and everyone else on here I've decided to try 3 things to improve performance:-

  1. No more dynamic rescaling and rotating. This is a bad habit I got into from writing games for iOS, I tend to underestimate their effect on performance. Now I create pre-scaled and rotated assets.

  2. Storing frequently used images in a global cache and just pointing sprites at the images in the shared cache. I was destroying and re-creating graphical images too often.

  3. Flattening my layers. Now I just have a foreground and background layer, where before I was using 5 layers in-game, to very little benefit.

I've attached my latest build, hopefully it has much better fps.

Addled.pdx.zip (1.4 MB)

2 Likes

Whoa, that's incredible! All the memory churn that was causing the slowdowns is completely gone. I was even able to set minumumGCTime to 0, reducing GC time from a steady 30% down to just a bump every now and then, and the collector can still keep on top of memory growth. Amazing job!

Thanks Dave, that was really worrying me for a while!

I think you've given me enough confidence in the game's performance to consider releasing it on itch.io so ta muchly !

p.s. Did you notice anything strange about the music? (That was another point I remember being brought up).

1 Like

I didn't notice anything odd about the music, no. In the older build it would slow down along with the game, but everything is running fast and smooth now.

One bug I ran into a lot with the older build, but didn't see it in this one until I got to A-17: sometimes after rewinding to the beginning of the level the title stays on the screen. Seems like it happens when I hit B too fast. If I restart the level a new title animates in and out and this one stays there. Quitting the level and starting it again makes it go away.

Untitled

okay, looks like if I hit A while the title is animating in after I rewind all the way back to the beginning it'll do that

Thanks Dave, I'll get on that one right away.

Well done on getting to A-17 by the way !

This latest build is impressive! I played for a little while and didn’t run into any issues during gameplay. I will say the music and sfx are quite good, now that I can hear them play without any issues. I do see a very slight slowdown when I make a match when the particles appear, but it’s a minor nitpick and probably not something I’d notice if I wasn’t already focusing on the game’s performance. There are a couple places where the menu transitions aren’t perfectly smooth but I don’t think it’s anything I’d be disappointed in if I paid for the game.

The only one I’d maybe consider fixing before release is when you first press A after opening the game, the music skips a beat before/while the player selection menu opens. It’s another really small nitpick, but it’s literally the player’s first impression of the game.

I did find a couple crashes:

Thanks Dale, amazingly detailed bug reports (as per usual :slight_smile: ) I'd guess the transition issues are around the title and zone screens? I love the animated backgrounds but they're real resource hogs, I think the delays are when I load or destroy those multiple full screen graphics assets.

I definitely introduced some new random bug crashes with my latest range of performance improvements. But it's getting there!

A couple more bugs:

  1. I let someone else try playing this on my playdate, and after they created a new player profile and entered their initials, they could still see all of the unlocked levels from my profile. Had to quit and restart the game and then switch back to their profile again (it had reverted back to mine) to get it to actually start fresh on their profile. (They enjoyed it though, and commented on the difficulty being well balanced, which I agree with)

  2. I’m not sure what triggers this, but sometimes the undo button doesn’t put things back exactly where they were and/or leaves tiles in an invalid state. I’ve seen it leave tiles floating in midair without falling, and leave two of the same tile touching without disappearing. This could be used to cheat, or it could make some levels unsolvable.

Hi Dale,

thanks for the positive feedback, it's always appreciated :slight_smile:

I've got those bugs fixed, along with a couple of others I'd seen:-

Addled.pdx.zip (1.5 MB)

I'm tempted to release this version.

Wow, I just came here to say your pixel art is amazing! :flushed: :flushed:

Thanks Paul, so is yours! :slight_smile:

1 Like

I've gone for it and have published the game on itch.io:-

4 Likes

Hi, would anyone be able to test this on a real device? I've been told there's a crash that happens after completing a level but I've been unable to replicate it.

Addled.pdx.zip (1.5 MB)