alvyxaz / barebones-masterserver

Master Server framework for Unity
476 stars 106 forks source link

v1.03 GameServer keeps failing #55

Closed DeadlyCobraXXX closed 7 years ago

DeadlyCobraXXX commented 7 years ago

Hello! Currently using v 1.03 until 2.0 is fully documented. I am having difficulty launching the actual game server (my own, not Unet) from the lobby after hitting start. The lobby is 100% through the MasterServer and works perfectly. However, when everyone is ready and we click play, the server attempts to launch the game and the server and gives an error. Failed to start game server. Once the error is closed on the serverside, the lobby resumes with the 2nd error picture below. See both pictures below of the errors. I also have all of the latest updates on the server as stated in the error, btw. When ran in debug mode, it shows a new process of MasterServer.exe running and trying to launch "Game Room" scene, which then displays the error in the first picture above. However, I changed all the settings in the overrides to load COTR.exe at the COTR game scene.

I currently am using two scenes within the same project for the MasterServer. (2nd is Game Scene) The first scene, which is the default MasterServer scene with all the connection profiles. See picture link.

SpawnersModule Settings:

GamesModule Settings:

SpawnerServer Settings: Both Command lines within those settings read: C:\Users\Administrator\Desktop\COTR.exe.lnk <- Had to use a shortcut to use command lines. -bmStartSpawned -bmScene COTR -nographics -batchmode COTR.exe is identical to the client version. COTR is the game scene. (I also have the same identical scene within the MasterServer.)

Command line of MasterServer reads: C:\Users\Administrator\Desktop\MasterServer\MasterServer.exe -bmMaster -bmSpawner -bmIp 68.1.75.164:5000 -nographics -batchmode

Client Lobby Scene Contains:

All ports are open on the router. Windows Firewall is off. p.s. Sorry for the book. Just wanted to have all the information here on the first post. I've been trying for days. I really hate to bug you.

DeadlyCobraXXX commented 7 years ago

I found that if logging into the server with a display attached, it loads the server, runs it on the server display, but no users are able to load the scene on the client. Also, this means I currently have to have a display plugged in and on in order for the Server to launch with the above settings. Is there a script that I'm missing to make the exe run in batch mode all the time? The lnk shortcut lines are not being applied, even with the above settings.

alvyxaz commented 7 years ago

Hey! Sorry for replying so late, and thanks for providing so much info!

I'm driving home now, and will reply in a couple of hours.

On Mar 19, 2017 3:56 AM, "DeadlyCobraXXX" notifications@github.com wrote:

I found that if logging into the server with a display attached, it loads the server, runs it on the server display, but no users are able to load the scene on the client. Also, this means I currently have to have a display plugged in and on in order for the Server to launch with the above settings. Is there a script that I'm missing to make the exe run in batch mode all the time? The lnk shortcut lines are not being applied, even with the above settings.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/alvyxaz/barebones-masterserver/issues/55#issuecomment-287588433, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFAUwEaoYyZsh7kuyUKIFNCMpZwNz41ks5rnItlgaJpZM4MhSwb .

DeadlyCobraXXX commented 7 years ago

I think part of the problem is linked to the lobbyfactories. At least the scene map was. I missed that when creating a factory, but that's updated now. However, the rest remains.

DeadlyCobraXXX commented 7 years ago

Also found another problem. When creating multiple "game servers", only one is actually created. The rest are started AFTER the initial game server process closes.

alvyxaz commented 7 years ago

When starting the spawner, add a "-bmBatchmode" argument so that spawned servers are actually started in batchmode. I've added this argument in case someone wanted to run spawner in batchmode, but not the game servers (for debugging and etc.)

If it still doesn't work, the problem is probably a missing -nographics arg when spawning a server. I thought that when you're running in batchmode, it's automatically running with "nographics". Since I'm mainly working with Linux headless build, which is by default "without graphics", I've never stumbled upon this :/.

Open the SpawnerServer.cs , add "-nographics" at line ~410, and let me know if this fixes the problem with DirectX initialization. If this works, I'll add the fix to the release.

image


Regarding the "only one game instance being spawned" - I'll try to reproduce this and get back to you

alvyxaz commented 7 years ago

I've tried to replicate the issue, where only a single game server instance was spawned at a time, but without any luck - I can run multiple game servers from both lobby, and by "creating a game severs".

Just to be clear, you meant that you need to wait one game server to close, otherwise another won't spawn? Or did you mean that just after one server stars, another can "start starting", in which case you can have multiple game servers running, but they can't spawn concurrently?

DeadlyCobraXXX commented 7 years ago

Thank you for the reply! I'll test it out and let you know how it works.

DeadlyCobraXXX commented 7 years ago

Ok, your solution above works, but I have to have both changes in effect. -bmBatchmode in the command line, and -nographics in the script. However, once the gameserver is spawned, the lobby (client) does not load into the scene still. I'll have to do some more investigating as to why.

As far as the 2nd server not spawning... It'll basically queue up another server to start, but won't actually start until the 1st server is closed. "Max Spawned Process" ServerSpawner count has no effect on this at all.

DeadlyCobraXXX commented 7 years ago

A couple things. I've duplicated my projects (MasterServer and ClientGame) to start the process merge from v1.03 to MSF v2.0. To differentiate what's going on with the two versions within my game, please see below.

ISSUE 1: v1.03, game server tries to spawn the incorrect .exe that's listed in SpawnServer Module under SpawnerServer script. Doesn't matter what you put in these fields, it always spawns from the original MasterServer.exe instead of the GameServer.exe or whatever you put in there. v2.0 Fixes this issue, and allows you to place any Exe path, and it will run with the correct settings.

ISSUE 2: v1.03, upon hitting play from the lobby, the game server (which would be a repeat of the MasterServer.exe in this version due to Issue 1) launches successfully, but does not move the lobby members to the assumed loaded server scene. (Which is set to be an exact duplicate of the client version). v2.0 Hitting play launches the correct GameServer.exe from the selected path, however, it closes itself semi-immediately and then returns the play buttons within the lobby back to defaults. Then it displays a failure to launch a game server.

ISSUE 3: v1.03, upon entering and submitting text in the lobby chat, it is successfully posted, and everyone can see it. However, a Error: Timeout will appear approximately 20-30 seconds post the message being sent. v2.0 Fixes this issue, as I've not noticed any errors being displayed other than failed server launches.

ISSUE 4: v2.0 only: When launching a MasterServer with command line "C:\Users\Administrator\Desktop\MasterServer2.0.exe -msfIp 68.1.75.164:5000 -msfStartMaster -msfStartSpawner -batchmode -nographics" The spawner will not activate properly without using another script similar to DemoMasterSpawnerScene.cs which was used in the DemoScene you've provided. All buttons need to be mapped. With all these mapped and enabled, everything starts automatically and correctly with the above command line.

Notes: I've been doing a lot of testing and messing around to get everything working on my end, and I can't seem to get a game server started properly. I'm probably missing something silly, but I'll continue to post bugs/my mistakes/errors as I find them. I love the new improvements found in v2.0, however, at this time using 1.03 would be a lot easier for me as the whole switch over process seems like it'll take a while including rewriting several of my own scripts due to them using functions, values/variables from v1.03, but I'm all for doing the full sweep and move to v2.0 soon. I'm really thankful that you've taken the time to help out your customers. It says a lot!

alvyxaz commented 7 years ago

Thanks a lot for reporting these issues! I'll go though all of them (both in this post and the other), fix them, and release an update.

By the way, I have a suggestion regarding the batchmode and nographics arguments:

Do you think it would be better if by default, spawned games copied -batchmode and -nographics from the spawner (they would be started using these args if spawner was started with them). And for the cases where user doesn't want spawned game servers to be in batchmode, he would have to provide an argument "-dontSpawnInBatchmode" or something similar

alvyxaz commented 7 years ago

ISSUE 1:

When running the spawner server, it always overwrote the path with a value, provided through command line arguments, and when there was no command line value provided - it automatically used a default value of the argument. I became aware of that when working on V2, but it didn't cross my mind to fix it on V1.03.

So you can provide a path via argument, like -bmExe D:/sfsfs/ssfs.exe, and it should use that value.

Or a more proper fix would be to change the ExtractCmdArgs() method, like this:

