I have no further recommendations aside from learning more about socket and researching online.
Ok, funny I just got it working 5 minutes before you sent that. I cant thank you enough without your help I wouldn’t have been able to do this.
Be sure to share the modified working files here.
Sharing a project that uses them and demos them working would be the best.
Just attach it to the post as a zip file using the ‘more reply options’ button below.
Ok I’ll be sure to send it once it fully implemented in my game and it works its best
OK, but in the interim can you please describe the change(s) that allowed you to get it working?
Hey man. Don’t hold out on us here. There are a lot of people (including me) who want to know the final solution.
Just attach the modified UDP*.lua files and main.lua with a sample call/setup (all in a single zip file) to a post below (click ‘more reply options’). That should be enough.
I know you promised to give this later, but since it is essentially working now I know it would benefit me and many others to see it sooner rather than later.
Thanks
+1 to roaminggamers request
Sorry I’ve been away since I last replied and haven’t been able to work on my game or reply in the fourm. Basically all I did was make the server display it’s IP and then I implemented a prompt in the client that asked for the server IP (kinda like how minecraft works if you’ve ever played that)
I’d google for:
- Lua Socket
- Lua TCP
- Lua game server
- Lua server
- … you get the idea.
I’d also search over at github.com
Lastly, I have a modified copy of AutoLan, but I can’t tell you how well this will work for you as I haven’t used it for a while and things in the land of security have changed for Android, iOS, and Apple TV:
https://github.com/roaminggamer/AutoLan-IPv6
also found this:
https://forums.coronalabs.com/topic/26339-p2p-udp-tutorial-example/
Thank you, this should help me out a little
I may have something to post back in a few day.
So I’ve spent the best part of today using the information you told me to look up ways to do this. I’ve found many things like app wrap that allow you to use their service to achieve multiplayer however something like this inst what I’m looking for. Id like to have it so that a player can host a game from their device and another can join and it would work by sending strings to and from the devices. I found the original AutoLAN and it seems to be exactly what I’m looking for but it is old and no longer works and the newer IPv6 version is also broken due to being outdated. Making my own simple socket server seems to be the best option for cross-platform local multiplayer. I looked at the link you sent (https://forums.coronalabs.com/topic/26339-p2p-udp-tutorial-example/) and this would work for me however it only sends things from the client to the server and you cant send things from the server to the client and that wouldn’t work for me. Is it possible for you to modify it to send stuff both ways? my attempts at this just make corona freeze up and crash.
Hi. I have a different solution. I’ll try to post it in the next few days. I’m crushed right now.
Tip: When posting in the forums, if you avoid wall-of-text (WOT) posts and make your posts easily accessible/legible you’ll get more and better responses.
I don’t generally read WOTs, but since I was already in this thread I browsed your post briefly to respond.
Looking forward to what you’re going to post … I still have an old prototype on my drive I’d like to turn into a real game in the future and it was using AutoLan (can’t remember the version)
I dug up an old product of mine and stripped out the Client-Server Code.
https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/11/peer2Peer.zip
It is not perfect, but it still seems to work.
This example uses the client/server modules to:
- Create an app w/ two choices.
- A. Be the server
- B. Be the Client.
- After you select server (can only be one) or client (1+ is OK), the app allows you to send and receive messages.
https://www.youtube.com/watch?v=sbYwcc4DmgY&feature=youtu.be
Notes:
- The code in main.lua uses SSK for the buttons and to set up the message event listeners.
- The two modules each have a tiny summary of functions at the top.
- From any client, you can send messages to the server, a specific client, or all clients.
- From the server you can send messages to a single client or all of them.
- While this code seems to be functional, you need to verify it on all targets and between them.
- You need to set up ATS in build.settings if you want to test on iOS. I forgot to add this in the example.
- If you find this fails in some cases, please post back with specific details about the failure and test device(s) so I know it failed.
- I may add this directly to SSK later, but right now you get an early sneakpeek.
- I used ‘localhost’, but you may need to use the machine IP instead. The code to set that is already in the example, just commented out.
PS - I have only tested this on Window 10 running three instances of the simulator (2018.3363).
PPS - The name of the example ‘peer2Peer’ is a misnomer. Originally I tried to provide a pure Peer-to-Peer (serverless) example, but I could not. So, I just used the same base for a client-server solution instead.
Thanks a lot this looks promising, I’ll mess around with it when I have some time today. I’ll let you know how it goes. Also I’ll try to avoid writing wall of text posts, this is only my 2nd fourm post so I’m kinda a noob at writing posts.
I tried running the server in the sim and it works great but as soon as I try it on a actual android device it gives me a runtime error at line 103 in client.lua
Good thing is that it’s exactly what I’m looking for
What steps did you take to debug this?
Did you you update build.settings to enable internet for Android? My sample was only setup for desktop.