Networking my game. Best Approach?

BlitzMax Forums/BlitzMax Programming/Networking my game. Best Approach?

Richard Betson(Posted 2010) [#1]
I am admittedly a little under educated on the best approach in constructing a client-server scheme. So here is a short list of what I would like to accomplish:

* I would like to be able to have my server support 100 or more clients.

* I need to have robust security to prevent cheating.

* I would like to setup a server that runs on a users home computer.

* I would like to have a master server (or maybe php) to list available servers.

* I am considering using 'enet'. Is the best approach?


So, any advice on how to go about this would be appreciated. Even in general terms. I am not totally in the dark here, But I could use some guidance. :)

You can check out my project Phoenix SS (a SubSpace remake) here to see what kind of game I am developing.

Client/server video: http://www.youtube.com/watch?v=WH_hkTN7RL4
Level Editor: http://www.blitzmax.com/Community/posts.php?topic=92648

Thanks,


Mr. Write Errors Man(Posted 2010) [#2]
Have use considered using email?


Richard Betson(Posted 2010) [#3]
Email (mailto) as in PHP kind of setup? This would work for the list of servers part, but would it also work for team/league stats? Could other servers gain access to posted data.


Czar Flavius(Posted 2010) [#4]
Is this a "real time action" game? If you are considering email, I guess not. By real time I mean player actions need to be transmitted to other players within a second for the game to be playable.


Richard Betson(Posted 2010) [#5]
No this is very real-time. Much action! :)


_Skully(Posted 2010) [#6]
Hopefully you thought about the networking aspect in your design. Trying to inject networking code into a game developed for stand-alone play can be very difficult or in some cases nearly impossible without significant re-writes

I believe Brucey has a library for networking that is very good (from what I've heard)


Richard Betson(Posted 2010) [#7]
Yes I thought about networking from the start. I wrote my own engines for physics/inertia, collision, map and alike. So I'm at a point were implementation of networking code is easy from the stand point of my design. In fact I setup a listener server for the video demo. So I basically have one application (Game) that will function as both a server or a client, just for testing purposes.

I used Gnet which I like because of it's simplicity, but I think it might be to limited. I do like it's object approach though. What does everyone think of Gnet? Lame? Cool?

I also read somthing on Brucey's net library. I'll check it out, but I would like long term support for future development as I expect this remake of SubSpace will require it.

@All
If you have never seen of SubSpasce look here:
http://www.ssgn.net/

...and my forum there:
http://forums.ssgn.net/index.php?showforum=510

Thanks!

Last edited 2010


Czar Flavius(Posted 2010) [#8]
One word: RakNet. It's been used in professional commerical games and I can vouch that it's very reliable and has a ton of features. It's not easy to get into, but you won't be disappointed by its limitations either. It's solid.


Richard Betson(Posted 2010) [#9]
Yes but no mod for it. That I know of.

Last edited 2010


Ole JR(Posted 2010) [#10]
It's on Brucey's list of mods, if you don't mind using svn..
Check out http://maxmods.googlecode.com

Last edited 2010


Gabriel(Posted 2010) [#11]
http://repeatuntil.free.fr/raknet/ ?


Richard Betson(Posted 2010) [#12]
@ Ole Jr
I see it listed on his page but I am not sure where to download it at ( svn? ). OMG, Realtime Voice Communication. I have to have it! Where.. where :)

Thanks

Last edited 2010


Tibit(Posted 2010) [#13]
I just finished my network library: https://sites.google.com/site/tnetsite/ <-- TNet 3.0

It's very handy and has a reliable-udp implementation based on the quake3-model so it's meant for action games, like yours, and mine. Solid connection handling on top of that and clock-sync. It's quite easy to use, if you do decide to use it feel free to mail support errands to patrix@... since the documentation is not fully completed, but all features are tested. It doesn't have voice-chat though :)

For example you can setup multiple-clients (and servers) in one app, you can add any kind of fake-latency and packet-drop to each, so that it's extremely nice to test.

And you can send "out of connections" so setting up a server-List and stuff like that is really hassle free. And yeah, it's free and open source so you can compile on "any" platform.

Last edited 2010


Ole JR(Posted 2010) [#14]
Yes you have to use SVN. (and also be able to compile mods)

http://maxmods.googlecode.com/svn/trunk/ (direct link to the svn repo)

Oh, and to get the, me think optional, raknetvoicefmod.mod to build, you also need his fmod.mod.


Last edited 2010

Last edited 2010


xlsior(Posted 2010) [#15]
And keep in mind: fmod isn't free to use in commercial games, you'd need to get a license if that what you're making.


Richard Betson(Posted 2010) [#16]
@Tbit
Wow!.. Looks very cool! Looking it all over now. Any chance of real-time voice communication?

@Ole Jr
Awesome... I'll give it a go.

@xlsior
I wonder what the license fee is for commercial use? Even though I expect to keep Phoenix SS free of cost, I will be using all of the back end (engines/systems) for other game applications that will be commercial.

Thanks to all! Very helpful.

Keep it coming:)


xlsior(Posted 2010) [#17]
I wonder what the license fee is for commercial use? Even though I expect to keep Phoenix SS free of cost, I will be using all of the back end (engines/systems) for other game applications that will be commercial.


It's pretty spendy, unfortunately:

http://www.fmod.org/index.php/sales

fmod commercial license: licensed per game, $6,000 for the first platform and $3,000 for each additional platform.

fmod casual license: (for games that are <$20 and have only electronic distribution, no physical media sales): $3,000 for the first platform, $1,500 for each additional platform.

[b[Free[/b] for non-commercial use.



Xaron(Posted 2010) [#18]
Richard, I just updated the RakNet mod from repeatuntil to the latest version 3.8.2: http://www.blitzbasic.com/Community/posts.php?topic=72982#1059287

edit: I just see that Brucey's RakNet wrapper is also almost up to date. Might be the better option, I don't know.

Last edited 2010


Leon Drake(Posted 2010) [#19]
I personally love vertex's bnet module

http://vertex.dreamfall.at/projects.php#bnetex


Richard Betson(Posted 2010) [#20]
@Xaron
On it. Checking it out. It's Thanks Giving weekend here so probably get to it Monday.

@Leon Drake
I will check it out.

@All
I have posted the Phoenix SS client here:
http://forums.ssgn.net/index.php?showtopic=25221

Thanks!

Last edited 2010


Richard Betson(Posted 2010) [#21]
I have copies of everything now and am going through them (uhg).

I am also looking for doc's on the best way to setup a client and server. For example I am thinking of having the client send data on ship/bullet position to the server and having the server resend that information to the other clients. Letting the server sorta referee who dies and who lives. :)

Any links on setting this all up would be much appreciated.

Thanks


Galaxy613(Posted 2010) [#22]
I was thinking about that and that is a very important thing that you need to figure out. It's called Dead Reckoning I think, the best way would be is to ASK the server to move your ship, and then it updates everyone *Within Range* of your new position/rotation.

IMHO, the cilents should be more or less terminals to a "player" object on the server. The cilent should make requests of the server, and the server should make sure the requests are reasonable. The less you send to the cilent the better, that way people can't hack into the socket and create a special Minimap or sniff other stuff they shouldn't see.


Leon Drake(Posted 2010) [#23]
yes, another approach i found that helps with positioning players is instead of sending the players rotation and position over and over. only send the position when the player begins to move, if you know the speed in which the player travels you can have the server calculate how far the player is going and send it to the other players, then you really only need to resend the position or rotation when the player stops or turns. this lessens the load of information being sent since if you know a player is going to go one direction while they are holding down up for instance there is no reason to keep resending position until the player changes his movement in some way.


Richard Betson(Posted 2010) [#24]
Very good!

This is what I need to know. I had thought along similar lines to both your comments. I can indeed set it up the way you are both suggesting. SubSpace was apparently hacked pretty hard back in the day and the community is sensitive to cheating/hacks. So I really what to have my security as bullet proof as possible. Which is why I am considering Raknet , although I still have not found Brucey's mod yet. But the others have fairly good security too.

I'm at the point where I have to decide all of this so your input is very valuable. Setting up the client server scheme/topology is a little new (for large scale) to me so more please. :)

Thnaks!


Tibit(Posted 2010) [#25]
In general you want to server to be in control of the positions, and correct any player that miss-steps, however each player freely simulates their movement. So would the server go down for example, the player can move around freely on the map, however once connected again, the player will "teleport" to the position the server last saw the player at.

Also for really solid dead-reckoning you want to send not only position but also input - what keys are being hold down.

Missiles and shots might need to be handled separately, since they travel so fast that they need to be in sync somehow. One way to do that is to add a delay when you fire, but sending the packet right away, then waiting to release the bullet til you receive a response from the server.