PyDev of the Week: Sean McManus

This week we welcome Sean McManus (@musicandwords) as our PyDev of the Week! Sean is the author of several books, including Mission Python: Code a Space Adventure Game!, which was reviewed on this site in March. There are free chapters from his book available here. You can learn more about Sean on his website. Let’s take some time to get to know him better!

Can you tell us a little about yourself (hobbies, education, etc):

I’m a writer specialising in technology. In recent years I’ve written several books to get children and young adults into coding. The launch of the Raspberry Pi and initiatives such as Code Club have helped to make coding much more accessible to young people than it was for many years.

As a kid, I loved programming my Amstrad CPC computer and in many ways it started me on my career path. I had listings and articles published in the leading magazines of the day, and my first book was about Amstrad programming. Today, I can still remember how much I loved programming as a kid, and I hope that my books bring some of that excitement to today’s budding coders.

As well as writing books and articles, I help some of the world’s leading technology companies with their copywriting requirements.

Outside of writing, I enjoy photography and making music. I have recorded an album of electronic music I plan to release online later this year, and I am a member of a singing group which is a great way to unwind.

How did you end up writing a book about games programming in Python?

It seems like there are lots of Python books that include small examples to show you how a particular feature works. That’s great, because it’s much easier to learn when the code is pared down to the essentials. However, that does leave many readers wondering what to do next, and how you bridge the gap between short programs of a couple of pages and more substantial projects. It’s one thing to know how a list works, for example, but how do you use that to create a map for a 3D game? How do you build on the basics to create something that does more than just demonstrate the language?

With Mission Python, the idea was to show a worked example of a game that goes beyond the basics. It’s a graphical adventure game, so there are lots of opportunities to learn about data structures (rooms, objects, interactions) and lots of customisation opportunities that you wouldn’t get with a simple arcade game. The game is set on a Martian space station where the air is leaking and you have to get to safety. It involves finding objects and solving puzzles, and uses a forced perspective like some of the early Zelda games. I was particularly pleased with a comment from one reviewer saying that it felt like the game came before the book, rather than the other way around as is often the case with educational books: I was keen for the game to be as “real” as possible, within the constraints of the slightly retro game format and what can be reasonably documented within the scope of a book.

Which Python libraries are your favorite (core or 3rd party)?

The game in Mission Python uses the Pygame Zero library, so I’ve been spending a lot of time working with that and consider it my current favourite library.

Pygame Zero modernises Pygame with some education-friendly features, and simplified syntax for getting some images moving. It helps to make the journey from Scratch to Python smoother in the classroom by introducing Actors, which are like sprites. It also simplifies some of the basics of Pygame, such as screen refreshes. There are lots of cool things Pygame Zero can do that were outside the scope of Mission Python, so perhaps I’ll code something else with it in the future.

What lessons did you learn in writing a book?

I’ve written or co-written several books now, including Raspberry Pi For Dummies, Scratch Programming in Easy Steps and Cool Scratch Projects in Easy Steps. Writing books teaches you to be organised with your time and with your ideas: it’s an intense period of work in a short space of time, often covering a wide range of topics, so planning is essential. I track everything in spreadsheets, to take the weight off my brain!

One of my tips is to set aside thinking time as much as possible. If you’re really stumped when debugging, I’ve found it’s often better to switch to doing something else, to buy some thinking time in the background without stalling the project totally. People often have “aha!” moments in the shower or when they are otherwise relaxed, so if tinkering with the code isn’t working, it’s a good idea to let it rest for a bit.

Thinking time is important for creativity too: I set aside an evening to design the main game puzzles. I went to a late session in the space gallery at the Science Museum in London, where I spent the evening drawing up puzzles and locations, surrounded by real rockets and astronaut suits. I later added new puzzles and ideas while developing the game, but it helped to have a good vision from the outset.

The books have obviously taught me a lot about the programming languages I’ve been working with, as I’ve looked into new features and resources that I need. Writing a book, I have to take a pragmatic view and sometimes I prefer to use a solution that is easier for someone to understand or one that is more widely compatible over one that might be the fastest or most idiomatic.

What has the response been to Mission Python?

Mission Python was a big project, writing both the game and the accompanying book, so it’s wonderful that it is out there now in the world. I’ve been getting some lovely feedback. A young reader wrote to tell me they hadn’t programmed before and this book introduced them to Python programming, which is a wonderful thing to have played a part in. Adults have been enjoying the book too, some of whom knew Python but hadn’t done any game development before, as well as some who are new to Python entirely. Hobbyist coders who love programming are finding it’s an enjoyable project, and it’s been wonderful to see tweets and reviews from people who are reading the book. It’s a huge help with getting the word out and is greatly appreciated. The game engine can be used to create new games entirely, so I’m looking forward to seeing what readers build with it.

What projects are you working on now?

My main project right now is updating my website, which involves a lot of code wrangling, albeit not Python. My website celebrated its 20th birthday last year, so there’s some quite old code in there that I’m weeding out as I work to make the site more responsive and mobile-friendly.

I’m still tinkering with the game from Mission Python, both for enjoyment and to provide additional resources for readers. For example, NASA released some real sounds recorded on Mars so that seemed like too good an opportunity to miss. I’ve written some code so that those sounds play when you’re on the surface of Mars in the game. I have a short routine I’ll be publishing soon to hide objects on the space station, once my new website design launches, which brings a new puzzle element to the game.

I’ll be spending more time with Scratch again this year too, as I update my Scratch books for Scratch 3.0.

I’m looking forward to getting my teeth into another big Python project as soon as I have the time to dedicate to it. I consider myself on a journey with Python, and am keen to further develop my skills.

Is there anything else you’d like to say?

Anyone is welcome to download the Mission Python game here. There’s a free sample of the book there too, which includes the instructions for playing the game, and there’s a map too for if you get stuck!

Thank you for inviting me to feature on your blog, Mike!

Thanks for doing the interview, Sean!