I participated in the 9-day Game Jam on itch.io https://gavynb.itch.io/running-gun
This is a game that I had to make within 9 days. The rules of the jam totally permitted me to use a premade engine, but I wanted to challenge myself and work from scratch. So, this was made in about 9 days using C++ and SFML. In the game, you play as a cowboy named Marty, who has to shoot down a demonic bull who makes it rain scorpions. During the first 2 days of the jam, I had a general idea of what I wanted to make: A wild west side scrolling shooter. My first idea was to have a cowboy chase somebody on horseback while they throw exploding barrels at him and he has to jump over other obstacles. But, by the time I had finished a good portion of my codebase, this seemed a bit difficult to pull of within my remaining time frame.
That’s not to say I worked slow. While I didn’t have a complete, solid design for my game quite yet, I spent about 2-3 days working on an entity component system and other “management” frameworks to handle things like animations and physics. Which was actually my first time doing all that from absolute scratch. The screenshot below shows the fruition of 2 days of hard work.
I was actually so happy to see that face when my project finally successfully loaded. It’s one thing to load up a sprite through a short series of commands, but loading up a sprite after you write a <Key, Value> Resource Map, Entity Component System and proper layering system is a different story. In just one silly little picture, you get proof that all your hard work is finally coming to fruition.
After that, the next thing I had to do was create and test a proper input/physics system. I attached a PhysicsComponent and PlayerController to the yellow dude, and allowed him to spawn another yellow dude when the space bar was pressed. After that, I got proof that gravity was working and my system of “queuing entities” to be added to the world didn’t have problems with the game loop.
Then I figured it was time to test collision and finally get things going in the graphical department; considering there was only such a short amount of time left. I added a red ball to the world so I could write a console output “Hit!” every time the two collided. I used a “tagging” method of collision detection, similar to Unity, so I could avoid type casting.
The ball actually stayed in there longer than I was expecting, I still needed to test out some various patterns and other components. It’s not like I wanted him in the final game or anything. It was around this point that the design for the game had solidified, as I released chasing a horse probably couldn’t be done within the timeframe I needed.
If I had any regrets about this project, it may be that the codebase was very big. It’s a simple arcade game that can be beaten in less than a minute, yet it features about 20 files of code (for both source and header files). I’ve seen SFML Mario clones that only have about 10 files. For a small project like this, I don’t think polymorphism in favor of “composition” is a bad idea at all. Programming patterns are great, but they’re best used for games where the project’s code would already be too big without them.
I also had to cut some corners during the last few days, hacking together code that “works” even if it’s symptomatic of a larger problem or it’s ugly to look at. Let’s just say I understand now when games have tons of cut content and some weird bugs upon release. Despite that, I will likely be using some of the code from Running Gun as a framework for future projects, but I have some cleaning to do before I want to use it again! I hope you enjoy the brief minute of gameplay that Running Gun has to offer, hopefully I’ll be back soon with some more fun projects!