Code the Classics – Volume 1

Started by therevills, December 20, 2019, 22:52:48

Previous topic - Next topic

therevills

Over on SoCoder, Krakatomato posted about this (free pdf) book:

https://wireframe.raspberrypi.org/books/code-the-classics1

QuoteThis stunning 224-page hardback book not only tells the stories of some of the seminal video games of the 1970s and 1980s, but shows you how to create your own games inspired by them using Python and Pygame Zero, following examples programmed by Raspberry Pi founder Eben Upton.

In the first of two volumes, we remake five classic video games – ranging from Pong to Sensible Soccer, each represents a different genre. We interview the games' original creators and learn from their example, as well as utilise the art and audio engineering skills of two of the 1980s' most prolific games developers for our recreated versions of the games.

Get game design tips and tricks from the masters
Explore the code listings and find out how they work
Download and play game examples by Eben Upton
Learn how to code your own games with Pygame Zero
Read interviews with expert graphics and audio creators

ricardo_sdl

Check my games at:
https://ricardo-sdl.itch.io/

Xerra

Nice spot. I'll have a look at these. Bought a magazine with loads of python lessons recently that I've been meaning to read and see how hard it is to learn.
M2 Pro Mac mini - 16GB 512 SSD
ACER Nitro 5 15.6" Gaming Laptop - Intel® Core™ i7, RTX 3050, 1 TB SSD
Vic 20 - 3.5k 1mhz 6502

Latest game - https://xerra.itch.io/Gridrunner
Blog: http://xerra.co.uk
Itch.IO: https://xerra.itch.io/

Steve Elliott

Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Qube

Oo, nice nice, downloaded and will read later. Thanks for sharing :)
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

iWasAdam

Very well put together. A bit like the 80's with typing in the source code.

One interesting thing is that both Pong (and Breakout) were not computer games - they were built with analogue components. no computers or CPU's were hurt in their   :o

Steve Elliott

#6
Some good coding information here (the most important part) and I'll probably buy the book too at some point.  But while the games run on the Raspberry pi and PC without a problem and run fairly smoothly, they do run a bit jittery though, so not super smooth (even on PC).
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

iWasAdam

Quotethey do run a bit jittery though, so not super smooth (even on PC)
That's an interesting observation. Would you attribute that to the language or the code itself?

Steve Elliott

#8
Quote
they do run a bit jittery though, so not super smooth (even on PC)

That's an interesting observation. Would you attribute that to the language or the code itself?

AGK also runs Bytecode too so I wouldn't blame the language, the code I haven't looked at in detail.  I would say it's the way the library (Pygame Zero) handles delta time.  I read in the book they're converting back from floating point to integer values for whole pixel movement and compensating.  So if the normalized values mean the pong ball needs to move 1.0 pixels in the x direction and 0.5 in the y direction (for a 45 degree movement) every other frame is skipped for the y movement.  What if the value doesn't fit neatly into a frame like 0.5 (half a frame) does?  How is the library handling that?

It's not always noticable, but in the Frogger/Rabbit game it is noticable - the cars have a jitter every few frames.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Coder Apprentice

Quote from: iWasAdam on March 17, 2020, 06:17:55
One interesting thing is that both Pong (and Breakout) were not computer games - they were built with analogue components. no computers or CPU's were hurt in their   :o

This reminds me to the Mellotron from the music synthesizer world. Digital technology wasn't anywhere near ready for sample playback...so they solved it in an analog way. If they could develop a non "mechanical" magnetic storage for it instead of using tape could have been very interesting.

Steve Elliott

#10
Ordered the book today to support them.  It looks like a quality product too though.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Steve Elliott

Code the Classics – Volume 1 came today and it's a high quality book.   8)
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb