Multiplayer games using sockets & alternatives

The last multiplayer forum was

https://codea.io/talk/discussion/8334/multiplayer-games-using-sockets#latest

I tried it with my iPad and iPhone. It works, to some extent. Posting progress pics below. Red is the iPad Screen , green is the iPhone Screen. I set both screens width and height but was having trouble with iPhone screen as you can see in example photos. Also the sync wasn’t perfect.

Anyways it’s been 3 years since that forum, I was wondering if anyone has a update with using sockets or knows any other methods for multiplayer.

~~
https://codea.io/talk/discussion/6461/beginning-of-my-multiplayer-project-with-sockets
~~
Ignatz mentioned JakAttak multiplayer class with automatic lookup of IP address, as well as the ability to search for other iPads. Does anyone have or a link?

i haven’t messed around with that since I wrote it. Codea added OSC since then which makes things easier, but I don’t think anything was done with that.

Looking at the pictures you show, it looks like the screen size of the iPhone isn’t set right. The right button is part way off the screen. The code below draws the 4 buttons based on the width w and the height h set at the beginning of the code. So the right button should be drawn 100 pixels to the left of the right edge.

    rect(50,h/2,50,50)
    rect(w-100,h/2,50,50)
    rect(w/2,50,50,50)
    rect(w/2,h-100,50,50)

@Jarc I was playing with the multiplayer code just to remember what I was doing. So what I seen, setting the width w and height h should be the size of the smaller screen, not the size of the screen the code is running on. That’s why I set w, and h and not using WIDTH and HEIGHT. Also, I noticed that a green or red color doesn’t know it runs over the other color. I’ll have to look into that if I decide to update the code. Anyways, the 2 devices stayed synced as I was moving the directions around.

PS. I corrected a few things and reposted the original discussion with updated code.

@dave1707 Thanks, it’s working for me but could it ever work for global IPs? Also Game Center was mentioned a lot as I was digging through some forums, could that be a alternative? Wondering if you ever had a go with Game Center.

@Jarc I never did anything with Game Center and never tried doing anything with global IP’s.