SpawnerServer.cs, line ~309.

image

Same thing applies to all of the arguments in that method

alvyxaz commented 7 years ago

ISSUE 3:

Apparently, in V1.03 lobby chat, I made it send a message and wait for a response. However, API was designed to not give any response. The easiest fix would probably be to send a response from server, if user expects to get it:

GameLobby.cs, HandleChatMessage() Line ~ 850

image

alvyxaz commented 7 years ago

ISSUE 4:

Spawner server relies on connection to master server. It will start only when the connection to master server is established.

SpawnerBehaviour itself has no means to connect to master, it only waits for the connection. To connect to master, you can drag in a Barebones/Msf/Prefabs/ConnectionToMaster prefab to the scene, and it should fix the issue.

I'll include this notification to documentation ASAP, as I agree that it's not very obvious. I'll also add a hint about this at the SpawnerBehaviour component.

P.S. I'm really sorry for all the issues you're experiencing, and thank you again for reporting them

alvyxaz commented 7 years ago

Regarding ISSUE 2.

Do you think you could zip your project, and send it over to alvyxaz@gmail.com? It's probably has something to do with the setup. I'll try to find what's wrong, fix it, and probably add a notification to docs, or find a way to avoid this in future versions of the framework

DeadlyCobraXXX commented 7 years ago

Thanks a lot for reporting these issues! I'll go though all of them (both in this post and the other), fix them, and release an update.

By the way, I have a suggestion regarding the batchmode and nographics arguments:

Do you think it would be better if by default, spawned games copied -batchmode and -nographics from the spawner (they would be started using these args if spawner was started with them). And for the cases where user doesn't want spawned game servers to be in batchmode, he would have to provide an argument "-dontSpawnInBatchmode" or something similar

Yes! I think most devs would appreciate this, as I can't think of a time where we would want a dedicated server to run outside of batchmode, but for those who do, they'll have that command arg.

DeadlyCobraXXX commented 7 years ago

I think today, I'll focus on completing my merge to v2.0 because that's going to be the new baseline, but also because of the new features. It also fixes some issues out of the box, like the chat (issue 3) and spawner exe path (issue 1). All in all, I think you're doing an excellent job, and I'm very happy I went with MSF. Thanks again! I'll post further updates as I move along this process.

As far as fixing Issue 2, I'll have to do a major clean-up of my project before .zipping due to it being in pieces with the recent changes between v1.03 and v2.0, as well as some other coding/assets I've used previously for networking. It might be a little while, but I appreciate the thought to help try to solve my case!

DeadlyCobraXXX commented 7 years ago

Update: My merge to v2.0 is done. I have just two scripts to rewrite for the new api. A Profile variables/properties script and a custom lobby "Update CrownMaster" script which applies a crown graphic to the Lobby Master.

I've also cleaned up a lot of my project, so it shall be ready for a .zip in another day on my day off from work.

May I please request the "Profiles" section in your documentation be completed soon, as that would save me time and help relearn v2.0's new api/commands regarding the profiles.

Thanks in advance!!!

alvyxaz commented 7 years ago

Hey!

Sure, I can cover profiles today ;).

I'll get back to you with other issues in a few hours

On Mar 21, 2017 6:55 AM, "DeadlyCobraXXX" notifications@github.com wrote:

Update: My merge to v2.0 is done. I have just two scripts to rewrite for the new api. A Profile variables/properties script and a custom lobby "Update CrownMaster" script which applies a crown graphic to the Lobby Master.

I've also cleaned up a lot of my project, so it shall be ready for a .zip in another day on my day off from work.

May I please request the "Profiles" section in your documentation be completed soon, as that would save me time and help relearn v2.0's new api/commands regarding the profiles.

Thanks in advance!!!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alvyxaz/barebones-masterserver/issues/55#issuecomment-287976883, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFAUyQUqUk4m5lkxfH4BPIVBHR6SKgtks5rn1gsgaJpZM4MhSwb .

alvyxaz commented 7 years ago

I rewrote the profiles page for V2.0: https://github.com/alvyxaz/barebones-masterserver/wiki/Profiles-Module

