Multiplayer

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.
User avatar
fridays18
Citizen
Posts: 90
Joined: Tue Nov 01, 2022 3:24 pm

Multiplayer

Post by fridays18 »

I have done my best to try to understand lue-enet via the wiki and honestly im lost. Im well aware multiplayer and anything online is mind blowingly difficult but at the moment it feels like im not even on the right path, if anyone could point me in the right direction like keywords to search for, libs that could help, good tutorials, etc I would very much appreciate it!
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Multiplayer

Post by Bigfoot71 »

I recommend this library: https://github.com/Overtorment/NoobHub

With this library I made a Paper.io game where I could play it with friends, I'm still working with it on another project and this library is (relatively) very easy to use. What is difficult especially when making a multiplayer game is above all the synchronization between the players, making a good lobby / queue system (if necessary) that is not buggy, the movement of the players because the information coming from the server cannot be refreshed as many times as the number of images per second, etc...

If you need help with it, don't hesitate, I could advise you. ^^

In any case I must warn you, making a multiplayer game is not that difficult as you can hear (when you have the right tools) but it takes a lot of time to develop for it to work well. For example with my Paper.io I took as much time to develop the multiplayer system as to really develop the game.

So prepare to drink coffee or something energizing, but it's possible, I did it :D
My avatar code for the curious :D V1, V2, V3.
User avatar
fridays18
Citizen
Posts: 90
Joined: Tue Nov 01, 2022 3:24 pm

Re: Multiplayer

Post by fridays18 »

Bigfoot71 wrote: Wed Feb 01, 2023 6:27 pm I recommend this library: https://github.com/Overtorment/NoobHub

With this library I made a Paper.io game where I could play it with friends, I'm still working with it on another project and this library is (relatively) very easy to use. What is difficult especially when making a multiplayer game is above all the synchronization between the players, making a good lobby / queue system (if necessary) that is not buggy, the movement of the players because the information coming from the server cannot be refreshed as many times as the number of images per second, etc...

If you need help with it, don't hesitate, I could advise you. ^^

In any case I must warn you, making a multiplayer game is not that difficult as you can hear (when you have the right tools) but it takes a lot of time to develop for it to work well. For example with my Paper.io I took as much time to develop the multiplayer system as to really develop the game.

So prepare to drink coffee or something energizing, but it's possible, I did it :D
I appreciate the advice and kind words, Ill check out the lib and see what I can do! Thanks for pointing me in the right direction and talking about the struggles you came across so I can prep for them :)
User avatar
fridays18
Citizen
Posts: 90
Joined: Tue Nov 01, 2022 3:24 pm

Re: Multiplayer

Post by fridays18 »

Also is there any docs or tutorials on how to use it(outside of the git)?
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Multiplayer

Post by Bigfoot71 »

Unfortunately I haven't found anything personally except this old blog post explaining how to launch a real server (which is not local) available only on the way back machine, so it will only be useful to you at the end: https://web.archive.org/web/20151222131 ... 5-minutes/

But if you understood the principle presented in the Löve2D UDP tutorial then the example in the readme should be more than enough to understand how it works, it even seems to me that there is an example already written for Löve2D in the repository. (and yes he is here)

And it's certainly the easiest library to use of its kind, the principle is still the same as in the UDP tutorial, it's just a client sends a message to the server and the server dispatches it to everyone , it's up to you to put in the message who will be the target and its content.

If despite everything this library is not suitable there are others which are listed here: https://github.com/love2d-community/awe ... networking
My avatar code for the curious :D V1, V2, V3.
User avatar
fridays18
Citizen
Posts: 90
Joined: Tue Nov 01, 2022 3:24 pm

Re: Multiplayer

Post by fridays18 »

Bigfoot71 wrote: Thu Feb 02, 2023 3:24 pm Unfortunately I haven't found anything personally except this old blog post explaining how to launch a real server (which is not local) available only on the way back machine, so it will only be useful to you at the end: https://web.archive.org/web/20151222131 ... 5-minutes/

But if you understood the principle presented in the Löve2D UDP tutorial then the example in the readme should be more than enough to understand how it works, it even seems to me that there is an example already written for Löve2D in the repository. (and yes he is here)

And it's certainly the easiest library to use of its kind, the principle is still the same as in the UDP tutorial, it's just a client sends a message to the server and the server dispatches it to everyone , it's up to you to put in the message who will be the target and its content.

If despite everything this library is not suitable there are others which are listed here: https://github.com/love2d-community/awe ... networking
Thank you for all the helpful links and information!
User avatar
fridays18
Citizen
Posts: 90
Joined: Tue Nov 01, 2022 3:24 pm

Re: Multiplayer

Post by fridays18 »

