Download

[Network] Session and Dedicated Server

Hello everyone,

i’m stuck with the session system, i’m using a join in progress architecture.

I’m using a dedicated server, i would start at runtime and at anytime a session or a listener for a map, imagine the world of warcraft dungeon system, i would be able to make a similar system.

here is a visual as what i would make:

I’m not asking you to make it for me, but a way to start :).

Any help would be appreciated,

Best regards.

Update thread, it is easier to understand like this.

your approach is good, but a bit oldschool with new technologies.
Now servers got high memory, CPU, network … I recommend you to design :

  • 1 login server
  • n Proxy servers
  • n world/instance server

PS : Never forget the rule #1 : never trust datum from clients. Everything must work on server except graphics effects (that no means you need an answer from server to make your graphic effect on client)

Good rule. The bracket part is about faking and hiding the network lag of replicated information.

For the Session Part:

I saw this question a couple of times now and also already talked with some others about it.
As far as i understood, the normal Session of UE4 can’t do this. They are stuck to 1 Session with 1 Map
at a Time. So not even your Clients can load another Map then the Server while being in its Session.

So i guess you will need to handle this in a new Server System, out side of the UE4 Session System.

Correct me if i’m wrong.

I heard Raknet is a good way to start this, since it is free and you get some kind of Instance System with it.

Hey thanks for your reply !

Actually i’ve a database server which execute only the query, like auth you, update your data etc, the current data are sended only from the authority server, i never take the client data, and the packet are encrypted between database and server.

If i understand what you sayed, i must run muli dedicated ?

Player is on world map and want to go on private map -> open newIP:7777
Player is on his own map and want to go on world map -> open dedicatedIP:7777

Actually i’m looking on the GameInstance class to understand how the server is starting his thread but there is no many fonction etc

Edit:

Just see your reply eXi, i’ll check Raknet, but is this system can be use only for the instancing or for the general networking ? as movement etc, because i like the replication system, and i already made a lot of function with it.

Haven’t used it yet, but a friend of mine used this with UE4 for handling the Sessions. You can still use the UE4 Replication System in each instance.
Best thing is to google Raknet and look at it yourself.

Ok ok, thank’s for the reply, i’ll try ! :slight_smile:

Edit:

**** solved, release… always release…

So i finally added the RakNet to the unreal engine, my server start and the client connection is accepted etc by the RakServer, but i don’t really understand what do i should do now,

I mean how is it supposed to interact with the unreal engine network system, because the IOnlinesubSystem is a specific part of UE, do you think i’ve to add the system to the RakNet or something like that ?

I’m sorry i try to find something on google but there is nothing about Unreal and RakNet, and there is nothing about instanciating area or anything else.

Ehm, i haven’t used it yet, but Raknet should have its own Session System.

If you look into the Manuel of Raknet: Jenkins Software

You will find basics and how they work. For example a plugin to use Steam with it: Lobby2Client_Steam

Or a lobby system without Steam or any other subsystem: LobbyServer and LobbyClient manual

And many other things. But from my side, it is up to you to implement that. I have never done that. :X

Yea i’ve read the manual, but assuming that i’m using an external server from UE, RakNet or anything else, i’ve some difficulties to understand how it is supposed to work, because UE have it’s own packet system.

My client is on the menu, it want to go on his on instance of MAP A, it asking to the out server to create one, but there is where i’m not understanding,

As the external server is not a UE class or anything, how say to the dedicated there is a free room created and it is for Player X, and then open the map and spawn my player which need the replication to be spawned.

I’m sorry, i’m completly lost, because as UE have it IOnlinesubSystem, the room on the external server is different than a “UE Session”.

An other way is to send packet like that:

client(s) -> room -> dedicated -> room -> client(s)

But again Replication system will not work as the dedicated server has no “instance” of GameSession, so client won’t spawn and dedicated won’t know there is a room created.

I guess you will use the MasterServer of Raknet just to keep a list of your Servers. You will want to have a normal UE4 Dedicated Server, but let him register at the MasterServer.
And the Raknet Server should have the ability to launch new Dedicated Servers and provide the client with the necessary IP to travel to him.

