What type of server should I make?

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.
Post Reply
CorruptionEX
Prole
Posts: 8
Joined: Mon Oct 21, 2013 7:55 pm

What type of server should I make?

Post by CorruptionEX »

Ok, so first off, my name is Corruption, and I just joined today. I've been using LÖVE for good amount of time, and Lua for an even better amount of time. Just wanted to say I love LÖVE, and this is my first of many posts on the forums. :awesome: Be warned, i'm known to write novels about a topic, and I don't think this one is going to be any shorter...

Ok, so to the actual question part:

I like games, but I like games with multiplayer better, and so I want to design a server that I can use for all the things I may create with LÖVE in the future (Rather than re-create the simple stuff over and over again for every project). I've actually been doing this for several other things, such as displaying scrolling text, and scaling the screen for all different size screens, but now I want to make a server that I can make modifications to when I want my game to have multiplayer. I've made one game before with what I called a 'relay-server', and it worked for what I needed it to do, but If I want to use this for multiple projects, I may need more out of it in the future than I needed then, and so I've narrowed my choices down to two different server designs, which are as follows:

A 'Relay-Server' is a server which runs as a separate LÖVE Application. It has no specific coding of the game, such as player, monsters, items, etc. All it does, it listen for new connections, keeps track of their information, and forwards any packets they send to the other clients connected to it. You can send whatever data you want, so long as you tell it who is to receive it (Everyone, a select group of people, one person, or even just to the server). It doesn't know any of the games rules, and so it doesn't have to make any kind of judgement as too if any of the data is valid or not. I'm not to worried as far as security goes, my only goal with this kind of server is to make it pass along the packets it receives as quickly and efficiently as possible, so that the other clients receive them quick enough. The clients then handle all the other interactions and logic with the data received from the other players.

or

A 'Game-Server' is a mode which a LÖVE Application can be in. An application can be switched from 'Game', to 'Game-Client', to 'Game-Server'. In 'Game' mode, the application has all networking functionality disabled, and doesn't listen for incoming packets, nor does it send any out. 'Game-Client' means that this application is a client on another 'Game-Server'. A client will make its own computations, such as its player movement, if you have pressed the attack key, and other things that rely on your own input, and send all its info to the server. Later, the client will receive the servers final decisions based on what all the other players sent, such as if a button has been pressed by any of the other players, what damage the other players did to monsters, and what monsters decided to do that tick. The clients also receive the other players basic information, such as their coordinates, direction, and some other things regarding the game. Now down to the actual 'Game-Server'. A server is actually another player, but this player gains control over most things that happen for everyone else's game session; in other words, we get final say on all random events. Say that their is a monster on our screen, and it moves randomly. If everyone else ran that monsters AI themselves, it may decide to move differently than on our game, which is a no-no. What happens is we receive what all the players tried to do, and we say if it's ok or not, and tell everyone if we said was ok. As for randomly moving monsters, we come up with a random value, and send that to all other clients for them to use. Better yet, we come up with a bunch of random numbers, and send a bunch out every so often, and we all use them when we get such an event that requires one (Although, I could probably think of some problems that may occur from that, but thats for discussion).

Ok so, in a nutshell:
a 'Relay-Server' is just a fast but stupid mail man who forwards all the mail he gets to the owner as quickly as possible. All the clients have to tell the others what's going on, Where as...
a 'Game-Server' is an actual game, doing normal game things + forwarding all basic information to other clients + semi-computing results + making decisions + sending out what events should happen, all on it's own, while still running the game for its own user. However, it isn't stupid, and know's all the games rules / databases, and could utilize them (so long as I figure out how to make that happen...)

AND THATS WHAT YOU GUYS ARE HERE FOR! (btw I'm proud of you for actually reading all that, if you didn't, then get back up there :x )

I want to know from you guys, what do you think I should try and make for my 'set of reusable code', or what I like to call my LÖVE Framework, but that's probably the wrong word for it, BUT THATS FOR ANOTHER DISCUSSION. :crazy:

One is faster, one is slower
One is easier, one is harder
One is dumber, one is smarter
One can be switched on and off, one is clunky and requires a whole application to operate (in my opinion)

If you guys could think of any pros or cons with either of these designs, list em out so I can make a better decision of which I should spend a lot of my free time perfecting and implementing. Currently I'm leaning towards the Game-Server one, but it's kinda intimidating, but would be really nice to have around for all my projects to come.

So uh, yea, get on that.... go solve my problems :ultrahappy:
═══ஜ۩CorruptionEX۩ஜ═══
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: What type of server should I make?

Post by Davidobot »

If you are aiming for a variety of different multiplayer games in different genres, I recommend you go with the Game-Server, I believe that will be more efficient and more useful to you.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
CorruptionEX
Prole
Posts: 8
Joined: Mon Oct 21, 2013 7:55 pm

Re: What type of server should I make?

Post by CorruptionEX »

Yea, I think I might just go with the Game-Server. Maybe it's just the way I explained it, but I feel it's a lot more useful than the Relay-Server. Don't get me wrong; anyone else who may read this looking for server ideas, the Relay-Server is really easy to make, and really easy to use, but I wouldn't say I would go far as to say I would use it for everything here on out.

So yea, thanks Davidobot for actually commenting. If anyone else wants their two cents in, I wanna hear it. ^^
═══ஜ۩CorruptionEX۩ஜ═══
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: What type of server should I make?

Post by T-Bone »

The optimal solution would of course be to use a different server structure for each game. Different games require different implementations and the balance between client and server can vary a lot. So no matter what option you choose, I'd say if you want to make a single piece of software for all your games, make it as general as possible to make it possible to adapt it as much as possible for each game. I hope this made sense :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 3 guests