Page 1 of 3

Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 5:08 pm
by SmartGlassesMan
Hi! I'm a newbie 'prole' and this is my first post. I love the engine and the community so far. Thanks to everyone for setting it up or participating!

I did a search for 'mobile networking' on the forum and didn't find many posts, and the posts didn't seem to have an answer, so this seems like a safe question to ask:

What is the status of multiplayer mobile networking with the Love2D game engine?

I realize that networking is considered to be a very difficult topic, and mobile networking is considered to be even more difficult. That may be the reason why there seems to be so little discussion of it.

By 'status,' I mean things like: Has anyone developed a multiplayer game networked over mobile devices (peer to peer or otherwise) using Love2d? I'm sure that it is theoretically possible, but is anyone aware of a vague outline of some steps which might be required?

I've been looking into the sock.lua and Enet a little. It seems as if I would have to build Enet from source and use something like the Android NDK to get it working on Android, if it is possible. I have very little idea about how to get something like that working on iOS.

If you've read this far, thank you for tolerating a newbie question from a lowly 'prole.' :)

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 6:35 pm
by ivan
Welcome aboard.
As far as I know, networking is typically done using third party modules: luasocket and enet.
Move or Die is a Steam game with multiplayer support, not sure if it's available on mobile devices, but it should be possible in theory.
For mobile, you'll probably need some sort of integration with Google Play or Game Center which will require programming outside of Lua. Not possible using Lua/FFI alone.

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 6:48 pm
by SmartGlassesMan
ivan wrote: Sat May 19, 2018 6:35 pm Welcome aboard.
As far as I know, networking is typically done using third party modules: luasocket and enet.
Move or Die is a Steam game with multiplayer support, not sure if available on mobile devices, but it should be possible in theory.
For mobile, you'll probably need some sort of integration with Google Play or Game Center which will require programming outside of Lua. Not possible using Lua/FFI alone.
Thanks for the reply. That's helpful information.

The bottom line seems to be that this is probably going to take some low level C++/C work unless I use a paid, proprietary game engine that has built in Raknet integration like Unity3D.

That's kind of what I suspected, but it is much better to have validation from the community.

Thanks again!

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 7:00 pm
by zorg
SmartGlassesMan wrote: Sat May 19, 2018 6:48 pm Thanks for the reply. That's helpful information.
No it's not, when it gets misinterpreted.

Correct me if i'm wrong, since i don't do much android or ios development but, doesn't all officially supported löve platforms include all 3rd party libs?

Enet and luasocket both should exist on the mobile platforms.

If your question was only meant to ask about the possibility of connecting one device with another and sending messages to each other (through wifi, over a network, i mean), then that works regardless of platform and only has issues with NAT when it comes to routers and firewalls and stuff.

If you were asking about integration with other online services, or through bluetooth or NFC, those are the harder things. But again, you don't need those for just connectivity through an IP network between two devices that have löve installed.

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 7:20 pm
by MissDanish
zorg wrote: Sat May 19, 2018 7:00 pm
SmartGlassesMan wrote: Sat May 19, 2018 6:48 pm Thanks for the reply. That's helpful information.
No it's not, when it gets misinterpreted.

Correct me if i'm wrong, since i don't do much android or ios development but, doesn't all officially supported löve platforms include all 3rd party libs?

Enet and luasocket both should exist on the mobile platforms.
yeah as far as I know Löve android is on a high level EXACTLY the same thing as the desktop version, so if he is just talking about multiplayer he would just have to code it the exact same way as on PC. Though one thing to consider about mobile is the added latency, since no one is gonna attach multiple adapters to get an ethernet cable plugged in (though it is possible on android).

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 7:25 pm
by SmartGlassesMan
zorg wrote: Sat May 19, 2018 7:00 pm
SmartGlassesMan wrote: Sat May 19, 2018 6:48 pm Thanks for the reply. That's helpful information.
No it's not, when it gets misinterpreted.

Correct me if i'm wrong, since i don't do much android or ios development but, doesn't all officially supported löve platforms include all 3rd party libs?

