My Inspiration for Making a Game in React

Nick Diaz
3 min readJul 29, 2021

Before learning how to code I had never entertained the possibility of being a game developer. I had always thought that the only way games were created was through esoteric, convoluted development engines with learning curves that resemble brick walls. The fascinating thing about games and game development, though, is just how broad the definition of “game” actually is. As far back as the early days of computing, developers have always pushed the boundaries of the tools they have in order to create interactive programs. Now, when even many indie games approach seemingly unreachable levels of quality, developers still find ways to craft engaging experiences with limited or unexpected tools at their disposal.

My inspiration to try making a game out of a framework like React came from a peculiar text adventure game made by Doublespeak Games, called A Dark Room. The first thing that struck me about this game was its extremely minimalist style. In the browser, the game was little more than a plain white screen with black text denoting a simple message feed, buttons for player choice, and a few different tabs. Later, as I unlocked the ability to explore the map of the game world, I was increasingly surprised by how the developer managed to create tense and exciting gameplay with little more than a grid of ASCII characters and the occasional text box. By the end of the game I was fully invested in the experience and drawn in to the world and story the developer had created, despite it lacking much of the visual storytelling or graphical spectacle present in many modern games.

Interestingly, the developer of A Dark Room included a link to the game’s Github repository at the bottom of the window. I spent a few hours browsing the code base, trying to figure out how such a novel experience could be built largely with just Javascript and jQuery. The time I spent with this game stuck with me as I learned React, and it inspired me to rethink what kinds of applications I could make with the framework. After all, if an application like A Dark Room could be simultaneously simplistic, engaging, and built with straightforward code, why shouldn’t I try something similar with React?

As it turns out, React was surprisingly adept at handling most of the functions I wanted to create. React’s component structure was very versatile and helpful for compartmentalizing logic and functionality into different pieces of the game, and the state management capabilities of React and React Redux were invaluable in keeping track of the player’s status and what they were doing. The wealth of external libraries for React was also critical for features like the client-side routing functionality of React Router or the ability to dynamically create interactive text boxes and modals of React Bootstrap. Of course, the foundations of basic Javascript were useful as well, for things like creative data manipulation or even allowing the user to move across the map by keeping track of their input with a simple event listener.

One of the most fun things about software development is being able to get creative with the tools available to you. React, and by extension many other frameworks and languages, is flexible and powerful enough that with enough thought, patience, and clever hacking, it can build a far wider array of applications than you may expect. Take some time to try and hack out something new and different, and you may find that it’s possible to draw a uniquely memorable experience out from a place you might not expect.

--

--