Log In  

I'm trying to figure out why this cart only runs at 10 FPS on a Raspberry Pi Zero. stat(1) returns 0.49 and stat(7) returns 30. However, the screen is only updating at 10-11 FPS. Other carts with higher stat(1) values don't show this problem, so it seems specific to something in this cart.

I can optimize to get the CPU usage down to 17%, and then the real framerate becomes acceptable. However, I'd actually like to understand why it is slow so I can work around it. (Also, I'd prefer to be able to use the whole CPU budget instead of just 17% of it!)

I assume what's happening is that the pico-8 CPU costs are optimistic for some instructions, and the actual cost on the Pi Zero hardware is higher. But which instructions?

Are there specific instructions I should be avoiding?

Are there specific types of drawing (like large map areas, or off-screen drawing) I should avoid?

Can I hook up a profiler to see what it is spending its time on?

The original raspberry pi post (https://www.lexaloffle.com/bbs/?tid=3085) says math-heavy carts run slowly. Is that still true?

Are there any performance tricks for writing carts that run well on a raspberry pi?

Cart #slow-0 | 2020-06-29 | Code ▽ | Embed ▽ | No License

P#78645 2020-06-29 00:59

I played around a little bit and found something out: You have 182 Entities on the whole Map. That's a lot of Entities... Maybe - just my thoughts - you can find a better Solution to handle non-moving Objects, like Walls, without putting it to the "Entities"-Array? I think that will get you some free CPU-Cycles (I was playing around and removed every Wall-Entity for testing; after that, the Entities went down to 40 and CPU-Cycles to 0.1)...

On RPi0, it's possible (and reasonably safe) to overclock that Computer. I did this to mine aswell, otherwise I couldn't play Games like "Celeste" or "Just One Boss" without frequently stutters here and there... Sadly, an RPi0 is a slow Computer for Pico8...

P#78650 2020-06-29 08:19
:: zovirl

Good point on the number of entities. I was experimenting with an entity-component-system architecture but this implementation, especially apply(), is inefficient. It is much faster to cache the list of entities matching each query.

I wish I knew how carts like Wolfenstein use a similar amount of CPU while remaining smooth.

Good idea on overclocking the RPi0. I'll have to try that. The size of the RPi0 is very attractive! One of my projects is to bury the RPi0 inside a keyboard and set it up to boot into pico-8, to recreate the experience of the early 80s computers like the C64, Apple II, and ZX Spectrum.

P#78669 2020-06-29 15:38 ( Edited 2020-06-29 16:42)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-07-15 11:07 | 0.018s | 4194k | Q:37