A downloadable game

Another Creator Day project for the Mastered course. As is the case with all of my Creator Day projects this was made in ~5-6 hours, based on a brief at the start of the day and I had to showcase it at the end.

You can find the GitHub Repo Here: https://github.com/Woeger/Amongus-2

CONTROLS:

WASD: Movement

Mouse: Camera

CODE:

The brief for this was very simple, make a game using Epic Online Services (EOS). While it sounds simple, I had no experience in netcode besides reading some of the GGPO netcode documentation so there was a lot of learning on the fly here. 

While I normally have a few code highlights to show. The real star here is the multiplayer implementation. This is all handled in the main menu widget.



The first piece of code to show is the simpler part, creating a session. I utilised the 'Advanced Sessions' plugin for Unreal to do a lot of the heavy lifting here. When I start the game I first need to log the user into EOS. I do this through a handy macro as its something that's done a lot. 


Epic handles most of this, but there are a few things to note. I'm already logged in during the video demo, but other users would get a browser pop up to log into Epic. You can see in the Login User function that it takes in an 'AuthType' so this can be customised. We check if the player is already logged in (in which case we can just skip this macro entirely) and if not, we run that function with some basic error handling to let the user know if something went wrong.

After logging in we use the 'Create Advanced Session' function, which takes in a lot of different inputs. I keep most of the defaults here, but I do limit the player count as the game doesn't intend to have more than 8, and this could cause some performance issues if we make a session thats too large. I also turn off most lobby support as only one session is intended to be open at a time. (Due to this being a rapid prototype!) Obviously this is something to consider if I took this game further, and I'd likely leverage that lobby support to work with multiple different games happening at one time. After that is some more print strings to help the player know when something goes wrong (and for me to debug!) before opening up the default map for the game.



The more complex code comes when joining an existing session. As with creating a session we first need to log into EOS, but instead of the 'Create Advanced Session' function, we use the 'Find Sessions Advanced' function instead. (Crazy!) We need to find the session first before we can actually join it. As there is only one session at any given time, we only need to search for a singular session here. 

A number of things could go wrong, and most of this code is checking if those had happened. If the search fails for whatever reason, we print a string. If not, we take the resulting list of sessions, which can only be 1 or 0 as we max out the amount of sessions we search for at 1, and check that length. If we have no sessions, we let the user know. If not, we can try and join that session with the current owning player. As the session is in progress we don't need to open any maps, Join Session handles everything for us there. Once again, we print if that goes wrong, but if all is well we let the user know.

The game itself is mostly just the third person template with some collectables scattered about to show replication working between clients. Said collectables are just a static mesh with a collision volume that destroys itself when it collides with anything. (Due to the boxes being static, only the player should be able to collide with them) 


Download

Download
Amongus 2.zip 573 MB

Leave a comment

Log in with itch.io to leave a comment.