Multiple clients

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
20_NickName_20
Prole
Posts: 7
Joined: Thu Apr 21, 2022 3:16 pm

Multiple clients

Post by 20_NickName_20 »

I am working on game with multiplayer

How to make it possible to connect more than 1 client?

Or how to read from multiple clients at time?
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Multiple clients

Post by togFox »

How are you currently connecting with just one client?
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Turn-based PBEM horse stable (racing) management sim: https://togfox.itch.io/horse-stable-manager
https://discord.gg/HeHgwE5nsZ
User avatar
EngineerSmith
Prole
Posts: 38
Joined: Thu Dec 02, 2021 11:38 am
Contact:

Re: Multiple clients

Post by EngineerSmith »

If it is enet, each peer on the server is it's own "client" (in server-client arch). You can get the peer from event.peer

If it is luasocket (UDP), each receivefrom return's each client's connected ip address (unique for that current connection, ip can change, and port will change on each connect)

---

If you need an enet example (for new people to enet), I wrote a chat server-client if you want to see how it handles multiple connections in a basic way https://github.com/EngineerSmith/enet-example

My multiplayer love jam game has it more complex with threads if you want to see how I handle logging in too https://github.com/EngineerSmith/love-j ... in/network
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests