jrombk: 'Our epic RTS game'

Published on June 26, 2024

CLow levelKernelHackathon
jrombk: 'Our epic RTS game'

The source for this project is available here: https://github.com/Shinji322/jrombk.

"jrombk" is a ncurses based peer to peer multiplayer game written in C! This was made for the "DandyHacks" hackathon. The team consisted of me, my friend Joshua, and my other friend Orestes

Originally, I floated the idea of a "pvp terminal game". It would be insanely sick even if it wasn't feasible. Actually entertaining the thought led to the realization: it was actually doable.

I made the github repository. Our first, and arguably biggest, roadblock was a name. What should a project as epic as this be called? With our creativity pushed to the limits, we decided to fuse our names "Joshua", "Ronan", "Orestes" and then our last names: "jrombk"!

Designing the Game

The repository was created; great! Now what do we do? Well, we figured the actual mechanics of the game should be discussed at this point.

At first, we thought some sort of real time strategy would be interesting. The user would simply deploy their troops and see them attack; perhaps the strategy would come from placement of one's troops. However, that was quickly shot down for being too lame.

After some research and thinking, we came up with the idea of a sort of "Bomberman"-esque game played in the terminal. Two players would place bombs whose blast depended on terrain. Each player would have three lives; the first to lose all would be the loser.

With that in order, it was time to actually write some code.

First Hackathon Woes (Day 1)

Of course, ncurses was the frontend of choice. After that, we decided that we would simply use unix sockets in the form of C's socket library.

I worked on the ncurses frontend, on the game loop, and socket code.

For the team, this was our first experience working collaberatively. We had used git before but never shared code on Github with other people in this sense. Suffice to say, it was an interesting experience. We all worked on the same branch and pushed huge blocks of code at a time. Perhaps my teachers at school would scold me for this but, at the time, it was working for us so there were no complaints.

After a while of hacking at ncurses, I got to some basic loop initialization and buffer rendering. I attempted to look at some of Orestes's socket code but at some point I ended up passing out on top of my laptop.

After around 2 hours, I woke up and noticed that pretty much everyone had left. More importantly, the hackathon's food supply was exhausted. Hungry, but without many other options, I asked Orestes and Joshua what I had missed.

All I heard in reply was "It works!". We were able to connect and kind of sort, of play a game. There were quite a few unforeseen issues in the actual combat.

Only at this point, I realized there wasn't a consistent style guideline. I was simply under the impression that my style of tabs formatted to 4 spaces was common. There were inconsistencies among all of our files; some files had function braces on the starting line while others had opening braces on the start of the next line. I spent some time reformatting the code so human eyes could read it. An .editorconfig file was in order.

Optimizations (Day 2)

First action on Day 2, we went to Orestes's car and waited until "Panera Bread" opened. To be honest, this day was mostly spent ironing out bugs that shouldn't be there. These wouldn't have existed if we planned the project properly before implementation.

Most notable was our journey fixing the game's speed. We thought the game was too slow at some point. Naturally, the networking was suspected as the culprit first. A very simple in house implementation of Run Length Encryption didn't end fix the issue, however. Upon further expection, it seemed the issue was that simply we had a defined that we were running at 30 fps instead of 60... not our finest moment.

Finished Project?

Somehow, the project was completed on time. Despite that, we didn't end up presenting anything on account of being asleep.

Anyway, here it is!: