Page 1 of 3

TCP peer to peer

Posted: Tue Sep 22, 2015 7:01 pm
by Luke100000
Hello!

I want to add multiplayer to my games, using TCP and a peer to peer system to avoid servers. I'm using a database to store the IP of the players. Works fine... until I try to connect one client to another one. No incoming connections allowed... So the only way to do this is using a server, right? Where can I get a ultra cheap (or free) server which only sends and receive data to/from the clients? Or is there another way?

Thanks!

Re: TCP peer to peer

Posted: Thu Sep 24, 2015 6:40 am
by ivan
A lot of action pvp games use UDP since it's lighter/faster.
Sure you should be able to make direct connections between players without the need of a server.
Having a server script is useful for enforcing the game logic (preventing client-side cheating/errors) and for lobbies.
You can use free hosting with php for testing this but when you have a lot of players it's a non trivial issue.

Re: TCP peer to peer

Posted: Thu Sep 24, 2015 1:46 pm
by Luke100000
ivan wrote:A lot of action pvp games use UDP since it's lighter/faster.
Sure you should be able to make direct connections between players without the need of a server.
Having a server script is useful for enforcing the game logic (preventing client-side cheating/errors) and for lobbies.
You can use free hosting with php for testing this but when you have a lot of players it's a non trivial issue.
If the game runs local it works, but not online.

Re: TCP peer to peer

Posted: Mon Sep 28, 2015 8:32 am
by Luke100000
Does anyone know a free hosting for a small (php) server?

Re: TCP peer to peer

Posted: Mon Sep 28, 2015 10:22 am
by zorg
Luke100000 wrote:
ivan wrote:A lot of action pvp games use UDP since it's lighter/faster.
Sure you should be able to make direct connections between players without the need of a server.
Having a server script is useful for enforcing the game logic (preventing client-side cheating/errors) and for lobbies.
You can use free hosting with php for testing this but when you have a lot of players it's a non trivial issue.
If the game runs local it works, but not online.
It depends on a lot of things, like router and firewall settings, but i know that UDP/Direct Connections also work online as well. Many times, it's not the code that's the problem, but the network configuration.

Re: TCP peer to peer

Posted: Mon Sep 28, 2015 12:14 pm
by TheOdyssey
Luke100000 wrote:Does anyone know a free hosting for a small (php) server?
Most you need to pay for. And if you don't need to pay I would be a bit sketchy about it. However, you can just host your own and then proceed to Port Foward your router. This has always worked for me but I haven't tried it with Love2D yet. Good luck :awesome:

Re: TCP peer to peer

Posted: Mon Sep 28, 2015 12:24 pm
by Nixola
I've used Altervista in the past, before using a friend's VPS and then buying my own (and, incidentally, switching to a Lua webserver I wrote because I can't make heads or tails of PHP)
You can host a website there as well; you get 1GB of space, 30 GB of bandwidth, PHP5, a MySQL5 database with no more than 20'000 queries per hour, PHPMyAdmin, FTP access, and even an ad system just in case you'd like to try and earn something; you can get more space, more bandwidth and unlimited queries by buying them or using "AlterCents" (ads generate both money and that currency).

Re: TCP peer to peer

Posted: Mon Sep 28, 2015 6:44 pm
by T-Bone
The thing is, most people's firewalls prevent random incoming packets. This is regardless of UDP or TCP. If you don't have any budget to speak of, I'd suggest doing a Minecraft: Just distribute the server software and let people set up their own servers. For playing over LAN, it'll be easy, and it gives people a chance to test the game. If it's good, some people will bother to set up servers that can be reached online.

Re: TCP peer to peer

Posted: Mon Sep 28, 2015 11:37 pm
by TheOdyssey
T-Bone wrote:The thing is, most people's firewalls prevent random incoming packets. This is regardless of UDP or TCP. If you don't have any budget to speak of, I'd suggest doing a Minecraft: Just distribute the server software and let people set up their own servers. For playing over LAN, it'll be easy, and it gives people a chance to test the game. If it's good, some people will bother to set up servers that can be reached online.
Probably the best choice. But people could just take down their firewalls for testing, or, better yet Windows does allow you to chose which programs can pass the firewall. I don't know for sure but OSX and some Linux Distros should allow it as well.

Re: TCP peer to peer

Posted: Tue Sep 29, 2015 8:16 am
by s-ol
TheOdyssey wrote:
T-Bone wrote:The thing is, most people's firewalls prevent random incoming packets. This is regardless of UDP or TCP. If you don't have any budget to speak of, I'd suggest doing a Minecraft: Just distribute the server software and let people set up their own servers. For playing over LAN, it'll be easy, and it gives people a chance to test the game. If it's good, some people will bother to set up servers that can be reached online.
Probably the best choice. But people could just take down their firewalls for testing, or, better yet Windows does allow you to chose which programs can pass the firewall. I don't know for sure but OSX and some Linux Distros should allow it as well.
OS Firewalls aren't the problem, router firewalls/port forwarding are. Those are configurable too, but it's harder and if you're unlucky your ISP still doesn't let you have incoming traffic.