Borough Battle
Strategic Text-Based Game

In this game, the user plays against the computer in a turn-based text game in an attempt to take over the five boroughs: Leaf Village, Sand Village, Cloud Village, Stone Village, and Mist Village

title image for borough battle game

Why This Project?

This was the first programming project I ever completed. Although it is a beginner project, I learned a lot along the way, from game logic to implementing conditionals, functions, 2D arrays, and player input. Beginning this project, I was invested in game development, but my limited knowledge held me from developing an advanced project with multiple sprites and environmental interactions. I wanted to create a project independent of others and develop a unique game. The game originally took 2-3 weeks to complete, but there are further improvements that I plan to add, including a GUI and perhaps some more strategic functionalities to increase the difficulty of the game in the future. Stay tuned for those updates!

Concept

example player versus computer game

The concept of the game is to be in control of five boroughs; Leaf Village, Sand Village, Cloud Village, Stone Village, and Mist Village.

The game is divided into three parts: the placement, the building, and the final battle.

In the placement, both the computer and the user have 10 soldiers which they can distribute any way they want in the five boroughs. The user goes first, and then the computer randomly assigns its ten soldiers. Both the user and computer must then pick their base borough. The user goes first, then the computer picks one. The computer cannot pick the same base as the user.

After this placement, the building occurs. The computer picks a random number between 10 and 25, which is how many turns this stage involves. In the building, the user and computer take turns in placing additional soldiers on the board. For each turn they can place one soldier in one of their boroughs. The computer chooses a random borough to place one of its soldiers in and announces this to the user. The user should not know how many turns are left.

Once the number of turns are over, the Final Battle takes place. In this round, each of the boroughs involves a battle between the soldiers. In each borough, the team with the higher number of soldiers wins and scores a number of points equal to the ratio between the two armies rounded down. For example, if the computer has 10 soldiers and the user has 4 then the computer scores 2 points (10/4 = 2.5 which is rounded down to 2). This score is doubled if a user wins its base borough. For example, if the user has 7 soldiers in its base borough and the computer has 2, then the user will score 6 points (7/2 = 3.5 which is rounded down to 3 and then doubled to 6).

The scores are tallied and the player with the most points wins. If the score is tied, then the player with the most boroughs wins. If that is also a tie, then the computer wins.

Struggles

Being my first project in game development, the initial functions were confusing to manipulate. I wasn't sure how to update the player and computer soldiers in each borough as the game progressed. I learned about 2D arrays and how to update the values for each placeholder, and that seemed to be the key to my answers about the data of the soldiers in each village.

My next problem occurred when the user chooses a base borough. I didn't have any way to save the information of what borough the play decided as the base. Originally, I was going to have a “base” value in each list element of the player, and then remove the “base” value for all others excluding the village the player chose. But this concept wasn't very efficient and would be repetitive depending on which borough the player chose. I decided doing the opposite would be a much better option, of appending a “base” value to the village the player chooses, and defining a variable for base village to the village name. Creating a variable to hold the base village name was done for ease when calculating the score, and to check which village was the base. Just appending the word “base” to the player list item wouldn't suffice since I wouldn't be able to check the existence of the “base” value in all the other villages and it would give me an error.

What did I learn?

pixel night-time image resembling a game end screen

For a beginner level project, I'd say I'm very proud of what I've developed. Although it might be simple, it opens doors to the future where I can create more advanced and enjoyable games. Game logic was fun to mess around with, and I found that I was coming up with new ideas without a clue on how to implement them. As my programming knowledge increases, I do plan on coming back to this game and adding new features such as a GUI, additional strategy components, and maybe a 2 player game mode. I want to continue my game development journey and I can't wait to share some new projects. Stay tuned!

To showcase my learning, you can view my implementation of a borough battle game and find more information about this project on my Github.