Hello again, it's been a while. So, yesterday was the final presentation of our multiplayer game, and I think we did well. I made a prototype with basic gameplay, particularly focusing on the multiplayer aspect, using a level that one of my designers created, and we had a functioning game! (Gameplay video towards the end)
I won't post too much technical stuff here today, as my last blog was literally a tutorial for dedicated servers, but yeah, I got them to work, connected three of my friends to the game, and used Unreal's seamless travel to take everyone to the game level and begin the game.
A quick story here: since I'm new to Unreal's multiplayer API, I spent a lot of time reading and looking up the documentation. So, I was using the PostLogin method, which gets called whenever a client connects to the server. It was working when they connected for the first time and were waiting for everyone to be ready to start the game level. Once they travelled to the game level, I wanted to do a check to see if everyone had loaded the level and was ready to start. I was doing this logic again in the PostLogin method, but since I was using Seamless travel from the server, it meant the clients never disconnected from the server and travelled with the server to the game level. So, the method was never called the second time. This took me two hours to figure out. Embarrassing, I know.
Anyway, the way I solved it was to have a bool on the clients, which would be set to true on their BeginPlay, and the server would keep checking that bool for every client every 2 seconds using a timer before it would start the game. (I later changed it to checking if the player pawn is valid instead of a bool)
Pardon my blueprint aesthetics
I was pretty exhausted as I did everything from creating and handling the servers to implementing the gameplay mechanics that my designers wanted in the first level, and even some basic core mechanics (which I asked my other programmer to do, but he didn't do anything, literally zero work, but I won't rant about him here. Maybe. This is why I don't like random groupings at Uni; some of the teammates you get drag you down so much. Anyway, not ranting, moving on).
I was using blueprints a lot since I found them quicker to test mostly, and we had limited time. But they can easily be redone in C++, except some of the functions are named differently. But the compilation times in C++ are not that great, whereas blueprints take literally one second to compile. Epic said they are vastly improving compilation times in C++ in Unreal 5.4, which is in preview now, but I haven't tried it yet. But for the newer mechanics, I'm planning on using C++ for the most part.
I have to say the multiplayer architecture in Unreal is very elegant and quite fun to use (I don't know if most people would use "fun" here, but it's fun for me!). There is a really good unofficial blog, which was suggested to me by pretty much everyone I talked to online for Unreal Multiplayer: https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium/. This person has laid down basically everything you need to know before starting multiplayer development in Unreal, and it was of absolutely great help. The official documentation of Unreal needs some serious work, I must say. But this blog helped me understand the different classes that the server and clients each have access to and how they can be used with examples in both blueprints and C++.
We made just one level for this prototype, along with a waiting lobby level, where players would first connect and ready up once they are ready to start the game. We are planning on having three levels for the final game, each with different gameplay mechanics and challenges. And three base classes for the players to choose from, each with their different abilities. We have approximately one month to do all this. I hope we can do it, and I hope my other programmer does something, maybe just program the UI; if I can dream(any Elvis fans?).
Please enjoy the amazing gameplay video below. Please keep in mind the visuals and models are not finalized, and we are also planning on having drunken movement for the players(I did some physics stuff for it, but it was crashing the game in multiplayer so I removed it for now). I also made a pushing mechanic where you can push other players, except it's a punching animation right now, since I couldn't find a pushing animation, and it's in a separate video, as it wasn't ready yet for the prototype video.
The absolutely amazing push mechanic you will ever see
Thank you for taking the time to read this far and have a wonderful day! Au revoir!
Commentaires