I think my main question about it (/struggle) was just how to start with it, I understand the concepts but as for bash and json im kind of lost and when i type in the lines it gives I just get errors about not finding the variable (requiring the lib didnt change the error)
User avatar
Bigfoot71
Party member
Posts: 287
Joined: Fri Mar 11, 2022 11:07 am

Re: Multiplayer

Post by Bigfoot71 »

fridays18 wrote: Thu Feb 02, 2023 4:04 pm I think my main question about it (/struggle) was just how to start with it, I understand the concepts but as for bash and json im kind of lost and when i type in the lines it gives I just get errors about not finding the variable (requiring the lib didnt change the error)
You don't have to worry about JSON files yourself, they are automatically generated by NoobHub. To be able to launch the server (if that's where you're stuck) you need NodeJS and the WS library (WebSockets).

To do this here are the commands to get them (you're talking about bash so I'm going to assume you're on a Debian like distro).
  • First make sure you have access to the latest versions of the packages:

    Code: Select all

    sudo apt update
  • Install NodeJS and NPM which is the "module manager" of NodeJS (like PIP for Python or LuaRocks for Lua):

    Code: Select all

    sudo apt install nodejs npm
  • Now go to the server folder of NoobHub, open a terminal there and download the WS library:

    Code: Select all

    npm install ws
  • Once that's done you should be able to start the server like this:

    Code: Select all

    node node.js
Just a precision, you can receive errors concerning JSON files from Löve2D (I don't remember exactly the wording of these errors) this will be due, if it happens, to the fact that you send too much data than the server can only roughly managed. To overcome this problem you should increase the size allocated in memory to the server by modifying this line in the `node.js` file:

Code: Select all

buffer_size: 1024 * 16, // buffer allocated per each socket client
(obviously tried to reduce as much as possible what you send to the server, I specify it because if you come across this error it is not easy to guess it the first time)

I hope to be quite clear and precise, at the slightest problem do not hesitate! :)
My avatar code for the curious :D V1, V2, V3.
User avatar
fridays18
Citizen
Posts: 90
Joined: Tue Nov 01, 2022 3:24 pm

Re: Multiplayer

Post by fridays18 »

Bigfoot71 wrote: Thu Feb 02, 2023 9:33 pm
fridays18 wrote: Thu Feb 02, 2023 4:04 pm I think my main question about it (/struggle) was just how to start with it, I understand the concepts but as for bash and json im kind of lost and when i type in the lines it gives I just get errors about not finding the variable (requiring the lib didnt change the error)
You don't have to worry about JSON files yourself, they are automatically generated by NoobHub. To be able to launch the server (if that's where you're stuck) you need NodeJS and the WS library (WebSockets).

To do this here are the commands to get them (you're talking about bash so I'm going to assume you're on a Debian like distro).
  • First make sure you have access to the latest versions of the packages:

    Code: Select all

    sudo apt update
  • Install NodeJS and NPM which is the "module manager" of NodeJS (like PIP for Python or LuaRocks for Lua):

    Code: Select all

    sudo apt install nodejs npm
  • Now go to the server folder of NoobHub, open a terminal there and download the WS library:

    Code: Select all

    npm install ws
  • Once that's done you should be able to start the server like this:

    Code: Select all

    node node.js
Just a precision, you can receive errors concerning JSON files from Löve2D (I don't remember exactly the wording of these errors) this will be due, if it happens, to the fact that you send too much data than the server can only roughly managed. To overcome this problem you should increase the size allocated in memory to the server by modifying this line in the `node.js` file:

Code: Select all

buffer_size: 1024 * 16, // buffer allocated per each socket client
(obviously tried to reduce as much as possible what you send to the server, I specify it because if you come across this error it is not easy to guess it the first time)

I hope to be quite clear and precise, at the slightest problem do not hesitate! :)
Hello I apologize for the late response and misunderstanding, I am on windows I only mentioned bash because of

Code: Select all

$ nodejs node.js 
in the github setup tutorial, and since adding the next bit of code provided

Code: Select all

        hub = noobhub.new({ server = "127.0.0.1"; port = 1337; });
gave me errors I figured all that I was missing was the bash aspect, honestly I understand the concepts of how multiplayer and online data transfer works from all ive read im just lost on how exactly to start since for enet its a miracle for the client to connect to the host (ive done like 8 different tutorials lol) and for noobhub I cant figure out how to get it all booted up, btw side not I appreciate all the help youre giving me!
User avatar
fridays18
Citizen
Posts: 90
Joined: Tue Nov 01, 2022 3:24 pm

Re: Multiplayer

Post by fridays18 »

I finally figured out how to boot the server using shell, but now I have no clue how to do anything regarding connecting it to my main.lua file considering the github file is massive and theres not any info on how to require and change what on the github lol
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests