top of page
Search

Dev Log 3# Restarted the Multiplayer Plugin now it works!!

Updated: Oct 13, 2023

So my first attempt at this project, things just weren't adding up I was sure that I followed all the steps needed but for some reason it just wasn't working and it got to a point where I couldn't even delete my saved folder anymore due to admin rights even though I'm on my personal computer...


After this I decided that I want to just get stuck in with some of the gameplay programming so I decided to just import the multiplayer plugin into a fresh new project and make sure everything was setup correctly. When I went to test the host session button in a packaged build not only could I connect to steam as usual but I also managed to create a session!!

At the time I was just a floating orb from a first person perspective but now I can focus more on the features inside the unreal editor and also other aspects of programming such as gameplay and UI.


Now that it's working I'll explain how it works. Firstly I'm using this multiplayer plugin as a listen server meaning one of the clients will also act as the server because I don't have a dedicated server but this will allow me to learn about Unreal's replication in more depth.

In order to access session functionality we need to get the session interface. This is done through the multiplayersession subsystem class which is derived from the UGameinstancesubsystem class. In this class we declare and define Session functionality that will allow us to create, join, find and destroy game sessions.


The menu class handles everything that the player will interact with when it comes to game sessions. It is also where the client travel takes place that's the main purpose of this class.


How callbacks and delegates work in this plugin. All delegates end in the word delegate, delgate handles end with delegate handle and callbacks end with the word complete.

https://docs.unrealengine.com/5.0/en-US/API/Plugins/OnlineSubsystem/Interfaces/IOnlineSession/ this documentation page is great at finding the delegates you might need for your game. some of these delegates have been used in the multiplayer sessions subsystem class for creating, joining, finding and destroying sessions.

We also created custom delegates which have been defined as the ones found in Unreal's documentation so that the menu class' callback functions can communicate with the multiplayer sessions subsystem class. It's important to note that with callbacks you need to account for the session functionality to work and fail. Delegates must be adding to the delegate list through delegate handles by using the "AddOnCreateSessionCompleteDelegate_Handle" function for example passing in the appropriate delegate and storing this in a delegate handle variable. You also want to clear the delegate list by using the similar function clear on "type" session delegate handle in the event of failure and success followed by a broadcast.




 
 
 

Comments


bottom of page