Yea that’s a good idea, i didn’t see thing like that !

Juste one thing, is that not to much ? Memory etc,

Let’s say 20 players, 10 on open world (Main dedicated)

10 on separated room

10x dedicated start + main dedicated. that for only 20 players, my dedicated is around 1gb on my own computer.

Edit:

I’m asking as the project is MMORPG based.

Edit edit:

Maybe there is a way to make an new thread, as my database server do.

client -> room -> dedicated new instance of (gameinstance maybe) -> new port -> return the port to connect on

There certainly is. The methods are endless, but that’s the point where i can’t really help you anymore ):

Yea you allready help me alot thank you, by the way i’ll look how the gameinstance is created etc, and try to make that way, if anyone have some information about it i take it with pleasure :).

I hope i’ll be able to make a working session system.

Thanks a lot again eXi :).

I’m have the same problem as you. The problem is which part of UE should be replace by RakNet?

The session, because of authority client, and because as eXi sayed, you can have only 1 session per map.

There is two kind of design.And my English is not good so please let me write a few words to explain my question
81a02faf12577ff0d486026bd4d9e041d700b562.png
This is the first. RakNet server as the control server,which just control starting, stopping delicate servers and so on.But clients are just directly communicated with delicate server.The RakNet server don’t translate messages.
I think this is easier which can be design by make a new Online Subsystem.
04c5eed5ffdf4308342d5c54137b6052d988b434.png
Then This is the second.If the map is really big and actors(pawns) are too many for one delicated server to hold.Then we need multi-servers to simulated one map.So the RakNet server needs to translate packages to right server,so this needs to be design a custom online system.
I think there are two ways to do this.The first is making client connect to more than one server.Make many UWorlds, each world connect to one server and copy actors to the game world.Second is using RakNet Server to decide and send packages.I have no ideas about the second solution.:frowning:

Then as you say, RakNet can be UE’s session system,is it just about the first case,or it can replace the whole Actor replication system?

Yea it seem good, but again for small population it is ok, but for a big amount of player the server will never support a big amount of dedicated, or you need a fu****ing server.

After what i think replace the replication system is not a good idea, if you change the replication system there is no more interest to use a dedicated server which is use for the replication system,
at the moment i’m trying something like this:

http://puu.sh/jBjz3/cba316a461.png

A very simple system to start, i’m pretty sure use an external server is not forced.
Because :


/**
 * GameInstance: high-level manager object for an instance of the running game.
 * Spawned at game creation and not destroyed until game instance is shut down.
 * Running as a standalone game, there will be one of these.
 * Running in PIE (play-in-editor) will generate one of these per PIE instance.
 */

i’m actually stuck is how to specify we need to start a new Instance of the game as a listener and not a game, i added some function to the UGameInstance to be able to specify the map i want to, choosen by a switch (myEnumMap)

And how to know which do we just created and to open it.

Maybe i’m completly wrong

If you just want to make a system like the dungeon in WOW,which is just a new server with some players who ask to join in.Can you just do as this:
Simply image there is a client need to open a dungeon.

  1. Client send message to Rak Net Server that he is trying to open a dungeon
  2. Rak Net Server start a new delicate server by cmd command. such as “start YourGameServer.exe YourDungeonMap -log”
  3. Rak Net Server send the port number of new delicate server to client
  4. Client connects to the delicate server and travel to this map by “open Your.Server.'s.IP:PortNumber”,for example, “open 127.0.0.1:7779”
  5. Then the client successfully join into the dungeon.
    I think it’s an easy way.

Yes for sure it is the easier way, but i don’t want to start dedicated each time, because it’s not a wow like system i want to do,

My player will have to go on map where it is the only one who can go on, like swotor, for the story line.
My player(s) will have to open Dungeon as wow do.
My player(s) will have to open map where anyone can join.

That’s why start dedicated will not slove my problem, because of memory, my player will always change map etc so open close open close open close Dedicated is a good but not optimized way i supposed.

That’s why open new game instance seem to be a good way to start with, as the GameInstance is the “current instance of running game”, it must able us to start “Session - Instance” of a new map at anytime

Edit:

That’s what we need right ?