I

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Gosadaque
Prole
Posts: 2
Joined: Sat Dec 10, 2016 12:02 pm

I

Post by Gosadaque »

a
Last edited by Gosadaque on Wed Feb 21, 2018 12:40 pm, edited 2 times in total.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: I need a tutorial for simple networking

Post by raidho36 »

Hate to bring the bad news, but networking is never easy, even when you wrap yourself with all sorts of helper tools and libraries. The tutorials that you already found were probably the easy ones - that's how much a hustle there is to undertake.

Simplest case scenario is when server has static globally reachable address. Then server opens up a host and listens to incoming connections, then accepts connections and binds virtual player objects to them, which then read out data from the sockets. Client connects to globally available address and binds that socket to a global state, through which it will send data to server and receive back from it.

You can send arbitrary data over the network and it's not constrained by anything; it's a good idea to use some protocol. You can send a string of numbers and assume they have specific meaning on either end, alternatively you can serialize data as a table with string keys for example, then reading and writing data to the network will be a lot simpler.

Revisit the tutorials you found earlier and try to get it working. That's just how it is and there's no way around it.
Gosadaque
Prole
Posts: 2
Joined: Sat Dec 10, 2016 12:02 pm

Re: I need a tutorial for simple networking

Post by Gosadaque »

Damn okay. Thought this will be the answer
Thanks for your quick reply anyway ^^
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: I need a tutorial for simple networking

Post by ivan »

I've only dabbled with networking a little, but it should be noted that setting up a server and learning how to use some sort of protocol like UDP is the easy part. Of course you want to send as little data as possible to the clients so you have to come up with some format where only the important changes in the game are passed to the clients.
Depending on the type of game you are making things get progressively more complicated. If it's a turn-based game like chess then you could probably get away with simple HTTP requests. But with action games where players can make moves at the same time, then you have to deal with the issue of concurrency. For example, clients may be synced 5-10 times per second, but you want everything on the screen to be interpolated and to move and react at 60 FPS or more.
And of course there are many small challenges like running all of the logic and validation on the server so that clients can't cheat, lobbies, matchmaking, etc.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 1 guest