moin and hello i'm Lothar from maygames
and today we will talk about using epic online services with unreal engine
blueprints recently i've read a lot of requests
concerning the epic online services like what are epic online services, how can i
integrate them with unreal engine and can i use them to run dedicated servers
for my game spoilers: nope, you cannot run dedicated
servers on epic online services but you can use them for a lot of other
interesting things to show you what can be done with epic
online services we will create this sample game together step by step using
blueprints only we will use the new online subsystem eos
plugin by epic games and a modified version of the
non-commercial advanced sessions plugin this video was created using unreal
engine 4.27.2 the online subsystem eos is currently a
beta release and that's not just empty talk as we will see, some parts are
pretty broken. now let's take a quick look at the epic
online services feel free to skip this section if you
already know about eos let's say we've published a single
player game named Rocket it has some progression system and
players can unlock attachments for the rocket like a small rocket on top of the
large rocket this is a single player game so experience level and unlocked
attachments can be stored locally for example in a savegame
this savegame may be synchronized to the cloud
but apart from that it's all handled on the pc where the game is running
so it is absolutely not a problem if there are many people playing at the
same time and if some players exchange their
savegames it's fine, who cares
now let's say a lot of players have requested a multiplayer mode for the
game and we have finally published an early
access version of Rocket 2: The Return players can join online games to compete
firing their rockets to save time
we've reused the savegame system which we made for the first rocket game
but of course people start to copy and modify savegames to cheat in online
games and other people complain that people
are cheating in general we can no longer trust local
savegames when it comes to multiplayer there are a few exceptions
like traditional shooter games without a
progression system for example unreal tournament
but usually we need to store and update player
progression and unlocked attachments in some kind of online service these online services
are the "backend stuff" that no one in the game company wants to
develop because
it's not really game development and these services usually do very
simple stuff like storing a certain state it's pretty common to say it's easy
let just Bob do it whatever
sorry to all the Bobs out there let just Bob do it well
Bob is maybe a ui engineer and probably worked on some big titles
like battlefield 2042 for his great work on battlefield
Bob is promoted and now he is a full stack engineer and he will create these
simple backends what could possibly go wrong remember error 37 online services are a very frequent
source of player frustration in multiplayer games
i am very sure you know several examples like these the problem is
backend services need to scale well and be extremely stable
in his job as ui engineer Bob is used to implementing tons of features
in a very short time and of course
there will be glitches that's normal nowadays in game
development because of time constraints
large game companies often do not prioritize those glitches
so Bob is used to working that way but for backend engineering we need a
different mindset the online services need to work
100 percent of the time because if they are not working
not secure or not scaling up properly people simply cannot play online
so don't just let Bob do it use existing services if possible in this picture i have split common game
services into two categories the green category on the left
contains general purpose services like login, matchmaking, player progression
and store items some of these services are actually
provided by different online platforms we should not reinvent these services
unless we really really have enough time and commitment to do so on the right side there are services
including dedicated servers and loot boxes that we usually implement on our own because they are very game specific
if we are developing the rocket 2 multiplayer mode for pc or mac
the most obvious solution will be to use the steam sdk and steam services
steam provides login matchmaking and some kind of progression system which
may be sufficient and the services are pretty well tested
with unreal engine so instead of telling bob to write the
services we could simply use steam
however if we are also publishing rocket 2 on consoles or even mobile devices
then that's not easy with steam if we want to use the same progression
state on our ipad as on our pc the ipad would need to request the state
from steam but usually steam is not used on the
ipad so this is not working out of the box
bob would need to implement this and this is the point where the epic
online services come in and shine eos can be used on all kinds of devices
with cross play this means with eos
we can have players using playstation, xbox, pc, ipad all connect to the same
dedicated servers and play rocket 2. and Bob has more time for his great ui
work in addition to that, epic online services
provide more functions than steam like for example storage
and more access right options this allows us to implement cheat
resistant online savegames for rocket 2 by just using eos
without implementing a single backend service to sum things up
what are epic online services eos are not running our game logic
they are a set of general purpose gaming services like authentication matchmaking
and player progression that are provided for free and that can easily be used for
cross-platform games they also provide storage
that's really a huge thing and it's great
i'm really convinced that it is a great idea to give eos a
try so now we are diving into using eos with
unreal engine blueprints the easiest way to use epic online
services with unreal engine is the online subsystem
an online subsystem or oss for unreal engine implements a set of interfaces
that can be used to access different online platforms using the same function
calls i'm quite sure some of you already know
the online subsystem steam for unreal engine
there are several tutorials available how to use it with blueprints
in general the oss epic online services implements the same interfaces as the
oss steam so the lead engineer of rocket 2 may
think they implement the same interfaces, we
could just switch from oss steam to oss eos without changing any code or blueprints
in other news no fat yogurt tastes good well as you probably imagine it's not
working out we cannot just change the configuration
from oss steam to oss eos and be done with it at least not for any non-trivial game it seems that in the current beta
release epic games did not design the oss eos
to be compatible with the oss steam the most recent update improved things a
little bit, however, it is still a long way to go
so if you have an unreal engine multiplayer game that runs perfectly
fine with oss steam do not expect it to work out of the box
with oss eos additional changes will be required
that being said to demonstrate the usage of the online subsystem eos
we are starting with a new game from the scratch after all the theoretical work
we are finally starting unreal engine let's create a new project in the
category games as template for our epic online services
test game we choose the third person template it has basic multiplayer support this is a blueprint only project, no C++
involved the other settings are pretty much
irrelevant choose any project name you like
i call the project eosblueprints we create the project and the editor has
started it's always a great feeling to start
something new this is the third person template
let's just run it for a moment it comes with a small map
where we can run around and jump and there's another spawn point for a
second player who can join and guess what, the other
player can also run around and jump and this is our goal for today to let a
second player join using epic online services with
blueprints only as a first step we need a modified
version of the advanced sessions plugin we need the blueprint nodes provided by
this plugin the official version of the plugin
currently does not work with eos but hopefully it will at a later time
so we close unreal engine and download the plugin
there's a link below this video next we go to the project folder of our
third person project, i've prepared this here we create a new folder named plugins plugins and there we unzip the plugin we just
downloaded to this plugins folder and make sure it's there. okay.
and i'm also creating a shortcut to the project on the desktop so that it can
easily be opened fine, back to unreal engine
and we need to make sure that the advanced sessions plugin is listed
it should already be enabled because it was placed in the plugins folder of the
project what we are going to verify go to edit
plugins search for the advanced sessions plugin and there you go it's already enabled
in addition to that we need the online subsystem eos plugin so let's find it
eos and enable it
as i already mentioned it's still a beta release
we're restarting the editor the other eos plugins will automatically
be enabled with this online subsystem plugin there you go so now we are ready to go
i have to admit i'm a little bit impatient
and i remember setting up the online subsystem steam some time ago
i had to do similar steps and then just add some entries to the default engine
config file and basically it was done
so i'm going to rush forward you don't need to do this yet it's just
a demo let's go to the online subsystem eos
help scroll down and copy the config file entries listed
there like for the online subsystem steam
go to the config subfolder and paste them to the default engine config file and then
reopen the project and let's see what happens and bam i'm being smashed by this crash
dialogue this is really a brutal retaliation for
a little bit of impatience don't you think
and it also feels very encouraging well ok so i got it
i'm undoing all these changes and i'm going to slow down a little bit before enabling the online subsystem eos
in the default engine config we need to configure the eos plugin so open the
project settings scroll all the way down to the plugins
section select online subsystem eos and we need to set up some parameters
here most of these parameters come from the
epic games developer portal where you need to set up a product
the default artifact name is the name of the product which you set
up there so we enter the default name my product we enable overlay and social overlay so
that we see some eos notifications our game is not being launched in the
epic game store but we need to enable epic account services
which is basically the login function next we need to add an artefact which is
again the product from the epic games
developer portal and again we are using the default
product name my product the encryption key is for simple
encryption of some data stored on eos we need to enter 64 hexadecimal
characters i am entering 64 zeros the remaining parameters need to be
copied from the product page on the epic games developer portal
creating a product there is very intuitive but you need to create a client and
assign a client policy make sure that the client policy type is
set to peer-to-peer this is very important otherwise
creating sessions will fail at a later time after creating the product go to the
product page and you will find all the parameters in the product settings section sdk credentials
double check to copy the correct values the order is different on this page than
on the settings dialog this is not a time to be lazy
and product id and application id are two different things
values should be treated as secrets this is why i'm not showing them here
okay let's just assume that we've entered all the parameters and now we can finally edit the default
engine config as we already tried earlier
we are shutting down unreal engine for this go to the subdirectory config of the
project open the default engine ini file
and we need to activate the online subsystem eos here
and set it as default online subsystem there's an official documentation page
available for this, link is below this video and scroll down this documentation page and copy the lines which need to be
added to the default engine ini paste them into the config file and remove the spaces now as we see
the online subsystem eos is enabled and set as default platform service
which is what we want this time i'm not being smashed by a
crash and the online subsystem is finally
enabled driven by this small success i'm getting
carried away again maybe this time it is as simple as the
online subsystem steam where we can start a standalone game
with steam running and it will log in automatically and everything is ready to
be used so the epic games launcher is running
let's start a standalone game and then we are waiting for the eos
overlay to appear and we are waiting
and we are still waiting and we played through the baldur's gate
series in the meantime and we are still waiting to cut it short
there is no auto login by default at least not for products outside of the
epic game store bad news we need to log in manually
in order to do this we will create a main menu level with a
main menu to separate this from the game level
ok so we create an empty map
go to the maps folder right click
new level main menu and we open the new map and of course we build the map so that
all the lighting on the empty map is calculated and we want to set the main menu map as
default map so
we go to edit
project settings maps and modes and we select the main menu map as
editor startup map and game default map okay now what we intend to do next is to
initiate the login through the main menu and as a first test we want to start the
login directly after loading the main menu map
to do this we create a game mode specifically for the main menu
new blueprint class with parent class game mode base and we call the new class main menu game
mode we open it
and next we implement the begin play event for this game mode
we want to log into eos there are two login blueprint nodes
available however the show external login ui node is not implemented by the
online subsystem eos so we have no choice but to use the
login user blueprint node this node is from the advanced sessions
plugin i've modified this node in the plugin
and added a parameter called auth type this parameter usually needs to be
provided for the online subsystem eos the auth type tells the online subsystem
which kind of authentication we are willing to use we are authenticating a certain player
so we pass the first playercontroller we are not supporting local multiplayer
at this time and we use the auth type accountportal
which is available by default this is some kind of interactive login
using the web browser on success
we print a success message on failure we print an error message compile and save now we shouldn't forget to assign this
game mode to the main menu map in the map view click on blueprints world override game mode
and choose the main menu game mode okay now the main menu map is using the
main menu game mode which will trigger the begin play node which will then
trigger the login user node maybe we are finally logging into the
epic online services let's try it using a standalone game finally
the web browser opens with some confirmation screen
you may have to log in first we simply confirm both screens make sure
to find the correct button the colors are inconsistent
and then we see our black map and nothing happens just kidding the login was successful
and we are finally getting our social overlay
and we can also press shift f3 to open the social panel
note that this is on windows, there's no such overlay on mac os at this time
that's probably because epic games and apple have so much love for each other
apart from that this is a success
we are finally able to log in and we are clearly on our way to start a server and
join a game now we need to create a session
which basically means creating a server game
and then join this session which basically means joining a server game
so the next step will be to design a simple menu which allows us to create or
join a session let's create a ui folder
and create a new widget blueprint wbp main menu we open this widget and we add a vertical box for some
buttons we position the box in the center by
setting the anchors position to 0 alignment to 0.5 and we enable size to content
so that the buttons fill the vertical box next we add the first button i'm setting the button color to
something a bit more interesting you are under no obligation to do this and next we add some text to the button and set some padding
so that it looks better and set the text to
create session and set the button name to button create session we've prepared the first button and we
duplicate this twice for a total of three buttons the second button is the join session
button so we change it accordingly and the third button is a quit button to
quit the game okay we have a menu with three buttons
create session join session and quit next they should do something
let's start by implementing the quit button this is the easiest one
select the button scroll all the way down to the event
handlers and implement the on clicked event
there we simply call the quit game blueprint node
and that's it, we are done with this button ok the main menu is ready for an
initial test we just need to create the widget and display it
the simplest way to do this for a small project is to go to the main menu
game mode and create the menu there
so let's just remove the login user call
that we added earlier this will be moved to the main menu
widget blueprint later we call create widget select the widget blueprint main menu and use the first player controller as
the owning player the widget we just created is added to
the viewport so that it is shown
next we set the input mode to ui only because we have an empty map and nothing
is going on there so the only interaction will be with
the ui and we pass the button create session
as the default widget to focus and we pass the player controller and next we enable the mouse cursor for
the menu okay
test early test often we are ready to test the menu
start a standalone game the menu is shown, this is all fine
and the quit button is also doing what should be done
ok now the serious part begins
the next steps are to implement the create session and join session button
handlers this is somewhat more complex but we are
up to it let's implement the create session
button handler first so that later we actually have a session
to join select the create session button and scroll all the way down to add the
on clicked handler okay
since this is a button which can be clicked multiple times but we only want
to log in once, at first we check whether we are already logged in
and we only call login user if we are not yet logged in
and there's a blueprint node for this it's called "is logged in" and we need to provide the owning player
for this okay and only if this player is not
logged in we call login user for this very player
again with the auth type accountportal ok and on failure
we print an error message and on success
we finally create a session this basically means we prepare a server
we use the node create advanced session for this it is provided by the advanced sessions
plugin there are a lot of parameters available we provide
the owning player and set the number of public connections
to 8 because this is not fortnite and also we disable lobbies
lobbies with the online subsystem eos did not work at all in 4.27.1 in
4.27.2 it kind of works but there are still some problems so for now we are
not using them on failure, again we run around panicking
and print an error message and on success
we print a success message and continue from there as next steps we need to remove the main
menu and start the game map in listen mode so we call remove from parent to remove
the menu widget and next we set the input mode to game
only because there will be no more ui and then we disable the mouse cursor
again and now we are opening
the default game level using the node open level by name
the exact level name can be found in the maps subfolder it's called third person example map and we provide this name and we use the option "listen"
to start a listen server this is very important and that's it
we have just implemented a game server using epic online services with
blueprints let's test the server in a standalone
game click the create session button and confirm the login two times have some patience and then our listen server is running
if this fails make sure you have set up your product on the epic games developer
portal in a way that the client policy allows you to create sessions
which is for example client policy type peer to peer we should not click the login button
again while creating the session is still in progress
so in a new development iteration the code should be protected using a gate
blueprint node or something similar but for the sake of simplicity we are
not doing this right now however we will do some refactoring
when implementing the join session button we also need some of the current functionality
for example we need to log in and of course we try to avoid too much
copy and paste we cannot collapse the login code to a
function because a latent blueprint node is used
that's the one with the clock symbol so we are collapsing the code to a macro
there is a special trick to avoid too many output nodes
just create a reroute node to combine outputs
and afterwards collapse to a macro we call the macro
login and we adjust the node a little bit and open the macro we clean up a bit and then we fix the output pins
because the order is bad and
the first output pin should be called on success note that we are not using the first
output pin of login user because we are assuming that the login either fails or
is successful which implies we are hoping that this is
implemented correctly well i will comment on that later naturally we want things to look nice
and in order so we move the nodes a bit this over there and this node up a bit
ok fine next there are these calls to remove the
main menu we also need them when joining a session
and we do not want copy and paste so we collapse these nodes
this time there is no latent node which is why we prefer a function
for this function we use the name clear ui
and again we adjust the nodes a bit and just in case
we check the function but it's fine okay
to sum things up we login to eos
create a session and then we remove the main menu and
open the game map in listen mode with this small refactoring we are now
well prepared to implement the join session button
so let's select the join session button widget
and add the on clicked handler as usual okay now our earlier work pays off and
we can simply use the login macro to login it's right at the bottom okay
on failure we print an error message on success
we are trying to find a session that was created by another player using the
find sessions advanced blueprint node this node also has a lot of parameters
first we pass the owning player of this widget blueprint okay and we intend to simply join the
first session which means we only need a single result
now watch out this is different from steam we need to select dedicated
servers only as server type even though we are not trying to find dedicated
servers this is because the session filters of
eos are not compatible to the filters used with steam okay and since we disabled lobbies when
creating the session we are also not searching for lobbies so we disable this
parameter and on failure again we print an error and success means that we successfully
searched for a session but we might still not have found any
therefore the next thing to do is to check the length of the array returned
by find sessions if the length is greater than 0 we
actually found a session if it is not greater than zero
we print an error message that no session was found if we actually find a session
we join this session using the join session node this is actually a builtin blueprint node
which works without a plugin the owning player should join this
session and now we need to get the first session
result which is the session we found and we
wish to join ah there's no room for this get node
so we move the nodes a little bit there you go now it's fine joining a session can again be
successful or not so we print a message on success and of course we are not forgetting to
also print a message on failure on success
we also call clear ui which is the function we created earlier
to remove the main menu when joining a session we do not need to
open a map, the client will automatically travel to the server map and this means
we are done after clearing the ui okay it's time to sum things up at first we login to eos
then we look for a session using the server type dedicated servers and we do
not search for lobbies we check whether we found a session
and if so we join the session and then we remove the main menu
that's it next we should test creating and joining
a session but that's not so easily done
we need to run two instances of the game with two different epic games accounts
because otherwise joining the map will fail
i'm afraid that you do need to create a second account for this and i'd also
recommend to use a second system for example use a laptop or another pc
if you did not perform a brand review for your product yet you also need to
add the second account to your product development team
otherwise the second account will not be able to log in using the game
go to the epic games developer portal click on organization
and invite the second account to your development team you should at least choose the role epic
account services and either choose all products or this
specific product and invite the member ok
now let's just assume that we have created a second account and started a
session on another pc now we can finally run a standalone game
and join the session i can't wait to see it click on join session and confirm the login again
and again and be patient and that's it session success
we have joined a networked game using epic online services the server is standing over there
he can run and jump and all the replication mechanisms of unreal engine
are now working we are in a multiplayer game
epic online services does not host this server but it did the session handling
for us the server was registered online and it
was found using the find sessions advanced blueprint node
this find session function is part of the matchmaking service of
epic online services ok basically we are done
this is the simple example that i wanted to develop with you to demonstrate using
epic online services with unreal engine blueprints one thing that is still kind of bad in
the current implementation is that you need to manually confirm the login twice
each time you login to epic online services
this is really bad as it will eat up a lot of time during development
and also of course we cannot ship a game like this
epic games is offering a brand review process for you to get rid of these
confirmation screens and also for not requiring all players
to be invited to the development team apart from that there are other options
in general epic online services support a persistent login
where a token from a previous login is still stored and can be reused
one might assume that maybe the online subsystem also supports auth type
persistent a possible process would be to try a
non-interactive persistent login and only switch to account portal login if
this fails the process would look like this
attention this is only a theory i'm not saying that it works
we could use two login user nodes on failure of the persistent login node we run account portal login this would not require a brand review
and could still be used for development but
unfortunately there are two serious problems with this
the first problem is that the auth type persistent
is supported by epic online services but it's not supported by the online
subsystem eos this one could easily be patched in the
engine source code but the second problem is
that the on failure node is not firing correctly
in other words the on failure node is not working at all in the current beta
release of the online subsystem eos this is not a problem of the advanced
sessions plugin, it's a bug in the online subsystem
if login fails epic online services will call the failure handler
but the online subsystem does not forward this to the on failure node
this creates the impression that in its current state the online subsystem eos
was mainly designed for use with the epic games store
the failure node is not easily fixed so using the persistent login sadly is
not an option for now we can undo all this what we can do instead is use other
values for the auth type auth type "exchangecode" is for use with
the epic game store i'm not going to talk about this
auth type "developer" is used with the dev auth tool provided with the eos sdk
this is the recommended way by epic games but i think for indie developers
it is a very bad idea the auth tool is not a service to be
used in production which means we are basically testing our game with a
non-production helper tool this would be fine for automated tests
for which we don't have the infrastructure
but when testing our game it should be as near to the production release as
possible to find bugs early on also the tool is trying to solve a
problem that should not be there in the first place
in my opinion, basically everything is better than this dev auth tool the last option for auth type that is
currently supported is "empty" or platform specific value
empty is for use with eos plus which can basically use a steam login to login to
eos which is a lot more comfortable
the online subsystem eos plus helps us to support cross-play
and allows us to use non epic games login methods
this may be the way to go if you enjoyed this video and would like
to see more, please leave some feedback maybe i will create another video about
using eos plus have a wonderful time