How can I create level instances? One server with multiple levels loaded

Hi Guys,

Seems like UE runs one level at a time. If I want to reproduce games’ architectures like DOTA or LoL, where there is a lobby, and then players can start games running on a server, and they being clients. I assume there is a server that can start instances of a game on demand.

How should I face this on UE4?

Thanks!

I think this is a very complex issue.

There might be a way to fake this by grouping players together, and basically running multiple games on a single map, but only replicating game/player state between players that are in the same ‘group’, but you are still going to be pretty limited to a handful of games, with a few players per ‘server’.

I think the ‘correct’ way, but far more involved, would be to completely replace the networking/replication system on the client, so that rather than connecting to an actual UE4 server, it would connect to some other server software, which you would have to write from scratch (could feasibly implement that in Node.js or Go, or whatever language/library of your choice). That would potentially be much easier to deploy in a large scale on something like Amazon EC2.

Maybe someone else can think of a more elegant/simple solution, but those are the only options that spring to mind for me.

I see. I was thinking this would be the answer. The problem I see with creating a server from scratch is having to work with physics in server and having to deal with it myself.

Thanks for your answer.

I want to say that this type of feature is already in the engine with the master server/browser approach.

How is that? Can you expand?

My idea is that players start a server instance of a map, and all players play in the same server, in different level instances.

This sounds very much like matchmaking. If so, this is a fairly complex topic, but here are a few things to think about:

  • Matchmaking is definitely separate from game state, and you can think of these as two separate problems.
  • You can definitely still use the UE4 built-in replication system along side any matchmaking solution you choose to use (matchmaking is just a way to discover servers that are waiting to be connected to)
  • While the matchmaking infrastructure isn’t built directly into the engine, UE4 offers support that wraps third party solutions into platform agnostic API’s (look at the Online\OnlineSubsystem stuff).

In your example where you’d like players to wait in a lobby, and then play games, etc:

  • Players that want to join lobbies could contact the matchmaking service (either use third party, or roll your own; UE4 does wrap the ability to invoke these calls from platform agnostic API’s though)
  • The matchmaking service would return results back to the player in a form of a list of servers
  • These servers could be instances of the engine waiting for players to connect (singles instances, each with a single running level)
  • The matchmaking service would be responsible for spawning the instances of these servers based on demand.
  • When players join this instance of the engine that is running, it would look like they were in a lobby, this is comletely up to you how you do this in the engine though
  • These players could then start the game, etc, using that server until they were done with it

This is an extremely simplified view of one way this can be done, and if I’ve completely missed the mark on what you were trying to achieve, I apologize!

But I do hope this gives a few ideas on this very complex topic!

Ahh, I misunderstood. I was thinking it was a system where players join a lobby area, see running servers and then join a server. So a multiple servers approach.

welcome to the UE4 Forums John!

Nice to see you again!

Thanks for the detailed explanation!

#:heart:

Rama

Right. That is the first conclusion based on what I’ve learned using UDK. I could make a lobby and handle spawning server instances on demand, one instance per “group of players”. In this kind of games, that group of players is 5-10 people.

As far as I’ve researched in old UDK forum regarding performance, it would mean a lot of PC resources for only 5-10 players, and would be really expensive architecture for a large playerbase.

That’s why I thought about “level instance” approach, where the main Engine modules would be shared among levels (core, physics, etc).

Any ideas?

Sorry for bringing this up so late, but I am trying to create a mini mmo server, one that will only replicate players currently in your ‘room’. Rooms would be generally small so it would be pretty efficient. The idea behind this is that players can switch rooms, which would despawn the old room and spawn a new local copy of the room they are connecting to, then they would start getting information about the players in that room. Currently I am using the websocket protocol to transfer data serialized in JSON from the clients to a multi-threaded server written from scratch in php. This generally works, but my issue is how do I handle replication, I only need general replication with top down movement, but how can I achieve this? I’ve been trying to use grid based maps with the same A* path-finding algorithm on both the server and the client, this way the server can send correction packets to clients based on where the server thinks the given player should be. Is there an easier way to do this?