Project Freeman: a remake of Risk

Project Freeman

Overview
Project Freeman began as a game meant to be a spin off of the board game Risk. The name Project Freeman was meant to be a code name before an actual name existed. I was the sole developer for the game writing all code involved, while my friend James wrote much of the plans, and my friend Dylan did the artwork. Basically each player would join a game and start with ownership of a single country, and their objective would be to become more powerful than the other empires and overthrow them. This could be done through different attacking methods, boosting your own economy and through other methods all with the purpose of obtaining supreme power. Players have the option of joining many games that are in progress where they can send messages to each other in game, and interact by the actual game play. I made this game a few years back but never completed it as the actual planning of the gameplay just seemed to be a mess and I never got back into it with my friends. I used libgdx for the game as well for both the launcher and the game. Scene2D was used for the UI in both launcher and game. Since it is not truly finished I offer no download links but feel free to download and compile the source code from the link below.
Source Code: https://goo.gl/NqBHQb

AW9YG33X6Qs

Backend
The powerful software allowing the whole game to operate was the server. It operated with the help of the Java networking library KryoNet which allowed data to be sent to and from the client and server. The server served as an account validator / creator, the central point hosting all games and transmitting new events from each game, and to autosave players accounts and game data. Per client request it could transmit game information, list games that are available to join, and broadcast chat messages. It was the linking point for all clients that would play the game. The server could even send out text messages if an error occurred notifying me or my friends to fix it. (Example console log shown later in this portfolio)
Commands
Within the server console, there were a variety of commands that allowed server usage to be more functional. These included: ‘get password ’, ‘game id ’, game stop ’, ‘server info’, ‘stop’, ‘delete account ’, ‘ban username ’, ‘ban ip ’, ‘save’, ‘help’, and ‘create account ’. These simple commands increased the functionality of the server and allowed it to edit account or game data without having to create an entire new game or player account. The effect of each command should be generally self explanatory.
Saving
Periodically the server was setup to automatically save all game data, and update all user files. This was done on a separate thread rather than the main server thread as to not disrupt transmission of crucial game data. This was done through Java Serialization. It allowed for an easy data saving format which could be saved and opened very simply through native Java features. Although this is a very simple way to save data, the files that are created cannot be edited by opening them through a text editor which makes the commands that were implemented very practical in editing saved data.

Possible commands as they appear in the code

Networking
The most important aspect of the server was its ability to transmit data. Through the help of the lightweight Java networking library called KryoNet this task was accomplished. KryoNet allows for a simple way to send TCP / UDP data to a multitude of clients. It could update clients as a new game event occurred such as a new weapon in game being bought or a new in game chat message being transmitted. Sensitive information such as account passwords were sent encrypted with the help of a Blowfish Cipher.
Error Notifications
If an exception was thrown on the server or some other error occurred, it had the ability to send out a text message to myself and my friends telling us that something was wrong along with a simplified version of the error.

Launcher
The Launcher for Project Freeman was a piece of software that allowed users to create accounts, view the change log for the most recent update, automatically download the most recent game version, view the twitter feed from the Project Freeman twitter, and log in to play the game. (Pictured later in this portfolio)
Account Management
The launcher allows users to log in and create an account. All account usernames and passwords were limited to containing certain characters. Upon logging in or creating an account, all data was encrypted before being sent.
Information Display
In addition to displaying the account management portion, other information is also present. On the right side of the launcher, you can see both a twitter feed from the Project Freeman twitter account and the change log for the most recent version which is accessed from some files stored on Github used as a file server.
Auto updater
As the launcher is opened it checks to ensure that the user has the most recent version of the game. It does this by accessing some files hosted on a Github server. If the user does not have the most recent version, it downloads the most recent version from this server and replaces the older version with the updated one. It shows a status of the download percentage as the download occurs. After downloading the new updated game can be played without any messy user dependant updating.

The Game
Project Freeman was created with the huge help of the multi platform Java based gaming engine, LibGDX. LibGDX allowed me as a developer to focus more on the user side of the game rather than handling graphics and interacting with the graphics card at a lower level. After logging in through the launcher another .JAR file was opened which contained the game. It began with a loading screen which loaded all necessary assets followed by a menu screen where players could join a game. They were then brought into the magic that was Project Freeman. (Pictured later)
Loading Screen
Instead of loading assets on the fly, for the most part assets are loaded upon initial deployment of the game. This allows for uninterrupted transitions between screens upon beginning actual gameplay.
In Game Screen
The in game screen was the most important aspect of Project Freeman. It allowed users to become immersed in the actual game. On this screen was a chat box for talking to other players in game, a list of players in your current game, and an event box which would display updates such as when another country purchased weapons or when an empire was gaining strength. Everything occurred in real time, as one person somewhere else in the world placed a new weapons system on their empire, you would see it as soon as it was placed, on your own screen. This is what allowed the idea of the game of Risk to be brought to a computer.
Menu Screen
The menu screen allowed users to join a game. On the menu screen was a list of games that were available to join along with the options of joining a random game or creating their own game.

Conclusion
This game served as a coding project unlike any other. It allowed me to collaborate with some friends on a common goal and still be the sole coder of the project, which was something that I enjoyed. I came out of this coding project knowing way more than I began with which made the project as a whole successful in my eyes. It also gave me a taste of what a career in this field would be like and I think that this game, along with many other projects I have worked on, are the reason I want to major in Computer Science so strongly. This project specifically combined almost all the aspects of my knowledge in Java and programming as a whole. The biggest part of the project for me was not what I knew but what I did not know. It became a constant quest of learning about new aspects of computer science - it was a quest of understanding rather than copying and pasting. New topics learned through this project included multi threading, networking, interacting and hosting with a server, managing a larger coding project, sockets, encryption, and serialization. All these topics were taught to myself through online videos, websites, and books. No formal courses helped me with the knowledge needed to create this game. Despite this hard work the game fluttered off after most of the support structure of it was developed, largely due to poor game design that created flaws in the actual fun in the game. All in all it was an experience I will never forget and I believe it will greatly aid me moving forward. Be sure to check out the source code for the full effect of everything described: https://goo.gl/NqBHQb !