Battle Blocks
FJ Hagen
Game Programmer
Queries Unlimited
Introduction
I am currently working on a team of about 16 people on a networked multiplayer co-op horror game. My responsibilities on the team include gameplay and networking programming. Although still in development, I encountered some challenges working on a game that uses a client server model. Here are some of the challenges I faced and how I went about solving them. (Note: All art, UI, and level geometry is placeholder)
Interaction Popup
I suggested to my team that a popup appear whenever they focus on an interactable object to let they player know they can interact with it. My lead agreed and assigned me to the task.
The first problem was how the popup should spawn. My initial implementation involved creating a popup child object of every interactable object. This proved to be infeasible when I realized that the team did not know how many objects could be interacted with. I came up with the solution to instead add the popup to the player, and show and hide the popup when the player focused and unfocused on the object.
The second problem was that the popup replicated, meaning if one player focused on the object, all the players would see their popup. My solution was to make sure the code only ran on the owning client, so only that player could see the popup.
Also, to improve performance, I have the Focus Call event run on a timer instead of every frame. This feature allows players to more easily identify interactable objects and make for a more cohesive gameplay experience.
Sprint Ability
One of my first tasks was to implement a sprint ability for the player. I was able to quickly implement a basic sprint ability as well as a sprint meter that would deplete and refill, but that was the easy part. When I tested the ability on a server with multiple clients, I ran into problems.
First off, when I activate the sprint ability on any player that wasn't the server, the player would stop and not be able to move again. I have values in my code called NormalSpeed and SprintingSpeed. I set these by using the maximum walk speed of the character movement component. I initially set these in Begin Play. Going through the debugger, I saw that SprintingSpeed for some reason was set to zero, meaning the player stopped whenever they sprinted. I realized the speed was not being correctly set in the clients. To fix this, I set NormalSpeed and SprintingSpeed in the player constructor instead to ensure the correct values are set.
Still, this did not fix the sprint ability only working correctly on the server. The sprint meter would deplete and refill accordingly, but the player speed did not change. My solution was to use a Net Multicast function. Calling the sprint ability calls a server function, which then calls a multicast function. Even though all clients run this function, the sprinting logic only runs on the player who called the event.
Boombox
Queries Unlimited contains four player abilities that each player can use to capture the ghost. One of these is the Boombox, which grants the player unlimited sprint and lures the ghost towards their location, acting as a distraction to assist the other players.
The main challenge for my implementation was taking into account that unlike the other abilities, this one has a time duration for activation. To solve this problem, I used a delegate with a timer. Upon activation, I bound the deactivation function to a delegate and set a timer to call that delegate after a certain period of time. I also collaborated with our team's AI programmer to make sure the boombox would distract the ghost.
Conclusion
This game is scheduled to be completed in 2025. I intend to continue to update this page as development moves further along and I have more things to present. I'm already very happy with how my skills in Unreal's C++ and network programming have progressed. The challenges I faced and will face in this project will only make me a better developer.