Enet and luasocket both should exist on the mobile platforms.
Thanks for the reply.

I checked the Enet website to try to find out how to use it in a mobile Love2D application (for instance, using sock.lua)

http://enet.bespin.org/Installation.html

From what I can tell in the installation section, I would need to download the C source and compile it for the target to get Enet working.

I have done a little Android development, so I know that if I'm getting C code working on an Android device, I will probably need to use the Android NDK, at the least.

Maybe it wouldn't be much work, and would be trivial as the website claims, but it is a bit more work than just coding in Love2D, in my book. :)

If someone else has already compiled Enet for Android, then that could save me some work.

Maybe I just missed something.
zorg wrote: Sat May 19, 2018 7:00 pm
If your question was only meant to ask about the possibility of connecting one device with another and sending messages to each other (through wifi, over a network, i mean), then that works regardless of platform and only has issues with NAT when it comes to routers and firewalls and stuff.
I'm sure it works. I hope I can get it working in a little test application. But, as I indicated, it looks to me as if I'll have to compile Enet from source and learn to use the Android NDK. My previous development in Android used the Dalvik Virtual Machine with their basic Java framework, so it is a bit unfamiliar to me. I'm not disputing that it is doable, though. :)
zorg wrote: Sat May 19, 2018 7:00 pm
If you were asking about integration with other online services, or through bluetooth or NFC, those are the harder things. But again, you don't need those for just connectivity through an IP network between two devices that have löve installed.
I wasn't asking that. But, thanks for being thorough.

Thanks again for the reply.

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 7:49 pm
by grump
zorg wrote: Sat May 19, 2018 7:00 pm Correct me if i'm wrong, since i don't do much android or ios development but, doesn't all officially supported löve platforms include all 3rd party libs?

Enet and luasocket both should exist on the mobile platforms.
One problem you have to deal with on mobile platforms, but not so much on PC, is roaming - e. g. endpoints moving between WiFi and carrier networks, or other sudden IP address changes, are common on mobile. A good mobile user experience means you have to take this into account.

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 7:50 pm
by SmartGlassesMan
MissDanish wrote: Sat May 19, 2018 7:20 pm
yeah as far as I know Löve android is on a high level EXACTLY the same thing as the desktop version, so if he is just talking about multiplayer he would just have to code it the exact same way as on PC.
Yes, the code should be similar. There are pre-built binaries for Enet on Windows, though, and I haven't found any for Android.

http://leafo.net/lua-enet/#download_and_install
"Windows
Prebuilt binaries are provided:
Download http://leafo.net/lua-enet/bin/lua-enet-1.1.zip.
Unzip and install alongside your Lua installation."

Thanks for the reply.

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 7:52 pm
by SmartGlassesMan
grump wrote: Sat May 19, 2018 7:49 pm
One problem you have to deal with on mobile platforms, but not so much on PC, is roaming - e. g. endpoints moving between WiFi and carrier networks, or other sudden IP address changes, are common on mobile. A good mobile user experience means you have to take this into account.
True. Thanks for making that point.

Re: Status of Multiplayer Mobile Networking

Posted: Sat May 19, 2018 7:56 pm
by zorg
SmartGlassesMan wrote: Sat May 19, 2018 7:50 pm
MissDanish wrote: Sat May 19, 2018 7:20 pm
yeah as far as I know Löve android is on a high level EXACTLY the same thing as the desktop version, so if he is just talking about multiplayer he would just have to code it the exact same way as on PC.
Yes, the code should be similar. There are pre-built binaries for Enet on Windows, though, and I haven't found any for Android.

http://leafo.net/lua-enet/#download_and_install
"Windows
Prebuilt binaries are provided:
Download http://leafo.net/lua-enet/bin/lua-enet-1.1.zip.
Unzip and install alongside your Lua installation."

Thanks for the reply.
And again, you don't need to do anything yourself regarding Enet, it's bundled into löve, like how luasocket is. You just

Code: Select all

local enet = require 'enet'
and it works.