After 6 months it was the time for me to give an update of the current state of the project. Even when I don’t give any update for such a long time, behind the scene I still work on the game.
This update adds a lots of improvements in many domains so I splitted the article in two parts: technical aspects and game aspects.
Using the experience I acquired in my full time job I tackled one of the biggest problem I add with the game engine which was… The wiring of all the system.
To make an application developers regroup similar concepts in files often called ‘classes’, ‘object’ or ‘structures’. These classes almost always need others classes to do their work for example I may have a class DamageSystem which need the class NetworkManager to send the damage update to the network interface. In this case the NetworkManager is a dependency of the DamageSystem.
In the code this means that at some point I will need to pass the NetworkManager reference to the DamageSystem class. Traditionally we do that manually but when you work on a project of a certain size passing the objects to the classes that need it can become a real pain. This is due to two reasons.
First if you want to share an object to multiples parts of your application you will have to pass it around in the constructor of the classes in between those parts. This means that if you want to remove it or share more objects now you have to rewrite the code in all those in between classes. Again, depending of the depth of your classes hierarchy this can be a real pain.
Second by passing the object reference around classes you open your application to bug because an intermediary class may modify your object in an unintended way. Also this break the separation of concerns principle (SoC) as a class should only know about the dependencies it need to perform its work.
To face this problem a lot of developers decided to use the singleton design pattern as you probably know this it not a good idea on the long run as it complicate the testability of your application, make it less flexible and also make the singleton object accessible from everywhere just like a global variable. If you are interested you can find on google much more arguments on why not to use this pattern but just so you know I refused from day one to use it.
Instead I decided to use dependency injection. To you who follow my journey as an evolving programmer let me tell you this: dependency injection is the best programming design/technique I have ever learn about so far and it will probably never be beaten by anything else.
The idea behind dependency injection is pretty simple when you create a class you put in its constructor the dependency to the others class it may have and then you let the injector create your class for you. The idea is that your class should not be aware of how its dependencies are created which is very nice for the SoC principle.
By explicitly defining the classes dependencies in the constructor, you can easily test your class in isolation because you can create mocks for these dependencies. Also by using interfaces you can even abstract the implementation from the definition. This is very powerful because now you can change the implementation and not having to touch the class which has it has a dependency. It also helps to reason about the code flow instead of the implementation.
I won’t go into the details of the framework inner working but for your information I use the Guice framework.
The dependency injection refactor took me a lot of time but know I can easily plug different parts of my application together in a fully configurable and testable way.
The big changes which are not visible yet are the GUI for mobile. I worked on many UI elements for the mobile version to make the game enjoyable and fully compatible on this platform.
I also did a little bit of pixel art to create missing assets such as the joysticks. You can see the result of the final GUI in the screenshot below:
As you can see I also added the long awaited minimap.
I reworked the inventory window and it is more compact and appealing see by yourself:
Overall I’m pretty proud of how the new UI elements looks.
I added a weather system in game which is working but I am not satisfied with the end result so far so it will be deactivated for now.
I started to learn GLSL shaders and I love it! I used them to color the cloud textures of the weather system and to display the mini map as a circular image. This is really a more math oriented language but it is pretty rewarding at the end. For those who are interested you should check out https://thebookofshaders.com/ .
Here a non exhaustive list of notable update/changes added in the game (in no particular order):
A new type of spell: the temporary buff. As the name implies it give to your character a temporary buff.
A system that display the messages of people around you as a bubble above their head
A small chat history of sent messages (use the arrow keys to navigate in the history).
Limit for the chat messages to 280 characters.
The current FPS and PING are now visible on the bottom right corner of the screen.
Fixed a bug where player commands where ignored by the server under very specific condition.
Improve the menu screen a bit and added keyboard support on those.
Remove useless assets from the distributed executable.
I also fixed some smalls memory leaks and made many minors UX improvements.
Currently I’m working on the launcher so it can be run on windows, linux and mac os without requiring java to be installed this means that I will package my own JRE along with the executable. I made some tests and it is working on windows but I still have to update the website to reflect the new download choices.
I want to improve the proxy server so it can handle the connection state of the players (ie: know in which server they are depending to) and I want to add admin commands.
Regarding the game I still want to implement more interactions with others players such as party and exchange.
That is it for now. See you next time!