Local multiplayer with WiFi or Bluetooth

Hi!

I have tested pubnub and it’s multiplayer functions. It’s really great for just sending messages and doing stuff that doesn’t has to be sent fast. I’m working with a game that would be so much more fun if it got multiplayer and I have to send both players coordinates between the devices and it is just too slow.

Local multiplayer is more than great with either wifi or bluetooth but I can’t find anything that does that. [import]uid: 24111 topic_id: 15542 reply_id: 315542[/import]

Online multiplayer can be a really tricky thing, and depends entirely upon the type of game you are creating. I use PubNub for the game I am working on, but it is turn based, so the logic was pretty simple. For years, developers have been using a few “tricks” that make multiplayer seem real-time, when it is not.

For example, a common approach is to send the input command for your player to the other player, and let the other player’s device figure out the logic for that move. Also, a technique call “Dead Reckoning” can be used to predict the players movement when a command is not actually received.

I guess my main point is that you might be able to make a system like PubNub work for you, by limited the number of messages that are sent between clients. [import]uid: 18601 topic_id: 15542 reply_id: 57437[/import]

I’m testing this with using two ipad simulators on one computer, does that make any difference because the delay is just like 1-3 seconds.

Or is it possible to make a local multiplayer option because that’s all I need? [import]uid: 24111 topic_id: 15542 reply_id: 57452[/import]

I can’t guess what the other players position is cause it have to be moved exactly as it is played. [import]uid: 24111 topic_id: 15542 reply_id: 57490[/import]

Bump. [import]uid: 24111 topic_id: 15542 reply_id: 57780[/import]

Corona SDK doesn’t support peer-to-peer networking from what I can tell.

Real time games need a dedicated server running somewhere that can deliver messages between devices and manage the game logic. Unfortunately most hosting providers won’t let you run your own daemons for something like that.

But if you can get a service where you can setup a program listening on a port, Lua (and Corona SDK) does support LuaSockets so you should be able to get messages at near ping speeds. [import]uid: 19626 topic_id: 15542 reply_id: 57788[/import]

Yeah, I was trying to get something working a little while back for local multiplayer (https://github.com/TheOddLinguist/lump), but this solution would require both users to be on the same network…and access to the device IP (which we don’t currently have). Just bringing it up in case someone has an answer to those problems…hehe
Christopher [import]uid: 21712 topic_id: 15542 reply_id: 57792[/import]

Both users on the same network is really all I need but if I know the device IP then where do I set it in the code? [import]uid: 24111 topic_id: 15542 reply_id: 57800[/import]

Well, my plan (probably not a good one) was to use the IP to guess the subnet. My code opens a port on one device while another device searches the subnet for that message. Then, they create a connection and are able to send messages to each other. The code, as is stands, is missing a lot of stuff, like handling disconnects and such…not really production-ready. I did it more to inspire someone with a better grasp on what’s necessary, really. hehe

However, I don’t believe we have access to the device IP through Corona. I’ve mentioned some Objective-C code that I was hoping they’d be able to use…but I figure it’s either more complicated than I realize or they have more important things to work on. [import]uid: 21712 topic_id: 15542 reply_id: 57801[/import]

But if I know the IP where do I put it? [import]uid: 24111 topic_id: 15542 reply_id: 57803[/import]

See:

http://developer.anscamobile.com/content/network

http://w3.impa.br/~diego/software/luasocket/socket.html

http://developer.anscamobile.com/forum/2010/05/07/wanting-migrate-php-socket-project-corona

And google around for using TCP sockets.
[import]uid: 19626 topic_id: 15542 reply_id: 57805[/import]

Well, if we’re talking about the code I wrote, you’d probably want to write something additional to figure out the proper subnet. But if it’s just a standard 255.255.255.0 subnet, you can put the first three octets here: https://github.com/TheOddLinguist/lump/blob/master/lump.lua#L199 [import]uid: 21712 topic_id: 15542 reply_id: 57807[/import]

…but again, my code is just a quickly-written proof of concept, by no means usable in production. It was more a “here’s what I got to work; what’s the next step?” kinda thing. [import]uid: 21712 topic_id: 15542 reply_id: 57808[/import]

I changed the 3 octets and it worked if I started two simulators on the same computer but not if I had it on different computers. Yes they are on the same network. [import]uid: 24111 topic_id: 15542 reply_id: 57812[/import]

Hmm, worked for me when I wrote it. One phone and the simulator was my test. Not sure what to tell you…unfortunately, I don’t have time to support right now. As I said, more of a conversation piece than anything. Sorry. Let’s just keep asking Ansca for something more native. hehe
Christopher [import]uid: 21712 topic_id: 15542 reply_id: 57894[/import]

Yeah I hope they do :smiley: [import]uid: 24111 topic_id: 15542 reply_id: 58136[/import]

I’m using one Mac machine and one Win machine for testing and when using two simulators on one win machine it doesn’t work at all. [import]uid: 24111 topic_id: 15542 reply_id: 58157[/import]

Does Corona SDK not support local multiplayer at this time? If so, are there any concrete plans to change that? [import]uid: 94904 topic_id: 15542 reply_id: 58694[/import]

Well it isn’t supported now and it isn’t on the roadmap. [import]uid: 24111 topic_id: 15542 reply_id: 58878[/import]

Just saw this: http://www.simple-loop.com/blog/?p=13

Hopefully it’s done soon! :smiley: [import]uid: 24111 topic_id: 15542 reply_id: 58882[/import]