Download

Android multiplayer wlan: Android as host device problem

I’m having big troubles getting android as the host working.

I’m testing with the **Multiplayer Shootout **to ensure it’s easy to reproduce with 4.10. The only thing I changed in that project was changing the OnlineSubSystem in the DefaultEngine.ini like so:



[OnlineSubsystem]
DefaultPlatformService=Null


What works:

  • Windows as host android as client

What doesn’t work:

  • Android as host windows as client
  • Android as host different android device as client

Log on android device as I start it as the host (“Create Session”):



11-30 19:59:30.256: D/UE4(24913): [2015.11.30-18.59.30:263][64000]LogInit: BSD: I am localhost (127.0.0.1:0)
11-30 19:59:30.391: D/UE4(24913): [2015.11.30-18.59.30:398][64000]LogPackageName: SearchForPackageOnDisk took   0.129s to resolve Level_01.umap.
11-30 19:59:30.491: D/UE4(24913): [2015.11.30-18.59.30:498][64000]LogPackageName: SearchForPackageOnDisk took   0.087s to resolve Level_01.umap.
11-30 19:59:30.491: D/UE4(24913): [2015.11.30-18.59.30:499][64000]LogNet: Browse: /Game/Maps/Level_01?listen
11-30 19:59:30.496: D/UE4(24913): [2015.11.30-18.59.30:499][64000]LogLoad: LoadMap: /Game/Maps/Level_01?listen
11-30 19:59:30.541: D/UE4(24913): [2015.11.30-18.59.30:546][64000]LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x0x96a62390
11-30 19:59:31.041: D/UE4(24913): [2015.11.30-18.59.31:047][64000]LogAIModule: Creating AISystem for world Level_01
11-30 19:59:31.046: D/UE4(24913): [2015.11.30-18.59.31:050][64000]LogWorld: Game class is 'MyGameMode_C'
11-30 19:59:31.051: D/UE4(24913): [2015.11.30-18.59.31:056][64000]LogInit: BSD: Socket queue 262144 / 262144
11-30 19:59:31.051: D/UE4(24913): [2015.11.30-18.59.31:058][64000]LogNet: GameNetDriver IpNetDriver_0 IpNetDriver listening on port 7777
11-30 19:59:31.086: D/UE4(24913): [2015.11.30-18.59.31:092][64000]LogWorld: Bringing World /Game/Maps/Level_01.Level_01 up for play (max tick rate 0) at 2015.11.30-19.59.31
11-30 19:59:31.091: D/UE4(24913): [2015.11.30-18.59.31:095][64000]LogWorld: Bringing up level for play took: 0.019772
11-30 19:59:31.126: D/UE4(24913): [2015.11.30-18.59.31:132][64000]LogScript:Warning: Accessed None 'CallFunc_K2_GetPawn_ReturnValue'
11-30 19:59:31.126: D/UE4(24913): 	MyGameMode_C /Game/Maps/Level_01.Level_01:PersistentLevel.MyGameMode_C_0
11-30 19:59:31.126: D/UE4(24913): 	Function /Game/Blueprints/MyGameMode.MyGameMode_C:ExecuteUbergraph_MyGameMode:045F
11-30 19:59:31.151: D/UE4(24913): [2015.11.30-18.59.31:158][64000]LogOnline:Warning: NULL: Can't start an online session (Game) in state InProgress
11-30 19:59:31.161: D/UE4(24913): [2015.11.30-18.59.31:167][64000]LogScript:Warning: Accessed None 'Widget'
11-30 19:59:31.161: D/UE4(24913): 	MyGameInstance_C /Engine/Transient.GameEngine_0:MyGameInstance_C_0
11-30 19:59:31.161: D/UE4(24913): 	Function /Game/Blueprints/MyGameInstance.MyGameInstance_C:Hide Widget:000A


Similar to the problem mentioned here without resolve: https://forums.unrealengine.com/showthread.php?69417-Local-Wifi-Multiplayer-without-using-Google-Play
and here also without resolve: Android host - UE4 AnswerHub

I have not been able to find anywhere how to get android as the host working. The end result I’m trying to achieve is android to android connection for a mutliplayer game over a local wifi both devices are connected to.

Also created an Answerhub ticket: Android as host not working - UE4 AnswerHub

Any help appreciated!

Ok I managed to get it working! By connecting via console commands with “open ipaddressOfMyAndroidDevice” instead of the blueprint node “Join Session”

So this appears to be a bug with the “Blueprint Session Result” variable not giving/getting the correct IP of the android host?

Is there anyway to get the server IP address in the client? Currently it seems like it only supports Server Name :frowning:

@ unreal team , any help or tips guys ?

The last few entries in the log explain some of what’s going on.



11-30 19:59:31.126: D/UE4(24913): [2015.11.30-18.59.31:132][64000]LogScript:Warning: Accessed None 'CallFunc_K2_GetPawn_ReturnValue'
11-30 19:59:31.151: D/UE4(24913): [2015.11.30-18.59.31:158][64000]LogOnline:Warning: NULL: Can't start an online session (Game) in state InProgress
11-30 19:59:31.161: D/UE4(24913): [2015.11.30-18.59.31:167][64000]LogScript:Warning: Accessed None 'Widget'
11-30 19:59:31.161: D/UE4(24913): 	MyGameInstance_C /Engine/Transient.GameEngine_0:MyGameInstance_C_0
11-30 19:59:31.161: D/UE4(24913): 	Function /Game/Blueprints/MyGameInstance.MyGameInstance_C:Hide Widget:000A


