Felipe Ramos da Silva joined X-Team as a Fullstack Developer a few months ago. As a Python enthusiast, he recently decided to program a Python RPG that you play entirely in the command-line interface. The game is called Emberblast. While Emberblast is still in the development phase, it's already shaping up nicely.
In this interview, we discuss how Felipe developed Emberblast, what Python tools he used, and how he motivates himself to work so hard on personal projects.
How did you come up with the idea for Emberblast?
It's funny. I got the idea after seeing some of the Slack games X-Team had developed. In particular, as I was trying to beat The Tower, I got inspired to develop a game. But most games have a fancy UI. I wanted something a little more aligned to a developer's reality. The first thing that came to mind was a game in the terminal. The game I'd build would be played through a terminal, like a CLI.
Additionally, I really love RPG games. I'm also interested in data structures and algorithms, which might sound complicated, but they're not. Most of the algorithms and data structures I've come across professionally aren't very complex. It's graphs, trees, as well as traversing, shortest path, and search algorithms. All doable.
So I realized I could combine all these interests into a game. I could structure the map as an adjacent matrix, with each dot representing a node in the graph. That's how the idea was born.
Why did you decide on Python?
I worked with many programming languages, but Python was the one I learned first. The main reasons I selected it were:
- It's flexible and portable.
- The game requires quite a lot of math and analytics. Python works well with that, as it does with the AI of the bots.
- The
metaclasses
ability, which helped generate and assemble classes and objects at runtime with the dynamical flaccidity of an interpreted language.
What was the most challenging part of the coding process?
I’m still developing the game, although I'd estimate I've written sixty percent of the base game code. During that process, there were two parts that were particularly difficult.
First, player race and jobs. When you start the game, you're able to select a race (Human, Elven, Dwarf) and a job (Knight, Archer, Rogue, Wizard). I wanted this part of the game to be as customizable as possible. I wanted users to be able to edit a YAML file and add custom races and jobs.
In order to allow for that, the game had to read the config file, validate it, and create custom classes based on the configurations that people had put in. That was complicated, but thankfully, because of metaclasses
in Python, as well as some singleton and configuration management techniques, I managed to do it.
Second, the map itself. While graphs and traversing algorithms aren't inherently complex to create, they quickly become harder when you add constraints like inserting players here or there, calculating the possibilities of moving, generates a graph based on the number of players, etc.
Which Python tools did you use for Emberblast?
Tools were so important. For example, because the game's main communication interface is the terminal, it has to constantly ask questions to the user while also validating the user's input. For this, I used InquirerPy, a package based on the famous Inquirer npm package that someone rewrote for Python. This helped a lot for assembling raw inputs, selecting lists, and validating radios for players.
Another important dependency is the Cerberus package, which validates and parses YAML file using template schemes. I used this package to validate and certify the customizable game configuration file. It also notifies the user if there's something in the file that needs to be corrected.
I used NumPy for the matrix, mathematics, and calculations, as well as some things that are built in Python, like metaclasses, dictionaries, generators, and decorators.
And that's only for the singleplayer version of the game. I'm looking to create a multiplayer version and I'm currently looking for web frameworks like Django to help me with that.
Exciting! How do you motivate yourself to keep working on the game?
I believe that personal projects give you a world without constraints, where you don't have clients and vendors with strict requirements on the tools you need to use. Instead, you're free to use any technology you want and do whatever you like.
Sure, you still need to make comprehensive, logical decisions, but you can explore things that excite you, that you've never had the chance of working with. Plus, I'd be really proud to present it to my friends. I'm eager to see the full result, and that motivates me.
Finally, you've already touched on this briefly, but what features do you still want to implement?
I want to finish the singleplayer version first. There are many things I'm really excited about, such as the bot AI. I've already created some AI for the non-controlled players, but it's still a hardcoded decision mechanism and not exactly AI. I need to implement some deep learning algorithms and models, as well as an AWS service like SageMaker, so I can build the AI with machine learning models.
Then comes the multiplayer. I'm thinking about modeling it after the queuing system of League of Legends. People enter the matchmaking queue and when enough players are found, the game starts. This will mean websockets, multi-threading, a game client, and more, all of which are exciting technologies.
I also want to make the game as customizable as possible. People should be able to clone and change attributes of the game easily, i.e. in a file where all the game config is stored. They should be able to change races, jobs, game behavior, skills, etc.
Finally, I only have a Deathmatch game mode and I want to change that. Today's Emberblast works like an arena where it's all v all with the last survivor as the champion. I want to add clan wars, like 5 v 5, as well as other game modes. And I'm working on a client that players will use when they switch to multiplayer.
Lots of exciting features in the pipeline! Best of luck with the development process.
Want to play Emberblast or understand how it's programmed? Visit its GitHub page here.
TABLE OF CONTENTS