Page 1 of 2
Server on Love
Posted: Sun Jun 07, 2020 12:03 pm
by Sasha264
Good day!
I want to make some server-client solutions, and I wonder, can I do it with Love?
Sorry, I am not familiar with server programming, so I have some basic questions...
- There is a way to disable t.modules.graphics = false in config. Is this supposed to be used exactly for server applications? Or I got it wrong?
- Should I start with this example? https://love2d.org/wiki/lua-enet
- How can I make my server application available through the Internet? Can I buy some virtual machine and run love server application on it? Should that machine contain some GPU or something?
- What about fault tolerance (or how is it called)...? Can love application run several months without crash?
- If server application has no window, how can I manage its behavior? Should I make console visible? Or server application can still contain window with some admin GUI? Will it unreasonably consume a lot of server resources?
Re: Server on Love
Posted: Sun Jun 07, 2020 2:05 pm
by sphyrth
Re: Server on Love
Posted: Sun Jun 07, 2020 2:36 pm
by zorg
You can set t.window to false instead, so that you can run löve without a window.
You can also set the module to false as well, if the server doesn't need anything from love.graphics module.
Fault tolerance isn't really dependent on whether your app was made in löve or not, of course, if you write buggy code, it might bug out.
You can make a löve app read from and write to a console... do use a separate thread for input though.
IDK about answers to the other questions.
Re: Server on Love
Posted: Sun Jun 07, 2020 2:56 pm
by ReFreezed
You certainly can make the server-side with LÖVE, but since you won't be using most of the framework's functionality I don't think there's that much reason to do so. You could just run LuaJIT on the server if you wanna use Lua on both client and server.
Anyway, as you're saying, you can disable all graphics (and sounds etc.) in LÖVE and have the game run without a window. It's not just useful for server-side software - there are other things you can do with LÖVE that don't require a window/graphics etc., like command-line-only games, or command-line tools/scripts. (For example, I made a script that does some image processing using only ImageData.)
As for communication over the network, using ENet or Socket is fine. You can have admin functionality available through the network and your "admin program" can just be a separate client that work just like any other client. (Of course, security is of concern here.) Having a console visible is always a good idea so you can see what the program is doing. (Likewise, the program should also print out what it's doing.)
--
Some general advice if you don't have experience with server-side software is to try to make some smaller test program so you can see through experience what problems need to be solved.
Re: Server on Love
Posted: Tue Jun 09, 2020 6:25 am
by Sasha264
sphyrth,
zorg,
ReFreezed,
Thank you guys! Now I can try something about it =)
ReFreezed,
What kind of image processing are you doing with ImageData? If it's not a big secret
Re: Server on Love
Posted: Tue Jun 09, 2020 10:29 am
by ThatBonk
Someone recommended me sock.lua once from this person
https://github.com/camchenry/sock.lua .
If you don't want to handle too much on low level, this is a good way to start with, as it has the basics one needs for server-client solutions.
I can even talk to you over discord when I have some time to explain a little about it. It is not much to cover though, just an offer to help out as in me explaining it also helps to reinforce it myself.
Re: Server on Love
Posted: Tue Jun 09, 2020 12:55 pm
by ReFreezed
Sasha264 wrote: ↑Tue Jun 09, 2020 6:25 am
What kind of image processing are you doing with ImageData? If it's not a big secret
For example, combining a bunch of smaller images into a sprite sheet before releasing a game (for optimization purposes). There have also been a shader related thing where I needed to update the RGB values for transparent pixels in a specific way to solve a minor visual glitch.
Nothing exciting, in other words.
Re: Server on Love
Posted: Sat Jun 13, 2020 11:22 am
by sherryparket
I was also looking for help on the server issues. I worked on shared hosting earlier. and now i want to make my own server for my sites.
Re: Server on Love
Posted: Sat Jun 20, 2020 9:53 am
by Sasha264
@ThatBonk, sure, why not =)
ReFreezed wrote: ↑Tue Jun 09, 2020 12:55 pm
...where I needed to update the RGB values for transparent pixels in a specific way to solve a minor visual glitch.
Do you mean RGB values of
fully transparent pixels? I did some of that too ^_^
Re: Server on Love
Posted: Sat Jun 20, 2020 6:31 pm
by ReFreezed
Sasha264 wrote: ↑Sat Jun 20, 2020 9:53 am
Do you mean RGB values of
fully transparent pixels? I did some of that too ^_^
Yup. Linear filtering of textures makes it pretty much necessary to fix transparent pixels next to opaque/half-transparent pixels if you don't want a black "halo" when drawing the image at non-integer coordinates or when scaling the image (not to mention mipmaps). At least it's necessary for images created in Photoshop.