First line indicates that it can’t find the pawn for something. I suggest testing Multiplayer in PIE and making sure that ‘Break Blueprints On Exceptions’ is turned on in editor/project settings so you can fix it.

Second line indicates that you’re trying to start a Game Session while the GameModes Match State is ‘InProgress’ - which it says you can’t do. It seems as though Gameplay has already started before you start the Online Session, or you already have an online session in progress.

Third/Fourth/Fifth line indicates that the game can’t find a ‘Widget’ to remove in the Game Instance.

I would suggest fixing these errors and trying again after that. I’ve found that Android doesn’t seem to handle errors as gracefully as Windows does, especially when it comes to Multiplayer. The slightest misdemeanor seems to cause problems. We never tried an Android host for PC client, but all other configurations worked for us without a hitch when we did Cross-Platform multiplayer - so it definitely works. Always check both the Client and the Server logs too.

FYI: I managed to get it working using the pull request from psychogony as mentioned here: Android as host not working - UE4 AnswerHub

It can be found here: https://github.com/EpicGames/UnrealEngine/pull/1820
he shouldn’t mind me posting it here, but be aware it was tricky (for me at least) to cherry pick this one - but once I got it all compiled the join session blueprint node works flawlessly for me on both normal android app and two gearvr devices :slight_smile:

So yeah it’s definitely a bug in the engine with android and multiplayer that is not working by default unless you enter the IP directly but at least I have a workaround for now - it’s just annoying there are so many gearvr workarounds needed to be manually compiled every time a new UE4 version comes out…

Thanks TheJamsh

Thank aussieburger
But to be honest i couldn’t figure out how did you fix your problem from that Github page :frowning: did you copy past the files to your project ? iam not a programmed and if you have tips what change you made in your game in detail i will be very thankful as i’m noob here and my knowledge only restricted in blueprint .

Here’s a brief step-by-step for how I got it working. PS: I’m not a C++ programmer either and while the end result of these steps is it all works via blueprints, you do need to mess around with visual studio unfortunately:

  1. link your unreal and github account as per: https://www.unrealengine.com/ue4-on-github
  2. download the zip source code of the engine: https://github.com/EpicGames/UnrealEngine/tree/4.10
  3. have Visual Studio express installed
  4. exact zip and run setup (will take ages)
  5. run GenerateProjectFiles.bat as admin
  6. open UE4.sln which will open UE4 source in Visual Studio
  7. Build windows 64 | Development Editor (will take ages)
  8. replace the two whole files from the pull request: https://github.com/EpicGames/UnrealEngine/pull/1820/files
  9. Build Android | Development (will take ages)
  10. Build Android | Shipping (will take ages)
  11. Now you can open your freshly built engine with the fix in place. Located: \Engine\Binaries\Win64\UE4Editor.exe (it will take absolutely ages the first time you open and do anything)

For all that building stuff you can find documentation from Epic games on how to do it on this link: https://github.com/EpicGames/UnrealEngine/tree/4.10

I actually used branch 4.9 however all branches should work in theory

Annoying we need to do this - hope Epic can give feedback on putting the fix in for all! :slight_smile:

@ aussieburger thanks a lot man really appreciated , i will try to do your steps and hopefully unreal team can fix the issue .thanks to you i will get back to my lan android game project i was working on it that i left it due to this issue .

Hi

i just downloaded both the file required to be replaced but anyone can tell me pls why do i need to download the source code of the engine to do that ? as i already found and i can replace the 2 files in the engine itself that i download it from the epic launcher.

I’m in 4.8 Btw does this issue still in 4.10 ?

OK to close this thread thanks to aussieburger and psychogony fix . android now can act as server and the other phone can find the session when 2 phone connected to a local wifi router but just to be informed that the join fail when you make portable hotspot one of the phone or direct wifi to make a wifi network between the 2 phone so hope Epic can fix this issue .

Does anyone know if this is still needed in 4.11?

Yes i think as android still not supported .

Thanks for a reply. Time to download Visual Studio I guess.

So I have been away for quite some time but does it work now? Is it possible to make multiplayer work with Android?

it will be with 4.12

4.12 is out now. Has anyone tested this yet?

I just tested with two phones and also android server with pc trying to join. Everything works.

+1 @Pabooklas !

Now I just need a good tutorial series about MP on PC/Android using BP only and I am good to go :o

There are many tutorials how to do it for pc on youtube. For android it’s exactly the same. So follow one of them on YouTube. Then just hook your create, find and join events to umg buttons or even android buttons for testing.

Also edit the defaultengine.in file like the op wrote.

Good luck!

Wow! I can’t believe this I was actually able to get this to work. It sounds like a giant blind alley at first (took me probably around 3 hours), but it worked! This has to be the best instructions/boldest workaround I have ever seen. hahaha Thank you so much for the clear steps and wisdom. I was lost without this. You guys rock!

I wish I had more to contribute. let’s see. umm, I did this on 4.11. Oh there was one other hiccup. in the README.md (be sure to read it!) that comes with the https://github.com/EpicGames/UnrealEngine/tree/4.10 download it says, “Be sure to include C++ support as part of the install, which is disabled by default.” Here is a link on how to do that. https://www.youtube.com/watch?v=U1MRUiJAOq0

Thanks again, guys I can’t tell you how relieved I am.