questions: making a Server in LOVE2D/ making a multiplayer game questions

General discussion about LÖVE, Lua, game development, puns, and unicorns.
steven777
Prole
Posts: 35
Joined: Tue Jul 12, 2016 4:48 am

questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by steven777 »

Hello everyone that is currently reading this. I have a question about writing a server I love 2D and to talk about the limitations centered around it. Also I'm wanting to know if its worth it for the game I'm working on.

I'm looking into creating a server system capable of housing several players on a home network to start it off an a PC(specs specified at the bottom but its really just a nice 1400$ gaming computer)

The server needs to be able to contain the game data because players change the world and everyone has to see It. The server also needs to be able to show you these changes...if not in real time... as close as I can get It.


well I'm looking into how to go about setting up such a thing and I'm finding misplaced information and in general non relevant or dead topics that have none of these questions I'm am asking...


I know I'm probably asking a question that someone else has had at some point and was wondering if someone could drop some knowledge on me. I'm in the knowledge of this forum being nice and reasonably smart.


so here are the things I'm trying to learn here today:

-- is there a way to se a Desktop to host a server?
-- can the server be written in love 2D?
-- is there a certain type of server I'm trying to create (or should base my code off of) ( game servers Vs whatever else)
-- is it even worth coding the server in love 2D or should I use something else (a program or a language)
-- will I be able to shard the universe and have up to 100 players.. minimum to get the project started.
-- where should I get stated ?



the reasons I'm asking is because we have a game that is a pretty good game and we liked the rawness of LOVE2D over other non free things and even things like corona SDK. I'm well versed in game code and working with small apps for cheating in class and such. Never delved into servers.

please leave helpful and relevant material here. These are serious questions I'm asking this community.

ps: I'm trying to get this to host 100 players or a little less for the fist edition of this game. I'm just trying t get my feet in the door to making :awesome: a MMO RPG



pc spec:
-------

CPU: 8350FX/ 8 core / 4.5ghz (AMD)
ram: 16gb
storage: HDD/SDD hybrid 2TB
gpu: 2x( R7 250X _ amd)
power: 1000 W/psu gold
rlaitila
Prole
Posts: 9
Joined: Sat Jun 08, 2013 5:33 am

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by rlaitila »

The path you are on I will say is a difficult one. Network programming is insanely difficult and you will have to do a lot of research on data packing, lag compensation, connection/session management etc. Unless you are using a A++ game engine you will not have any network primitives to get started with you will likely have to roll your own implementations on top of a network communication library.

Love2d comes with luasocket and lua-enet compiled into the runtime. Luasocket will give you tcp/udp network communications while lua-enet is udp only. I suggest researching the two libraries to get an understanding on how to get a server listening for connections, and a client connecting.

The wiki has some places for you to start:

https://love2d.org/wiki/lua-enet
https://love2d.org/wiki/socket

As for your hardware specs, honestly the processing power of your machine (cpu/ram/graphics) will not be your problem to start. You could likely run a 100 person server on a modern laptop, given you've done a good job at the following:

* Designed a efficient way to send data back/forth from client to server, ensuring you limit the number of game state updates and transfer the data in the most compact way possible (limiting bandwidth usage)
* You have sufficient bandwidth provided by your ISP (not likely) that can support 100 players at the expected average data transfer rate.

First I would focus on building really stupid simple network games, or limit your scope of your current game's multiplayer to just a handful of players. A 100 player multiplayer game is not something you just "build" it takes years of networking/algorithmic knowledge and a bunch of prior experience, not to mention the time it takes to build such a monster.

Don't let that discourage you however, start small and build up your working knowledge of networking and you will slowly get to where you want to go! Good luck happy building!
rlaitila
Prole
Posts: 9
Joined: Sat Jun 08, 2013 5:33 am

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by rlaitila »

Also, some good links to read through (even if you don't know everything they are talking about)

http://gafferongames.com/networking-for ... ogrammers/
http://www.gamedev.net/forum/15-multipl ... ogramming/
http://gamedevelopment.tutsplus.com/tut ... edev-10074

Keep hunting, there are many articles out there and I could not possibly list them all!
steven777
Prole
Posts: 35
Joined: Tue Jul 12, 2016 4:48 am

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by steven777 »

rlaitila wrote:Also, some good links to read through (even if you don't know everything they are talking about)

http://gafferongames.com/networking-for ... ogrammers/
http://www.gamedev.net/forum/15-multipl ... ogramming/
http://gamedevelopment.tutsplus.com/tut ... edev-10074

Keep hunting, there are many articles out there and I could not possibly list them all!

so I am under the impression that love 2D can not act as a server or host ? and that it takes some other lua interpreter to work.?

also no where has it stated if I had to take down fire walls to connect. nor how to connect to an IP


I found some examples here of how servers would be set up:
https://love2d.org/wiki/Tutorial:Networking_with_UDP --says that the server is coded in something other than love...
https://love2d.org/wiki/lua-enet --and this bit of code does not run... (on the same pc. I tried running both. both return an error..)

these are the broken bits of code you find related to love 2D networking when searching threw the wiki and other places around the net.



secondly I have the architecture worked out I'm just building the engine now centered around the multiplayer infrastructure.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by zorg »

You can have Löve be the server as well, though it can also be pure lua, or something else entirely.

Whether you need to allow your client through one or more firewalls, either on your OS or in your router, that's not really the scope of a game server; you'd have better luck searching for such issues and help on stackexchange.
As for how to connect to an IP, do look up how either one of Löve's built-in networking libs work. (sockets or enet)

Yes, the UDP sockets example uses lua for the server, that doesn't mean you can't go, study the code snippets, and write a server in Löve instead.
I did not try running the enet example, maybe it somehow became errorenous through the times, someone should probably check and edit it if it is indeed faulty.

Do be careful though, it's nice having a general idea about how things would work, but do factor in the fact that technical limitations might mess up your architecture quite a bit.
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.
rlaitila
Prole
Posts: 9
Joined: Sat Jun 08, 2013 5:33 am

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by rlaitila »

The articles I provided are about network programming in general, and may show examples in the author's programming language of choice.

Although you may find some love2d specific stuff in the wiki, I don't know of any love2d specific full-stack tutorial that will get you started so you will need to translate the knowledge learned from various sources into love2d.

Love2d (as in the runtime/framework) can certainly be used as a server. In fact I've done this by disabling all non-essential modules, including anything graphical/input in config.lua and was able to run my love2d server on a headless linux box (no display).

As for local or lan firewall, love2d wiki can make no recommendations on how to handle opening ports etc as it is WAY out of scope of what love2d provides. You will need to lean on your past networking experience or google search how to do port forwarding or managing your local OS firewall (windows firewall, iptables, firewalld etc). Now if your testing locally you should not need to open any ports if you setup your server to listen on localhost (127.0.0.1) and have your clients connect to localhost (127.0.0.1). Google "localhost loopback" if you want to know more about loopback addresses.

As for connecting to an IP address and port, again this is something you have to understand from basic computing concepts and is not love2d specific. This knowledge will only come from research or your past experience. Generally speaking your game will prompt the user for an IP address to input which indicates which server to connect to. Using that information (and the networking libraries I've linked to in the wiki) you can then write your net code to connect to that user supplied IP address and start passing some data.
User avatar
josefnpat
Inner party member
Posts: 955
Joined: Wed Oct 05, 2011 1:36 am
Location: your basement
Contact:

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by josefnpat »

I haven't made a thread about it, but I've been working on the experimental LoverNet: https://github.com/josefnpat/LoverNet

I've used it for DRACUL64 (LD35 game) and have done some demos. There's a wiki with quesitonable examples haha
Missing Sentinel Software | Twitter

FORCIBLY IGNORED.
<leafo> when in doubt delete all of your code
<bartbes> git rm -r *
<bartbes> git commit -m "Fixed all bugs"
<bartbes> git push
User avatar
harrison
Prole
Posts: 17
Joined: Tue Feb 03, 2015 5:24 am

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by harrison »

Also be sure to check out LogMeIn Hamachi if you want to test out your server out with friends before/instead of port forwarding it.
P.S.
Don't make your first networking game an MMO - save that for later. Start with simple little babby programs like an online chat program or pong so you can get the hang of it first.
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by zorg »

Also, using Hamachi might be "easy", but i can't recommend it (not even for testing, but moreso for released versions). You can't expect anyone to actually install it unless you create the next Minceraft, and even then, "it was optional". It also introduces some constant latency you'd really not want, if you could avoid it; and usually, you can.
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
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: questions: making a Server in LOVE2D/ making a multiplayer game questions

Post by ivan »

-- is there a way to se a Desktop to host a server?
Probably. How else are you going to test it unless you can run the server locally.
-- can the server be written in love 2D?
-- is there a certain type of server I'm trying to create (or should base my code off of) ( game servers Vs whatever else)
-- is it even worth coding the server in love 2D or should I use something else (a program or a language)
Hard to make it happen unless you understand Lua and network programming.
-- will I be able to shard the universe and have up to 100 players.. minimum to get the project started.
It's hard to find 100 playtesters to start with.
Few commercial games have that many concurrent players.
To give you some perspective, at the moment of this post, Fallout 3 peaks at around 700 and Fallout 2 peaks at 300.
The most practical way is to make a small game -
and in the rare event that people want to play your game,
you extent the gameplay to support multiplayer, etc.
No point in building features that nobody is going to use anyways.
-- where should I get stated ?
I recommend starting with a simple clone of Asteroids or Pong.
Once you have a game that works in local coop,
you can try to extend it so that it works in a network environment.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 56 guests