I need help understanding how to make client and servers.

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
InTheProcess
Prole
Posts: 10
Joined: Thu May 27, 2021 4:19 pm

I need help understanding how to make client and servers.

Post by InTheProcess »

(Keep in mind that I am very new to love2d and Lua)

I am making a survival game that I want to be multiplayer. I want the player to be able to host and join games. I want them to be able to join with some special key or something. How would I go about doing this?

I've heard about Sockets and stuff, but I don't understand it. There are almost no tutorials on this subject.
grump
Party member
Posts: 776
Joined: Sat Jul 22, 2017 7:43 pm

Re: I need help understanding how to make client and servers.

Post by grump »

InTheProcess wrote: Mon Jun 14, 2021 6:14 pm I've heard about Sockets and stuff, but I don't understand it. There are almost no tutorials on this subject.
Your question is too broad and can't be easily answered in a forum post. There are basic client/server examples on the LÖVE wiki though, they're not hard to find.

The rest of the internet has an infinite number of tutorials and basic documentation on how to use sockets. Not all of them target LÖVE, but the basics are always the same.

That being said: Making multiplayer games is hard and not a thing a beginner should attempt, especially not with a barebones framework like LÖVE. Frustration and failure are guaranteed.
User avatar
Gunroar:Cannon()
Party member
Posts: 413
Joined: Thu Dec 10, 2020 1:57 am

Re: I need help understanding how to make client and servers.

Post by Gunroar:Cannon() »

You could try sock.lua or share.lua/sync.lua. They both come with tutorials and the libs make it very easy.
Why can't pirates code in lua? Because they spend to much time at C! :P

-It might look like nonsense :roll: but there's so much proof.
-Some more if you pls... :? .
It has to be real then, all that talk about the end :shock: .
-How to be saved :huh:
User avatar
darkfrei
Party member
Posts: 323
Joined: Sat Feb 08, 2020 11:09 pm

Re: I need help understanding how to make client and servers.

Post by darkfrei »

I would be nice to make an example how to send and to get any Lua table via TCP and UDP.
milon
Party member
Posts: 158
Joined: Thu Jan 18, 2018 9:14 pm

Re: I need help understanding how to make client and servers.

Post by milon »

darkfrei wrote: Tue Jun 15, 2021 11:17 am I would be nice to make an example how to send and to get any Lua table via TCP and UDP.
See the wiki: https://love2d.org/wiki/lua-enet
There's some examples on that page that cover sending & receiving data. To send a table, I believe you just send the table variable (as opposed to the string used in the example). I haven't done any lua networking before, so I could be wrong.
User avatar
Xii
Party member
Posts: 105
Joined: Thu Aug 13, 2020 9:09 pm
Contact:

Re: I need help understanding how to make client and servers.

Post by Xii »

You might want to use a serialization library like Blob.lua which lets you turn a Lua table into a string, which you can then send over the network. (and turn back into a table on the other side)
togFox
Party member
Posts: 262
Joined: Sat Jan 30, 2021 9:46 am

Re: I need help understanding how to make client and servers.

Post by togFox »

I use bitser to do the same thing.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests