how do we conncet two android/ios phones to each other?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mdswamp

i have a simple game with multiplayer ready codes. it is a fighting game with 2 players max. i succeeded to connect two pc to each other with hamachi and play the game (i did everything to do it via port forwarding, but i couldn’t). now my Q is how should connect two phones to each other? is there a simple way like hamachi for mobile phones or is there a better way to do it? is there a way to connect them via P2P networking (people say it is bad for gaming because of latency)? what a bout website like this:

how can i use websites like this? (sorry about my simple questions, i dont know networking a all :wink: )
thank you :slight_smile:

:bust_in_silhouette: Reply From: Oen44
  1. Master server + matchmaking.
  2. Client-side host.
  3. Peer 2 Peer.

First option is the best, not just because you can use different server locations (so people from USA won’t have to connect to server in Europe), but it’s overall more secure (server-side code) and easier to manage.
Second option is way harder to prevent cheating and manage but allows LAN connections.
Third option depends on your needs, not recommended for real-time fighting game so I’m not going to describe it further.

hi Oen44, thank you for replying
is there any tutorial to implement option 1 for ex… i downloaded android sdk android package from appwarp website, but i dont know what should i do with it :wink:

mdswamp | 2018-11-05 18:43

Master Servers are 98% of the time headless applications. Why? Performance mostly, console, commandline applications are just enough for that. They are not build using game engines. It’s something that works better when created from scratch (or using library/framework (like Kryonet), which is recommended). For example you can create server using C#, have your game made in Java, C++ or Python (I would like to say GoDot too, but not sure if GD supports that kind of networking without source editing) and it’s going to work together by sending and receiving packets.

Secondly, I’m not working with GoDot (lack of community and extensions), never used networking and all so I’m not able to provide examples. Only documentation based stuff and overall experience.

What you should do is study as much as possible about how networking in GD works, so follow this documentation about High level multiplayer. There are examples that will help you progress further. Have in mind that GoDot won’t give you working examples, you will have to rip your skin off before you get to the point where it will work as expected.

Oen44 | 2018-11-05 19:08

really thanks for info oen44.
the last Q (sry)… can you show me a tutorial about using p2p networking for games especially on android (as you read before somehow i managed it on pc)? is it possible to do such a thing on android? i understand that it is not practical to use p2p networking because of latency, but i want to learn it. thank you very much :slight_smile:

mdswamp | 2018-11-05 21:07

There is no tutorial for GoDot on that topic. Yes, it is possible. Google Play Service is capable of handling that, take a look there.

Take a look at this article. It’s the closest thing to tutorial about networking and P2P model.

Oen44 | 2018-11-05 21:16