I have realised that enough time has passed for another post to be in order, so buckle yourselves in because this post is definitely going to be super exciting, and not be another one of those boring technical posts...
To start off with, I have recently created a new map to be part of the initial release. This one has a focus around a “payload escort” game-mode, where each team has to move the “cart” from one teams side to the other. The cart is moved when someone stands next to it, and the game is won when a team pushes the cart into the other teams goal 3 times:
The setting is in the sky, for some reason
The reason for adding this map, and for adding a few other maps that I have planned, is firstly because these game-modes are fun to play, but secondly as a way of demonstrating the types of game-modes that can be created yourselves, using the in-game editors. And now that I’ve hooked you with an interesting gif, it’s time to talk about technical things...
Now, while I was testing the new map in multiplayer, I came across a variety of issues. Players were not able to shoot each other, people would be disconnected at the end of the round etc. I worked out that each of these bugs all stemmed from the same issue, and that was the method that client’s were being ID’d by wasn’t working properly. Let me elaborate...
When someone joins a game hosted on a server, that player, or “client”, needs to receive a unique ID number. This ID number is used to differentiate players from one another, and needs to be the same value on each players computer. The way these unique ID’s were generated previously was using a “stacking” method. When a new player joins, they receive the largest ID number not currently taken, and when a player disconnects, all other player’s ID’s update accordingly;
Player with ID 2 gets new ID 1
Now, this ended up causing a few issues. While it felt like the most efficient method to provide ID’s to players, problems occurred when step 3 was occurring at different times on different Client computer, for example if a client still has the ID 2, and sends it’s actions to the server, who has that client stored with an ID of 1, then those actions would not be performed.
In order to fix this, a new method of providing ID’s is now used, which follows a more basic approach. Instead of reshuffling the player ID’s when a client disconnects, the ID the player had instead remains available, so that the next Client that connects will be given the first available ID to use;
The new client takes the first available ID, which is 1
This new method means that Client ID’s are no longer varying throughout the game, making multiplayer interactions as a whole a lot more stable.
Another major change that was made was in regard to optimising the actions system. Each object can be given a list of actions that can be performed, based on test-cases. For example, a door can be opened when within range of the player, or a bomb can explode when a timer runs out. These actions are all saved in an objects file, and are loaded in as a string during the game when that object is created. Now this may sound pretty stupid, but previously these actions had to be decoded each time they were performed by the object. This means that every-time a player went near to the door, for example, it would have to go through each loaded action, and decode the ‘string’ that they were saved as in order to work out what kind of action it was.
Naturally, this was extremely inefficient, and caused noticeable lag when an object had a larger number of actions to perform. The change that I made was to optimise this action system, making actions to be decoded only once, when the object is created. These decoded actions can then be easily accessed later on, without having to go through the loaded string to get the saved values.
That should be the super technical changes out of the way, so here are a few “smaller” improvements I have made;
- A kill-feed/alert system has been implemented, detailing when someone has been killed, or when players join and leave a game;
That Old man really likes leaving
- The Point system in multiplayer is now purely server-side, meaning that it is a lot more reliable keeping track of these scores across all the connected players
- Support for controllers has started, with movement and basic aiming implemented;
Like I said previously, the game is getting very close to finishing, and I plan to have it done by the end of this year.
Hopefully this post has been an interesting read, unless you hate technical stuff, in which case my apologies,