Hi, So I have made a server map for my dedicated server and when I use4 open level to open the dedicated server in local host, it is taking to the server map. But in the map, none of the game mode functionalities are happening. It looks like a map only without any functionality where the spawned character can roam around.
The logs from the server shoews something like ‘LogNet: ReplicationDriverClass is null! Not using ReplicationDriver.’
I would first check and make sure the game mode you’re trying to use is selected when you have the level open in the details panel… Secondly make sure that the correct default server map is selected in project settings.
If it is a driver issue and you’ve built a dedicated server it may be an .ini configuration issue and need to specify the correct net driver in there. Especially from what you have configured in the source in Visual Studio. You can have conflicting .ini configurations and have problems for sure.
Im not sure how you are connecting to the server map so that’s a little suspect here also. You shouldn’t be able to travel to the server map unless something else is going on when travelling and or connecting to the map.
Hey, thanks for the response. This is how I open the level from my game. I have a home widget which has the button host and when I click Host, I have a function that opens level (127.0.0.1). Then in the dedicated server logs, I can see my system getting connected and, in the editor, I reach the map I want. But It’s just the map and the game mode is not working. None of the functionalities are working and postlogin function is there in the gamemode to do the rest of functionality based on players joining. Any help or guidance on how to tackle the issue will be really helpful.
Well, I couldn’t say without seeing the logic in the game mode after OnPostLogin. If you are joining the server map through your local IP such as 127.0.0.1 as a client, you wouldn’t have any hosting capabilities or access to the game mode to execute anything as the server map has a game session already created in itself and it’s running entirely on its own… on a dedicated server at least. Is this a source build?
If you have a pawn that you know works and want to use, make sure you are setting that pawn as the default pawn and it has all the correct settings in the level and in the game mode.
If you are using bare bones stuff you really don’t need OnPostLogin at a very basic level to test it. As long as you are using the correct player pawn, player controller, player state, game state and game mode and its all set correctly on the game mode and in the level’s details panels it should spawn you in at one of the player starts…
If you want to post a pic of that logic I can try to help with that.
P.s. You’ll need to make sure you have at least one player start in the level of you aren’t using custom transforms and spawning the character manually…
Hey, Thanks again for the super quick response. The server map has a lobby where Players are supposed to wait until a fixed number of players are joined. Once a fixed number of players are joined, I have a servertravel function that takes them to the game map. However, right now, the postlogin function in the lobby map is not working and players joining are stuck in the map. My DefaultEngine.ini file and gamemode files are attached for your reference. any help will be highly appreciated
If you are getting DesiredNumPublicConnections from the game instance that could be why they are hanging up in the lobby map… You’ll need to get that information from the game mode or game state else it won’t be able to see the value. My C++ is lackluster, so forgive me there.
Hey mahn, Thanks a lot for the help. I will try adding those additional lines to the .ini config and see if there is any change. About the string “playerLogin Working”, it’s not firing in the server log.
You’re welcome. Trying to help anyway I can. I’d imagine that there aren’t any controllers coming through if its printing off the PostLogin… If you can print it from the begin play to see if it’s actually initializing the correct game mode that would rule that out. Good luck! @Arjun_NoobGamer
Hi, I added those lines to Engine.ini and tried adding the string print function in beginplay. Both didn’t work. Is their anything else I can test to find the cause of the issue?
If it didn’t print on begin play in the server log then there’s a good chance you don’t have the correct game mode selected on the lobby map. It should at least call your print string logic if it was initialized…
As far as the any of the logic in C++ I couldn’t tell ya perfectly if you have any errors in your code unfortunately. I’m pretty comfortable with making it all work in the blueprints and finding problems there.
Despite trying different things, I’m still unable to find a breakthrough. This log from server is raising suspiscions on me. ‘LogNet: ReplicationDriverClass is null! Not using ReplicationDriver. Do you have any idea why this error message is occuring?
I tried printing logs for testing from the level blueprint and now its printing and doing stuff that I mention in the level blueprint. So when I open level at Dedicated Server, I am receiving log from client 0 saying the sample text.
This is tricky and odd. Perhaps you can check your default server map and transition map inside your project settings. It might be conflicting with your travelling…? When you look at your server log is it bringing up/ tearing down the appropriate levels?
Hey, I need your help on passing values to the gamemode on dedicated server. If one player is hosting a game session, I want him to define the number of players to be wanted in the game and based on the number, the postlogin function will count the number of players in lobby. However, I am not sure how to pass the MaxNumPlayers value from Menu to the gamemode of lobby map which is the default server map. When I tried open level and game instance casting, I am unable to get the maxNumPlayer value in lobby map although I am passing as options? So what is the bst way to do this?
You can set an integer variable in your game mode like “MaxNumberOfConnectedPlayers” and when post login is called increment that integer upwards and set it.
Right before incrementing the variable do a branch and check if Max Number Of Connected Players is >= to your number. Off false run your logic and increment the integer, if true just create a function in your player controller to “Open Level” you want them to return to and call it from that game mode. Create a server function in the game mode that casts to that player controller.
You can cast from that game mode to that player controller by passing the player controller reference from player controller object reference off the On Post Login function into the cast of the game mode server function. If that makes sense.
Be sure that you use the log out function in the game mode to decrement the Max Number Of Connected Players when a player leaves to make room for other players.
P.s. I don’t think you’ll be able to get a game instance variable from the server in the game mode unfortunately.
"Right before incrementing the variable do a branch and check if Max Number Of Connected Players is >= to your number. " Thant’s where I am confused. I want to know how can I pass this value from the client’s menu to the server gamemode. I am really frustrated at this point and any idea will be really helpful bro.
You can pass in optional arguments when opening a level, including number of players you want to be able to join This data will be avaliable in an “Options string” in the GameMode, where you must parse the string back to your variable.
Although you are using raw c++ I will foolishly assume it works just about exactly the same.
In this example you can substitute “Event Handle Starting New Player” with your “EventPostLogin”. Event Handle Starting New Player is a better option for using seamless travel if in fact you wish to move around to different levels within the same game session on the server…
Off the true you will want to kick the player assuming you have too many clients. Off the false you will execute anything related to spawning. Once the player is kicked you would handle the player leaving from the “EventOnLogout” and decrement that variable there in the much the same way as when they entered. If you can write this in c++ its relatively simple.
If you are operating a true stand-alone dedicated server, the server map would already be open and running at the specified IP address of the machine its running on and will have a default game mode and session created at which point everything would be deterministic at that point from the game mode. There wouldn’t be a need to pass a “Number Of Players” variable because the game mode would already have that information for you and wouldn’t allow the client to change it directly anyway since its already running and existing only on the server itself.
If you required multiple differences in server maps that alternated and travelled between specific levels and game modes you would need to create another server map and packaged it accordingly with the correct connecting IP address on open level with a game mode that handled that game’s rules specifically. If you travelled with server travel to another level at that point you can switch game modes and have a different set of rules once you arrived via server travel.
For example:
Client wants to play a 6 v 6 team death match game on a dedicated server.
They select a 6 v 6 team death match map link/button inside perhaps the main menu level of the game that is not on the server. The button executes the “Open Level” at which point the IP address and port to that game will be specified on the Open Level and the player connects to the server and the server knows through the logic you created whether to allow the player in.
They arrive to find there is available space. The game plays out how you set the rules. Or there is no available slots and the player is graciously returned the main menu outside of the server on their local machine.
Player returns the main menu after leaving or being kicked out of the game and decides to play a 8 v 8 death match game at which point selects a different button for 8 v 8 deathmatch that opens level at a perhaps the same IP address, but an alternate port assuming yet another instance of the game is running on the same machine.
In what I’m describing here is essentially a game that operates in pieces of separately running “servers” on a particular machine or server. So your main menu or level menu is essentially a portal to other games outside of the main menu existing in another place in the actual world and you are merely connecting to existing games with predetermined player counts and rules.
If you are creating a session for LAN then this doesn’t really apply in the same way since you have a valid player controller and the client acts as the server, they can determine the number of players while creating a session and alternate to whatever game mode/level they wish with however many players by creating said session.
I apologize if this isn’t what you had in mind and there are far better experts out here that have much better knowledge on this subject, but as far as I’m aware when operating dedicated servers they are their own mind and once they are running separately from the local players machine or even on their machine they can only be connected to and manipulated through its own set of rules and only from within the game mode or through the game mode via the game state. So essentially “creating” a dedicated server game session would be equivalent to literally executing a binary from your file explorer on windows and opening a server application running in the background of your pc or server.
I have grappled with this situation for a while and there isn’t a lot of info regarding this on actual stand-alone dedicated servers and connecting to multiple different game types, but I have managed to make all this work like I have stated… Fortnite is apparently run in this same manner. Essentially a number of instances of stand-alone servers running on one machine or multiple machines on Amazon’s elastic IP instances being connected externally through a matchmaking system on a separate server that opens the IP to these external “games” that exist outside of the local players game.