Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Local multiplayer with tcp/udp
Started by hugbouchard Feb 08 2020 12:08 PM

- - - - -
6 replies to this topic
no-wifi tcp udp local multiplayer client server
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

hugbouchard

[GLOBAL: userInfoPane.html]
hugbouchard
  • Observer

  • 2 posts
  • Corona SDK

Hi, I'm new to corona sdk and i'm currently developping an app.

 

I would like to develop a local multiplayer mode with tcp/udp.

I've seen the tutorial coronalabs.com/blog/2014/09/23/tutorial-local-multiplayer-with-udptcp/

but it seems like it is not working anymore due to lua sockets update. (I've tried the tutorial myself without success).

 

So I was wondering if there's any way I could do a Local multiplayer mode (one device is a server, others are clients) that doesn't require a wifi access?

 

Thank's a lot.



[TOPIC: post.html]
#2

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Corona Geek

  • 1,420 posts
  • Corona SDK

Doesn't require Wifi access? How would they communicate? Bluetooth. It is based on the old tutorial.

 

You can try my version but this one requires some sort of network connection (WIFI), I have not tried it in about 9 months but it use to work:

 

https://github.com/agramonte/zcrmmp


  • roaminggamer, sporkfin and hugbouchard like this

[TOPIC: post.html]
#3

Develephant

[GLOBAL: userInfoPane.html]
Develephant
  • Corona Geek

  • 1,473 posts
  • Corona SDK

Hi,

 

Local multiplayer is possible without a Wifi connection, but it is not a trivial process. You need to build a server and client on device using LuaSocket, which is available through the API (https://docs.coronalabs.com/api/library/socket/index.html).

 

Building the server and client is something you'll need to learn with other documentation.

 

-dev


  • agramonte and hugbouchard like this

[TOPIC: post.html]
#4

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Corona Geek

  • 1,420 posts
  • Corona SDK

Lua Socket still needs a data link layer. Phones do not have built in ethernet connection. So it is either wifi or bluetooth or a dongle with ethernet, or some sort of packet transmission.


  • hugbouchard likes this

[TOPIC: post.html]
#5

hugbouchard

[GLOBAL: userInfoPane.html]
hugbouchard
  • Observer

  • 2 posts
  • Corona SDK

Thank you all for your great responses :)!  So, if I understand, in order to create a (LAN) local multiplayer without any wi-fi access with lua sockets, bluetooth would be a good way to transmit packets between mobile devices? (one device would be the server and others would be clients)

 

Thanks in advance!



[TOPIC: post.html]
#6

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Corona Geek

  • 1,420 posts
  • Corona SDK

Yes you can use bluetooth last time I checked there are some marketplace plugins that you can use.

 

I don't know your use case but if it is a office or static location it might be easier just to set up a wireless hub even if it is not connected to the internet. If it is critical that the person get the update, I would set up a small server that could receive and send the status updates. Now if you are just talking about a game that two people can play in the back seat on the road, I believe android and ios have options for local game play that rely on local network setup (might be wrong on this one).

 

Especially on Android with all the different bluetooth implementations, I don't know how reliably the bluetooth scenario would work. I wish you luck.


  • hugbouchard likes this

[TOPIC: post.html]
#7

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Corona Geek

  • 1,420 posts
  • Corona SDK

On a side note somebody here wanted to use my modified library for an app that would communicate between tables with iphone devices and an ipad or a window machine in the kitchen. The problem with my modified library is that it uses auto discovery to find the clients for the game and then shutdowns the auto discovery feature once the number of clients is reached. I was trying to solve my particular use case and didn't think of the bigger picture. You can remove all the bonjour plugin code from it and just use a configured static port to make the solution much easier especially if everything is static.


  • sporkfin and hugbouchard like this


[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: no-wifi, tcp, udp, local, multiplayer, client, server