Setting up a client server interaction

Hi guys,

I have a very simple first person shooter game atm that I would like to network. I have run the game in the editor with more than one players and I have checked that all my replication works fine, which is great. However I would like to further this, and create client server interaction for my application.

I’m not planning on having a dedicated server of any sort, just a running version of the application that will serve as a host, or server. I’ve been reading through some of the session documentation, as well the shootergame example. I’ve got a few questions however that have stumped my progress, and my lack of answer to them has me afraid to try and integrate the session stuff for fear of getting things completely wrong and not able then to find my potential mistakes.

  • Would creating a session be as simple as as defining a AGameSession object, and calling mySession::CreateSession()?
  • The documentation online says that this function requires a set of parameters to help set the session up, however I’ve not been able to find out what these parameters actually are, or how I’d actually go about finding them.
  • My plan is to have an application that searches for a session with certain predefined parameters to join, which if it doesnt find it would then create. Would this be an all right approach? Again I’m not completely sure it would, as I’m not certain what the parameters are, or if they are the exact same for the CreateSession, FindSession(), and JoinSession() functions.

Thanks in advance guys! And I do apologise if questions similar to these have been answered, or if there is a simple solution I should have looked at or have missed somewhere. It would be great if I could be pointed to these if there are any.

Edit: I’m also very unsure as to what joining the session would actually do in relation to networking. Would I be able to run 2 exes of my application, for example, and assuming I’ve done everything correctly have two characters on each screen moving around firing at each other? Or would there be additional work on top of that I’d have to do? Unfortunately the extent of my network programming experience has been using SFML’s networking library with UDP packets.

Edit2: The more I look at the shooter example the more I am overwhelmed with the mountain of information there. I’m just not even sure where to start. At the moment I think it should be easy as creating, finding and joining a session, but I’m worried there are entire levels of complexity here that I’ve just completely missed.

Edit3: Finally, some code to ask questions about!

I’ve set up a custom game session class,akin to the ShooterGameSession class in the shooter example. All I’ve got at the moment is a host session function that looks like this:

bool AFPSGameSession::HostSession()
{
CurrentSessionParams.SessionName = “DinoMode”;
CurrentSessionParams.bIsLAN = false;
CurrentSessionParams.bIsPresence = false;
CurrentSessionParams.UserId = 0;
int MaxPlayers = 2;

return Session->CreateSession(*CurrentSessionParams.UserId, CurrentSessionParams.SessionName, *FPSSessionSettings);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Session Hosted"));

}

FPSSessionSettings is an FOnlineSessionSettings TSharedPtr. I dont really do anything with it other than declare it in my header file. Also the above function I am calling in my AFPSGameSession constructor. Is that maybe the cause of my problem? And where is it I could call the SessionSettings constructor?

Edit 4: I think the FOnlineSessionSetttings pointer is the cause of problems here, hovering over it when the program crashes gives me NULLs and “memory could not be found” all over the place. Any idea how to fix that? I’ve looked at how theshooter game example initialises it’s version, “hostsettings”, but it’s all going way over my head.

Edit 5: Have I formatted the question wrong, or am I asking too much? Would like to know why I haven’t got an answer yet

The lack of documentation on online subsystems is shocking really ive been trying to get this done for about two to three weeks and by following the FPS example i think i may have got it, but have so many issues and obstacles i cant test it

Documentation is still being developed, UE4 is huge so it takes time to fully document it

Is documentation on the online subsystems planned yet? if so is there a rough date that it will be available?