GameDev 2019 Week 28 & 29: Multiplayer Lobby 2
Lobby, Target Order
03.08.2019 - 22:41Week 28
After only getting to the week 27 blogpost on monday, I worked some more on the multiplayer lobby on tuesday and wednesday. I made a new texture for the start game button and moved it to a more sensible location. I also made new "ready"/"not ready" icons and fixed the ready status so it can be toggled back to "not ready" if necessary. Then I added lobby syncing, so the game syncs the state of the lobby including all the game settings, the player ready state and more when a client joins later. Then it got really hot in germany and there was a lot of construction noise which made it hard to concentrate and to be honest I kinda needed a bit of a break from the multiplayer lobby, so I didn't really do anything more that week.
Monday 29.07
Getting back to the game after a few days off I still had to finish the multiplayer lobby. The first feature I added was a color selection panel, which gives the player the option to chose from 16 predefined colors. Changing the colors is broadcasted to all players and they were also added to the lobby state that is synced on join. I also updated the game, so it recognizes and uses the selected colors from the lobby. The icons in the player list and the mini map buildings are rendered in the players color. Back in the lobby I made textures for the player slots, a background texture for the color selection panel and a general all purpose small button texture. When I added the button texture to the game I finally fixed the bug, that text wasn't repositioned when the button used a different text alignment.
Tuesday 30.07
Probably the most important feature for multiplayer lobbies is kicking people from them ;) I don't know yet, whether or how I am going to handle public lobbies, but even when you are just playing with your friends you may want to remove them from the lobby if they start singing weird songs in teamspeak ;) Therefore, I added a kick functionality. I used some existing features and the server send the client a message asking it very nicely to disconnect from the game (and by asking I mean only in the code, there isn't a popup actually asking^^), and a client disconnecting is already implemented and deals with the rest like removing the client from the server and the other clients lobbies. Then I marked slots as disabled if the map has less than 4 slots, like the tropical island map only has slots for 2 players. The next feature I worked on was the ability to move slots, which took some time, because I kept overlooking things that also needed to be moved when a player moved to a different slot. While working on that and moving around in the lobby I realized that it is quite hard to see in which slot you are in, so I added a slightly different highlighted texture for the clients player slot. Finally I made a texture for the kick button and also added sending on enter to the lobby chat, because ain't nobody got time to move the mouse to the send button.
Wednesday 31.07
I started by creating a little crown icon and using it to indicate who is the host in the multiplayer lobby. Actually there was no host so far. Everyone could just change game settings, kick players or start the game however they felt like. Today I added a "host" in the game , although "host" is more like a "game admin" who is allowed to change settings, because the host doesn't necessarily need to host the game in a server sense, but I am going to use "host" to describe it anyway. Only the host is now able to access the game settings and change them, only the host can kick people from the lobby and only the host can start the game. And with this the multiplayer lobby is finally done, or rather feature complete for now, it will need some polishing and there are probably some features missing I haven't thought about so far.
Thursday 01.08
Today I worked on target ordering or target sorting. When there are multiple targets within the range of the tower, which target is it going to attack? Until now the tower just took the first target it found from the list, which is sorted in the order the entities were spawned in. To give the player some more control of which target is being attacked I added additional target orders like lowest health, highest health, closest and random. I had to rework the target selection functions to get it to work and also used this to combine them into one (there were multiple slightly different target selection function, which isn't good code design). To switch between the different target orders I added a button to the building window.
Friday 02.08
To have an indication in which target order the tower is I had to make 5 different button textures which depict the 5 different target orders. Even though I tried to make the icons as obvious as possible, there is no way to make them 100% fool proof, so I also added a hover text which says in which target order the tower currently is. However, updating a hover text while it was being shown was broken, so I had to fix it before I could use it. Then I had an epiphany and realized that in multiplayer games, players other than the tower owner could change the target orders and even worse than that, could delete a tower that isn't theirs, so I made sure to fix it as fast as possible. Finally, I added a music player to the game which just takes a bunch of music tracks and randomly plays them. I have absolutely no idea what music I am going to use, music usage rights are a pain and I never really tried to compose my own music, but it cannot hurt to have a music player.
by Christian - 03.08.2019 - 22:41
Comments
Comments are disabled