700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 元气骑士多终端跨网远程联机解决方案

元气骑士多终端跨网远程联机解决方案

时间:2020-05-12 04:10:06

相关推荐

元气骑士多终端跨网远程联机解决方案

受到元气骑士双人远程联机指南的启发,在这篇文章的基础上完成了最多支持4人同时联机的relayer. 具体要求同以上文章。

所有资源一同放在github: SoulKnight-Remote

下面的内容同github repo的README, 方便各位朋友(不用点击)。

Soul Knight Remote Multiplayer Host UDP broadcast relayer

A C proram running in Linux layer of Android that relay the multiplayer discovery broadcast package from soul knight to the specified IP address and port in the sameIP POOL.

Compile (For Windows)

We have provided a pre-build verison of arm namedudp_relay_arm

Need Android NDK toolchain to do a cross-platform compile.

Assume that you have unziped what it contains in android-ndk-r16b-windows-x86_64.zip toD:\ndk

Placeagcc.batandagcc86.batto D:\ndk.

Add D:\ndk and D:\ndk\android-ndk-r16b-windows-x86_64\android-ndk-r16b to thePATHof Environment Variables.

Executeagcc.bat -o udp_relay udp_relay.c -std=c99 -O2in command prompt. If you want to compile a version for x86 platform, replaceagcc.battoagcc86.bat

Usage

Requirement

For user:

A server with public IP, and open TCP/UDP:1723,1701 ports, and had configured a PPTP VPN service that all the clients connected can talk to each other and the server.A computer with adb tools and adb-connect drivers of the host device.

For Host device (Host a multiplayer game):

A rooted device.Full control to /sdcard/ and /data/local.OpenUSB debuggingswitch in Developer Options.Connect to a local networkwith WIFIwich has aDHCP server.Connect to the PPTP VPN server mentioned above.

For Client device (Join in multiplayer game):

Connect to the PPTP VPN server mentioned above.

Step (For Windows)

Assume that the host had been connected to a computer in the same local network through cable, and you can see your device through executeadb devicesin command prompt.Assume that all of the devices not connect to the VPN server and not running the game. If needed, I will tell you when to do what.

Pushudp_relaybinary program to/data/local

Change protected bits ofudp_relayto 777.

NOW LET ALL OF THE DEVICE CONNECT TO THE VPN SERVER.

Execute commands above in adb shell with superuser permission.

./udp_relay [-d] [num-of-player-exclude-host] 23333 [nth-player-ip-in-vpn-server]-d is for open debug mode. It will show you the details of relaying package.

For example. I have 4 devices(host included) need to play together. Their IPs are from 192.168.10.10-192.168.10.13, 192.168.10.10 is the host. So I execute

./udp_relay -d 3 23333 192.168.10.11 192.168.10.12 192.168.10.13

If all is well, you can see the output like:

Welcome to Soul Knight remote multiplayer host UDP relay helper by Nemesiss.Lin.Debug Mode.Will allow 3 players, and you will be the host.Port Number : 23333Add player : 192.168.10.11Add player : 192.168.10.12Add player : 192.168.10.13Setting host info...

NOW LET ALL OF THE DEVICES ENTER THE GAME AND HOLD ON “Tap to start” SCREEN

NOW THE HOST DEVICE CREATE A MULTIPLAYER GAME AND ENTER THE SCREEN OF SELECTING CHARACTERS

Check the adb output, you should see

Player 0 -- Relaying a packet of length 125 from <ip-to-the-host-in-local-network>.Player 1 -- Relaying a packet of length 125 from <ip-to-the-host-in-local-network>.Player 2 -- Relaying a packet of length 125 from <ip-to-the-host-in-local-network>....

Check the host device, you can see your host ip is192.168.10.10in the screen of the lower left cornerinstead of the local network ip assigned by DHCP server.

NOW LET OTHER PLAYER ENTER THE “Join Game”.

If all goes well, all of the devices can enter the multiplayer room and the host can start the game.

Note:

Ensure that all of the devices had connected to the VPN server before runningudp_relayprogram.Ensure that runudn_relayprogram before running the game. Or the game cannot bind the 23333 port.If anyone exit the room, it won’t be removed from playerlist in the room. Maybe the host should re-create a room. At that time it doesn’t need to restart theudp_relay. This bug is caused by the way to discover other players by the soul knight.IfUnable to bind to socket, usepscommand to find out that whether there is an oldudp_relayprocess running, if so, kill it.You can also use some “Terminal Emulator” apps on the host device, then the computer with adb env isn’t necessary.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。