PyUnity: a project of growth and learning

Ray Chen
5 min readSep 13, 2021

--

PyUnity is an actively maintained package for making games in Python

I started learning Python at the age of 6. This may seem quite young for most people, but I was quite enthusiastic at maths and programming, albeit just in Scratch. Right now I am turning 14, so that means I have around 7 years of Python knowledge. Since then, I have tried time and time again to make a computer game in any language. I tried other languages like C++ or Javascript. I tried frameworks like Processing or Pygame. None of them really struck my heart at their capabilities.

Then the coronavirus hit. We were all forced into our houses, stuck at computer screens, just watching the world pretty much burn outside. I started doing more Python. I learnt more programming concepts. This was when I truly started understanding the deep internals of the CPython interpreter. And then I found Unity. For those who don’t know, the Unity game engine is a cross-platform game engine developed by Unity Technologies. It is particularly popular for iOS and Android mobile game development and used for games such as Pokémon Go, Monument Valley, Call of Duty: Mobile, Beat Saber and Cuphead. (cited from wikipedia).

I just loved how Unity has so many features that are all accessible via the simplistic API. I made a couple of games myself, but because I suck at game dev in general, I won’t share what I made. However, I found myself thinking about what I would have done if I made Unity. How it could work in Python. Bearing in mind at this stage, I could only make a simple cube in PyOpenGL from a tutorial page.

So I started to read how 3D graphics work. I simplified the entirety of rendering a cube into some small, simple steps. I ran countless tests until I had a small, red, lighted up spinning cube. I thought to myself, “I can do this.”

Turns out I couldn’t. Not for a while. This was my first ever big Python project and I was taking it solo. None of my friends knew programming at all, and I didn’t really use social media much to know anyone online. So I had to learn the basics of using Git, making a Python package, using PyPi, and overall just making my code nice and neat. My old coding style was just smash everything where I need it to be, and hope it works. This was because no one but I was going to read it.

I roughly knew how PyUnity was going to be laid out. I would have core classes, some custom errors, a Vector3 class and some config. It took me a while to convert my standalone file into a modular approach, but I got there in the end. I published my first package on PyPi.

Except, if you were to go to the project page, you won’t find release 0.0.1. This is because I just didn’t know what I was doing and “accidentally” yanked the release. You can probably try to use it from commit b37c3e8 of the GitHub repo but it has some errors which I probably forgot to fix.

Things went smoothly to around December of 2020. I went on holiday in my imagination, got caught up with things and stopped progress. For 5 months. Online school started actually doing things and I was stuck learning Spanish and Maths and other subjects. This was the time I found Discord. As I said earlier, I hadn’t really used social media much. I only started using Discord because I found a small community of Minecraft players that I knew outside Discord. However, I started joining public servers and that was when I found the Python Discord server.

It was here I could finally find some friends that also liked to do programming. I talked to many people, got to know the community and started developing PyUnity again. That was when I saw the multitude of projects that were showcased in the discord server. I looked at quite a lot of them and I saw how their workflows all diverged and merged beautifully, each collaborator doing their little part.

I sought out some collaborators to work on PyUnity with me because I had never experienced working with someone else before. The thing is, since I was young, I never was able to work with others. I was usually rejected when working in a team so I would just have to sit there and say nothing. If I wanted to make across a point, it would end up just flying back into my face and then ignored. But this time I wanted to do things differently. I wanted to finally experience working with people of the same level.

The community hit differently. I was barraged with comment after comment about how python was far too slow to do anything, or I should learn C++ and write a game engine in that, or such a “beginner” like me won’t be able to do anything. These comments hurt me a lot, but it pushed me ahead with a new resolve: to prove those people wrong and to make a game engine in python that could exceed their expectations.

And so development continued. I fortunately found some friendly faces that helped me all the way. Sure, they didn’t really understand what anything I did was, but they kept me company and encouraged me to move forward. My code is terribly written, and I know that, but I also know that someone, somewhere will appreciate the hard work put into it.

I watched my star count go from 25 to 125 in a matter of weeks. I continued adding new features and fixing old bugs. I even started participating in code jams in various discord servers, to expand my python knowledge. Sometimes I would stop development because I ran out of ideas, and in those times I would go back to the joy of using Unity. But each time, I would imagine the great things that I could achieve with my version of Unity.

This is my story of making PyUnity.

Links:

GitHub repo: https://github.com/pyunity/pyunity

PyPi page: https://pypi.org/project/pyunity

Discord server: https://discord.gg/zTn48BEbF9

ReadTheDocs documentation: https://pyunity.readthedocs.org/

--

--

Ray Chen
Ray Chen

Written by Ray Chen

Just an aspiring programmer that loves to do things that no one approves of. Sometimes it works out, sometimes not!

No responses yet