Rougol kicked off 2022 with its first talk of the year. As usual, the talk was both in-person and online. Most attendees were on Zoom. The talk was also recorded and should be available soon.
Jeroen has taken the Raspberry Pi book 'Coding the Classes' and adapted the five games to run on RISC OS. The book was released by the Raspberry Pi organisation and features 5 classic games from the 1970s/1980s written in Python and using PyGame and PyGame Zero. It includes code listings as well as interviews and background material on games development.
Jeroen decided to port them to RISC OS to learn about games development and also Python and Pygame. Python is now running on RISC OS thanks to Chris Johns.
Porting these games provided a nice fixed scope project without the need to also create new sound, music and gameplay. Jeroen has made all his conversions freely available on RISC OS.
Python 3 is the latest version of Python. It is object-orientated and encourages nice, modular coding. It comes with lots of libraries to extend its capabilities. One if these is Game - a set of modules for writing 2D games.It provides a layer on top of SDL which is highly portable.
PyGame Zero is a beginner friendly wrapper around PyGame to make it even easier to use. It simplifies coding.
The first games conversions of Infinite Burner and Cavern in 2020 were down with BBC Basic and The AMCOG Development Kit. This has been written up in an Article in Archive 25:5 edition. The ports were done using PyCharm IDE, Audacity and GraphicsGale on Windows and StrongEd, SampleEd and ChangeFSI/Paint on RISC OS. BBC Basic origin commands are very useful for adapting the screen co-ordinates and port to match PyGame Graphics layout and top left origin.
For the conversion, the games were broken into stages (background, Player and collisions, Objects and enemies). Similar functions and variables makes it easier to convert Python to BBC Basic. RDSP provided sound support.
The other 3 games were done in Python in 2021. Very straight-forward to get them running on RISC OS as Python. Started with Boing! first as simplest.
Python is installed from !PackMan which also includes the PyGame packages.
Note, Iris and Python 3 do not run well together at the moment. LanManFS can slowdown PyGame programs.
Conversion was done in small steps and PyGame Zero code had to be replaced as does not run on RISC OS. Games run in full screen as potential problems in testing with pinning a Window which is then resized. There were lots of tips on optimising image loading in Python, RISC OS file paths and making Python code run on RISC OS.
As usual the talk ended with any questions.
There were some nice video clips to show off all the games, and of course you can play them for yourself on RISC OS (downloads on !Store).
It was a very interesting talk and Eben mentioned that there would be a Book2 for Jeroen to have a crack at coming soon!
Read our interview with Jeroen