I built the project from source (v4.22) and I got the advanced sessions plugin from here
Now, I am creating a session with one client, and joining it with the other. My intention is that the session is a dedicated server, so that the clients are treated symmetrically. That is, I want there to be three instances, one for the server and two for the clients, neither of whom have authority over actors owned by the server.
However, I’m finding that it works as I would expect a listen server to work: i.e. Client 1 has authority, and anything done on that side is also done on server side (but not for Client 2). For example, with this code:
when I press “V” on client 1 I get “Server: Valid” and on client 2 I get “Client 2: Missing”. (I expect to see “Missing” on both clients.)
The way I create a session with the following (two images):
And I join a session with the following:
Could anyone tell me what I’m doing wrong? How do I create a session in a new map, that can be joined by another player, and that acts as a dedicated server (neither the creator nor the joiner are server side)?
You saying something confusing, you should only have one session for server which clients can join in to and that session should be created by dedicated server
I not sure baout advance sessions but Session system is complitly separate server-client model of the engine, it is OnlineSubsystem feature. There goal is to register the server in to online service you using, but you don’t need online service to run a server as UE4 use normal IP connection (same as Minecraft for example) and online services are only to automatize this process (thats why you never put any IP addresses in game that use them).
If you want to run dedicates server your game need to run in that mode first and im not mistaken sessions should be created by server if it is a server. You can read about it here:
Generally your game should at minimum handle non-session connections, if sessions confuse you, you could just focus on normal connection explained in link above and then put sessions on top of it.
Sorry, when I said “I want there to be three sessions” I misspoke. I meant three “instances” (I edited this).
I think I am out of my depth here. What I’m trying to do is allow a player to “create a game”, and another to search for it and join it, as in the mutiplayer shootout example. However, unlike in the multiplayer shootout example (which uses a listen server, where the game creator is on server side and has authority), I want that game to act like a dedicated server, where both the creator and joiner are clients with separate instances from the server, and are handled the same (have the same authority, etc). I guess this question is an A/B problem, and I have a feeling that answering my real question takes a lot more time. But I can’t find a source that explains this clearly (or I can, but I just don’t understand it).
Ah ok. You would need to start dedicated server on client machine with client turned on too and make client join that machine… But it’s meaningless to start dedicated server on client machine, because you would run 2 instances of the game on single machine which is more resource intensive and 2nd on security aspect, dedicated server will still run on the client where he can alter data on it, so even if you can’t access those object on the client good enough hacker will deal with server that runs on there machine
If you want a typical multiplayer setup:
- Run one machine as either a dedicated server or a listen server via the Create Session blueprint node. I don’t know whether putting the -listen switch in the Create Session blueprint node makes the difference for that or not.
- Run up to 15 other machines and have them join the session that was created by first using the Find Sessions node, then picking one from the array of those sessions found, and using that on Join Session node.
- Now the clients are connected to the server.
How the Find Sessions node works depends on which Online Subsystem you’re using. I think it uses Steam by default. You can reconfigure the ini file to use NULL online subsystem instead of you want to just connect to static IP address, use LAN, etc. Or you can program your own Online Subsystem in C++.
If you’re trying to do something other than the typical flow in the 3 steps above, then I think we need a little more explanation to be able to help you.