pingpoli.de



GameDev 2019 Week 19: Refactoring

Refactoring - the favorite thing of all developers

26.05.2019 - 12:46
I spend most of the week refactoring some aspects of the game to improve the structure and quality of the code. I also started to experiment with a new gameplay mechanic, which I am not going to write about just yet. Therefore there isn't that much interesting to share this week, so I am going to keep this blog post very short.

The main thing I wanted to change about the code structure were the server/client differences. There were still some server switches in the core game code, which shouldn't be in there. The game code should be the same on the client and the server. I actually drew a little diagram on a piece of paper of a better structure for the code. The server and client specific code is in a network layer on top of the game code. If the server recieves a message it can handle the server specific aspects of it in the server network layer and then update the underlying game. This way the game is exactly the same on the client and the server and it only has to care about the game mechanics, while the network specific stuff is in its own layer.

As mentioned above I started to work on a new game mechanic or rather a new gameplay mode. This is one of the more difficult aspects of game development or software development in general. Trying to set up the code in a good and easy way, that is also going to hold up for further expansion, which is especially difficult if you are most likely going to think about new ideas in the future that you don't know about yet. Therefore the progress was a little bit slow, because I kept thinking about whether it is a good way of doing things or if I could think of a better way. As in most cases, there isn't really "the" best solution for anything and I had to try to find a good compromise. Even some of the existing features may need an overhaul to better support the new additions. At the moment I am not entirely happy with how the code is layed out and it will definitely need some more work next week. When I got stuck trying to decide on how to implement the features on the game side, I already worked a bit on some new UIs that I am going to need.

Unfortunately, there aren't any nice screenshots to share, the game looks exactly the same as it did last week, because all the changes were in the code and not in the design. I hope there are some better things to show next week.




by Christian - 26.05.2019 - 12:46


Comments


Comments are disabled
Social Media:  © pingpoli.de 2020 All rights reservedCookiesImpressum generated in 8 ms