Hello, everyone.
I've been reading the article on Pygame Zero in issue 71, which describes how to make a very simple driving game. It works fine under Windows 7, taking about 40 seconds to win a game, but on my Raspberry Pi 2 the game gets slower and slower as it runs, taking about 114 seconds to win a game. Any idea how to fix it?
My Pi 2 is running Stretch and I updated everything that could be updated.
Oh... it occurred to me that the slowdown might be because there are an every-increasing number of images drawn (the barriers on the sides of the track), but I tried tweaking the code to only draw barriers that are on the screen. That didn't make much difference.

Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."

It is as you suspect the growing number of actors being processed. I didn't put any culling code in as it would have made it too complicated as a starter program - but you could re-use the actors as they disappear off the screen then the maximum number being processed would remain constant.

I've largely solved the problem. It was the checks on whether the car had collided with the barriers that was the main culprit. Once I changed the code so it only checked for collisions with barriers on the screen, the frame rate at the end of the game went up from 11fps to 50fps!

This makes me wonder 2 things:

If the frame rate of a program using Pygame Zero varies a lot, wouldn't it be better to specify the speed of things in pixels per second (rather than pixels per frame)?

Is there a profiler for Python?

Bruce Mardle. "You know I yearn for a simpler time of barn dances and buggy rides before life was cheapened by heartless machines."