(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.
I need help understanding how to make client and servers.
-
- Prole
- Posts: 11
- Joined: Thu May 27, 2021 4:19 pm
Re: I need help understanding how to make client and servers.
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.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.
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.
- Gunroar:Cannon()
- Party member
- Posts: 1143
- Joined: Thu Dec 10, 2020 1:57 am
Re: I need help understanding how to make client and servers.
You could try sock.lua or share.lua/sync.lua. They both come with tutorials and the libs make it very easy.
Re: I need help understanding how to make client and servers.
I would be nice to make an example how to send and to get any Lua table via TCP and UDP.
Re: I need help understanding how to make client and servers.
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.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Re: I need help understanding how to make client and servers.
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)
Re: I need help understanding how to make client and servers.
I use bitser to do the same thing.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
Who is online
Users browsing this forum: kov_serg and 2 guests