By the way, I remember seeing your post that you had difficulties trying to get username of the player. Since the post is gone, I guess you found it? I would like to improve that, so other developers don't need to spend hours looking for it. I was wondering if you have any suggestions on how to make it better? Were you struggling to get a username on master server, client or game server?

RowellKataan commented 7 years ago

Couldn't you easily find the player's name using the Msf.Client.Auth.AccountInfo.Username inside your game?

DeadlyCobraXXX commented 7 years ago

By the way, I remember seeing your post that you had difficulties trying to get username of the player. Since the post is gone, I guess you found it? I would like to improve that, so other developers don't need to spend hours looking for it. I was wondering if you have any suggestions on how to make it better? Were you struggling to get a username on master server, client or game server?

I did find it :), but it took a while because I tried all the obvious ones I could think of including Msf.Client.Auth.AccountInfo.Username, but I must have had typed something wrong because after retrying it later on, it worked. I also found that you had posted that information in your documentation, but it wasn't until after I got it working before I found it lol.

I don't think any improvement is necessary there, I just think I did something wrong initially which is what led me to having to search broader. But it was on the client version, the easiest one to retrieve lol.

Also, thanks so much for doing the Profiles-Module documentation! I just got home from work, and I'm tired, so I'll mess with that tomorrow.

DeadlyCobraXXX commented 7 years ago

@alvyxaz Hey bro, I didn't forget about this post. I've just been busy with work. I'll .zip a copy to you real soon to help with this issue I'm having. Probably Monday-ish.

alvyxaz commented 7 years ago

Sure, no need to rush - i'm not going anywhere ;)

On Mar 26, 2017 1:26 AM, "DeadlyCobraXXX" notifications@github.com wrote:

@alvyxaz https://github.com/alvyxaz Hey bro, I didn't forget about this post. I've just been busy with work. I'll .zip a copy to you real soon to help with this issue I'm having. Probably Monday-ish.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alvyxaz/barebones-masterserver/issues/55#issuecomment-289246689, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFAUwxhBGo4sLVDIV-MH0Ym9KeNvStnks5rpaKwgaJpZM4MhSwb .

DeadlyCobraXXX commented 7 years ago

@alvyxaz Sending you the link to download the Project files via e-mail today. Currently zipping them up. 4 GB... I will upload it to DropBox. I left a README and some other documentation in the base of the project folder. If you have any questions, I'll be around all day tomorrow (4/6/17). I can join your discord at that time too. I probably will be in there regardless to discuss any issues. (If you're available, if not, don't sweat it man.)

Thanks a bunch man, you're a total lifesaver!

DeadlyCobraXXX commented 7 years ago

FYI, I just got a VPS (for testing purposes), and am in the process of setting it up... It's pretty much done now, BUT since the files I sent to you via E-mail contains the IP addresses for a local MasterServer, you'll have to download the latest patch via the updater (Launcher). I'll patch it tomorrow (4/6/2016) to reflect the new VPS IP. In the meantime, I'll leave my local server up and online, so you can connect and do whichever you'd like without having to edit any project files other than MSF. I'll also make you a user on the VPS, so you can login if you need to.

Sorry this is so complicated.... :\

DeadlyCobraXXX commented 7 years ago

This should say "-msfStartSpawner" -msfStartMaster will not start both the master and spawner, as I tried thinking it was a new feature lol.

Also, after looking into what you said, I am still unable to change scenes. I am fully upgraded to v2.0.3 now, added the unet connector to the lobby scene too. Everything matches from what you have in the QuickSetup, but with my server settings such as IP, Port, and GameServer Path. I still do not have any luck. I scrapped my own MasterServer scene and am currently using the one from the QuickSetup in hopes to find it magically working lol. But it still isn't. :(

My GameServer scene is identical to yours as well.

Client "Create Server" and "Create Lobby" settings reflect my game scene map as well.

I'm just stuck again and out of ideas as to why it just won't load in. I can allow you access to my Team Collab if you'd like. Maybe that would make things easier to look at...

DeadlyCobraXXX commented 7 years ago

After looking over a few more things, I may have found a couple other things I forgot, however, it's bedtime now. I did send you a request to your email as a User to my Organization so you can view it if needed to.

I'll try again after work tomorrow. Have a good night!

alvyxaz commented 7 years ago

Hey!

Today's my day off, so I'll look into what might be happening with more details tomorrow.

To progress faster, I'd recommend to create a smaller project with something like a "fake" unet game, so that you can build/test your client/game server faster.

Of the top of my head, here's the flow of events that should happen:

On Fri, Apr 7, 2017 at 7:32 AM, DeadlyCobraXXX notifications@github.com wrote:

After looking over a few more things, I may have found a couple other things I forgot, however, it's bedtime now. I did send you a request to your email as a User to my Organization so you can view it if needed to.

I'll try again after work tomorrow. Have a good night!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/alvyxaz/barebones-masterserver/issues/55#issuecomment-292433792, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFAUx1y2swopBihvYQMDMboT7VVOjQ3ks5rtbx1gaJpZM4MhSwb .

DeadlyCobraXXX commented 7 years ago

Ok, I've done as you asked and made a smaller project. The smaller project works. I've applied the same settings and gameobjects to my current project, and I'm still getting failed to create server.

The gameserver process runs, after about so many seconds, it closes and displays failed to create a game server on the client chat ui.

I've been messing around with this for days and still cannot find the reason to why this isn't working on my real project. Makes no sense.

DeadlyCobraXXX commented 7 years ago

output_log.txt Here's my MasterServer/Spawner Output log.

DeadlyCobraXXX commented 7 years ago

It looks like it gets to Process registered (4/5) before your default UI (Progress) says Aborted.

Also, I am using your default SimplePlatform as the gameserver scene until I get find out why this isn't working.

Unity Console says this: [Error | Logs] Game creation aborted UnityEngine.Debug:LogError(Object) Barebones.Logging.LogAppenders:UnityConsoleAppenderWithNames(BmLogger, LogLevel, Object) Barebones.Logging.BmLogger:Log(LogLevel, Object) Logs:Log(LogLevel, Object) Logs:Error(Object) Barebones.MasterServer.CreateGameProgressUi:OnStatusChange(SpawnStatus) (at Assets/Barebones/MsfUiSamples/Scripts/Rooms/CreateGameProgressUi.cs:107) Barebones.MasterServer.SpawnRequestController:HandleStatusUpdate(IIncommingMessage) (at Assets/Barebones/Msf/Scripts/Modules/Spawner/SpawnRequestController.cs:57) Barebones.Networking.PacketHandler:Handle(IIncommingMessage) (at Assets/Barebones/Networking/Scripts/PacketHandler.cs:25) Barebones.Networking.ClientSocketWs:HandleMessage(IIncommingMessage) (at Assets/Barebones/Networking/Scripts/ClientSocketWs.cs:314) Barebones.Networking.BasePeer:HandleMessage(IIncommingMessage) (at Assets/Barebones/Networking/Scripts/BasePeer.cs:369) Barebones.Networking.BasePeer:HandleDataReceived(Byte[], Int32) (at Assets/Barebones/Networking/Scripts/BasePeer.cs:399) Barebones.Networking.ClientSocketWs:Update() (at Assets/Barebones/Networking/Scripts/ClientSocketWs.cs:177) Barebones.Networking.BmUpdateRunner:Update() (at Assets/Barebones/Networking/Scripts/BmUpdateRunner.cs:53)

DeadlyCobraXXX commented 7 years ago

Update: After rebuilding my entire GameServer Scene and re-mirroring all the settings it had before, I am able to CREATE (from the create game server button) and then join the server successfully. The scene changes too. However, when I click "Start Game" in the lobby when everyone is ready, I am having the previous issue. The GameServer launches, but does not change scenes, nor detect a scene change.

Another Update: I found that after playing around with a test project and my real project, the reason why the lobby isn't changing to the active GameServer scene has something to do with the Controls and Settings within the Lobby UI. When I have them all active and off the canvas, the gameserver loads, and the scene changes ONLY after I hit play after first hitting the start button. In the test project, I only have to hit start game and it works like it's supposed to. I cannot find which controls or settings that are making this happen, as I won't need to use any controls at all, so having them in the scene is a waste.

DeadlyCobraXXX commented 7 years ago

Omg, I'm so stupid. I got it working perfectly now.