Getting a server for a love2d game

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
Gunroar:Cannon()
Party member
Posts: 280
Joined: Thu Dec 10, 2020 1:57 am

Getting a server for a love2d game

Post by Gunroar:Cannon() »

Helloöooooooooooooooooo. I've been working on a game and the main aspect is multiplayer, and since I knew nothing of making a multiplayer game I had to do some research :monocle: . I found out about sock.lua, getting updates to match all clients , etc, blahblahblah, etc.
So then I got a local connection and the game ran with the server (playing as the client too) .
I've read that to get a proper server for actual use you need to pay/rent on( or make one yourself, but that costs too and is bothersome) so I don't really know how/where to start with this.
Is here a free server available for games to use?
How do you implement it in, does the server run the game or what?
Check out Dust
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow
User avatar
Xii
Citizen
Posts: 90
Joined: Thu Aug 13, 2020 9:09 pm
Contact:

Re: Getting a server for a love2d game

Post by Xii »

You need to either run the server yourself, or rent one.

To run it yourself: have a computer at home online 24/7, and run your server there. It doesn't need any screen, mouse, or keyboard (after setting it up), and can be a cheap one like a Raspberry Pi.

To rent one: pay for a cloud VPS (virtual private server) instance. Providers often allow you to choose a flavor of Linux to install.

In either case, you make the server software just like you make the client, install it on the server computer, and leave it running there. Because the server is very game-specific, you probably won't find any off-the-shelf solutions, you'll have to write it yourself.

If your game is turn-based, you can get away with a much cheaper cloud web server instance. Learn the PHP programming language and write your server with that. Have the client talk over HTTPS.
User avatar
zorg
Party member
Posts: 3091
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Getting a server for a love2d game

Post by zorg »

Xii wrote: Sat Dec 26, 2020 7:13 pm If your game is turn-based, you can get away with a much cheaper cloud web server instance. Learn the PHP programming language and write your server with that. Have the client talk over HTTPS.
Löve still doesn't have inbuilt support for SSL (and so, HTTPS); that'll make this a bit harder to do.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
Gunroar:Cannon()
Party member
Posts: 280
Joined: Thu Dec 10, 2020 1:57 am

Re: Getting a server for a love2d game

Post by Gunroar:Cannon() »

