Dig Through Python And Create Game Art with Playscii
brandon flowers
Posted on June 10, 2021
One of the best ways to learn any language is to dig through the source code of a full application. It may be daunting at first, but if you have a sense of where the application begins, you should be able to find the main application file. From there, you can start to explore various paths and learn how it operates.
I have been following the playscii project (and several artists using it) on Twitter and wanted to try the tool myself.
I purchased it for the paltry default sum of $2, and was pleasantly surprised to see that it includes the source code along with the compiled app.
Playscii can be used to create art that is ideal for tile-based games.
First, I tried to launch the application but my Mac refused to open this app.
“Playscii” cannot be opened because the developer cannot be verified.
macOS cannot verify that this app is free from malware
Ok the app wasn't going to work, but what about the source code?! As an ever-learning python dev, the source code is much more valuable than any compiled tool.
My first attempt to install the source code failed unfortunately but I wasn't deterred yet. I have had other pythons app fail the first time and knew I might be able to get past this hurdle with a little determination.
python3 install -r requirements.txt
It did not finish building the wheel. I waited a half hour and then abandoned this approach. Next, I turned to googling and discovered what appears to be the original repo along with another dev's update to it. So thanks to Michael Lazar's build I was to able to use his updated requirements.
appdirs==1.4.0
gprof2dot==2015.12.1
numpy==1.20.1
Pillow==8.1.2
PyOpenGL==3.1.5
PySDL2==0.9.7
This time all the requirements installed without issue on my Mac (Catalina with Python 3.9). Then I tried to run the app
python3 playscii.py
This didn't work, and my next hoop was related to the sdlmixer
library. I can give live without audio support, and simply decided to see if I could comment out that out and try again.
I only had to do a few tweaks with the main playscii file to disable the audio.
# from audio import AudioLord
# from sdl2 import video, sdlmixer
from sdl2 import video
Be careful to disable the audio but not the ui here:
# self.ui,self.al = None, None
# self.al = None
self.ui = None
And presto! ✨
As you can see from own tweet, having a little bit of friction in your game that an eager dev can overcome on their own actually encourages them to promote to your work.
Ideally though, everything should just work though. But you wouldn't be able to focus on the core value if you had to manage every build across multiple platforms as an indie developers; that's why other indie developers are here to help!
Posted on June 10, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
November 29, 2024