Hello everyone! I’m back from a little break I took from Codea to refresh my mind and to start working on some Arduino programming. Recently I’ve been thinking about the networking required for a top-down shoot em up sort of game, and I was wondering if anyone had any suggestions on how to share the locations of bullets from the two devices. Would it be best to try and have one device be the host and the other the client, and convert the table to JSON and then decode it on the other end? Or would that be too slow and it would be best to send the other iPad a notification of when a shot is fired by either player, so neither would be the host? It’s all quite confusing, really, and I still am not sure I understand LuaSocket fully (they’re so easy in Java, lol). If anyone could give me any advice on this or on sockets in general, I would be extremely grateful.
I tried a 3D multiplayer FPS, and what I did was use the shooting iPad to figure out how close the shot came to the other player, and send that distance and the weapon type to the other player, which is just two numbers in string form.
You can encode the table with JSON in Codea using the built-in JSON library, which gives you access to json.encode and json.decode. Depending on what the server is made in, you’ll have to figure out how to encode/decode it there.
Send it as a string and then use the
load function on the other side to recreate it