:? Thnx...so if I get this right I should rent a server (how?), and then install the game there(...how :P) and then write my own server code, I don't understand that part at all. Pls explain.
Oh, and is it possible to use p2p(peer-to-peer) instead and is it cheaper? Is that what among us uses(I don't think so, but just asking?

And concerning p2p, is there a way to do matchmaking of players without a central server (there is but all the ideas I've read about are ...confusing), so if anyone knows how it's done then pls say.
(Sorry for all the blabbing.Those are 5 question plls)
Check out Dust
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow
User avatar
Xii
Citizen
Posts: 90
Joined: Thu Aug 13, 2020 9:09 pm
Contact:

Re: Getting a server for a love2d game

Post by Xii »

zorg wrote: Sun Dec 27, 2020 5:10 am Löve still doesn't have inbuilt support for SSL (and so, HTTPS); that'll make this a bit harder to do.
Ohh yeah, damn, that's right.

There were a couple of creative solutions around the forum for that, e.g. a Steamworks library using FFI, and an operating system -dependent method. But yea that's an issue for security.
Gunroar:Cannon() wrote: Sun Dec 27, 2020 6:40 am rent a server (how?),
Google for cloud VPS or web hosting providers. Compare prices and features, pay online, and then each provider has their own web-based management panels for configuration. My website is on OVH.
Gunroar:Cannon() wrote: Sun Dec 27, 2020 6:40 am write my own server code
Essentially, your love.update() loop, but in a separate instance on another computer. Then, using the magic of the Internet, receive input from clients, and send results back. The client instances send player input to server, and then display the result.

This is, I'm afraid, not an easy task by any means.
Gunroar:Cannon() wrote: Sun Dec 27, 2020 6:40 am install the game there(...how :P)
Depends on the method and provider you choose.

If web hosting, your server needs to be written in PHP, and installation is a matter of uploading the PHP file. Usually via FTP but some providers may have a web access panel.

If VPS, then your target system is a Linux box. You'll have SSH access and must install your server program remotely from the command line. Exactly how depends on the flavor of Linux.
Gunroar:Cannon() wrote: Sun Dec 27, 2020 6:40 am is it possible to use p2p(peer-to-peer) instead and is it cheaper?
Is possible, and is cheaper (free, in fact). But is much, much more difficult to get working, and is vulnerable to cheaters.
Gunroar:Cannon() wrote: Sun Dec 27, 2020 6:40 am concerning p2p, is there a way to do matchmaking of players without a central server
Yes, but now we venture deep into experimental technology. The BitTorrent network invented the Distributed Hash Table, or DHT, expressly for this purpose, through which they do peer exchange (PEX), i.e. decentralized discovery of other clients. But this is really, really, really advanced stuff.
User avatar
Gunroar:Cannon()
Party member
Posts: 280
Joined: Thu Dec 10, 2020 1:57 am

Re: Getting a server for a love2d game

Post by Gunroar:Cannon() »

...
...thnx for answering so much.
hmmm, since I have no cash I'll try to use p2p and I did see some sites that talked about it and it did seem advanced but I saw no implementation, so those anyone have the implementation (site) of matchmaking(I already implemented p2p...kind of)
Check out Dust
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow
User avatar
Gunroar:Cannon()
Party member
Posts: 280
Joined: Thu Dec 10, 2020 1:57 am

Re: Getting a server for a love2d game

Post by Gunroar:Cannon() »

Is it possible to have a site for the game where people post the IP address of a game they want to host?
If so is it advisable?

And how do you connect to an IP address over the internet(without a hotspot)?
Check out Dust
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow
User avatar
Xii
Citizen
Posts: 90
Joined: Thu Aug 13, 2020 9:09 pm
Contact:

Re: Getting a server for a love2d game

Post by Xii »

Gunroar:Cannon() wrote: Wed Dec 30, 2020 5:31 pm Is it possible to have a site for the game where people post the IP address of a game they want to host?
If so is it advisable?
Sure, and it can be automated - i.e. a matchmaking server. If it makes your life easier, I can do this part for you.

Good thing you're thinking about security. IP addresses are pretty public, I see no serious harm that can come of this.
Gunroar:Cannon() wrote: Wed Dec 30, 2020 5:31 pm how do you connect to an IP address over the internet(without a hotspot)?
TCP or UDP sockets, as provided by LÖVE. See the reference manual. For HTTPS we need another solution, though...
User avatar
Gunroar:Cannon()
Party member
Posts: 280
Joined: Thu Dec 10, 2020 1:57 am

Re: Getting a server for a love2d game

Post by Gunroar:Cannon() »

Thnx for the replies, Xii! Being really helpfül!
Xii wrote: Wed Dec 30, 2020 11:01 pm ...
Sure, and it can be automated - i.e. a matchmaking server. If it makes your life easier, I can do this part for you.
...
Woah, for real? How @nd when?
Check out Dust
me: I don't always code but when I do it's done flawlessly.
also me:

Code: Select all

 function Gunroar:Cannon()
    for x, enemy in ipairs(self.allEnemies) do
        self:Cannon(enemy)
    end
end

Code: Select all

Lua Error: [file Gunroar.lua]:18: C stack overflow
User avatar
Xii
Citizen
Posts: 90
Joined: Thu Aug 13, 2020 9:09 pm
Contact:

Re: Getting a server for a love2d game

Post by Xii »

Gunroar:Cannon() wrote: Thu Dec 31, 2020 2:13 am Woah, for real? How @nd when?
Whenever you like. What will you use it for exactly?
Post Reply

Who is online

Users browsing this forum: No registered users and 59 guests