Sign in to follow this  
!Null

Networking A Game

Recommended Posts

!Null    380
Okay so I'm taking this courses while I'm abroad and our final big project is to build a game (which is fine) and network it.

The latter is my concern. We had a lecture / lab on building a echo server in C which i got most of I guess. But now I'm not sure how I'm suppose to mold this to help me network my game.

The game is developed using a scripting language developed by the college (which has heavy hints of C++).

I'm not looking for you guys to 'do my homework for me' I'd just appreciate some step in the right direction.

If you need to know anything just let me know. Edited by !Null

Share this post


Link to post
Share on other sites
BeerNutts    4401
[quote name='!Null' timestamp='1354038870' post='5004590']
It's an FPS
[/quote]

Wait a second. From a one lecture that teaches you an Echo Server, you're supposed to know how to program an FPS networked game? I think something is missing here. Is it just a 2 player game or a true multiplayer (ie, 2 - 16)?

FWIW, creating a truly robust FPS Networked game is PRETTY FRIGGING HARD. Now, you can create a protocol that runs good over LAN, but would do poorly over the internet that's not too difficult (not too difficult for someone who understand networking protocols at least).

BTW, there's a networking forum here that has loads of information that you may want to look over all the posts there.

Share this post


Link to post
Share on other sites
!Null    380
[quote name='BeerNutts' timestamp='1354047137' post='5004647']
[quote name='!Null' timestamp='1354038870' post='5004590']
It's an FPS
[/quote]

Wait a second. From a one lecture that teaches you an Echo Server, you're supposed to know how to program an FPS networked game? I think something is missing here. Is it just a 2 player game or a true multiplayer (ie, 2 - 16)?

FWIW, creating a truly robust FPS Networked game is PRETTY FRIGGING HARD. Now, you can create a protocol that runs good over LAN, but would do poorly over the internet that's not too difficult (not too difficult for someone who understand networking protocols at least).

BTW, there's a networking forum here that has loads of information that you may want to look over all the posts there.
[/quote]

yep you got it right.

We haven't been given the exact spec yet but i get the impression that a 1v1 would be enough but even if you got a 1v1 going it would be just as 'easy' to get more players going.

If i could get it working over LAN that would at least be a step. I do know a little about networking but if I'mhonest I don't really like doing it from a programmatic stand point.

I've been looking through some of the functions and stumbled through some networking functions

[quote]
NetAcceptTCP();
NetClose();
NetConnectTCP();
NetCreateChannel();
NetCreateChannelTCP();
NetDataReady();
NetGetIP();
NetReceiveFrom();
NetReceiveFromTCP();
NetSendTo();
NetSendToTCP();
NetSetMulticastIP();
NetVarReceiveFrom();
NetVarReceiveFromTCP();
NetVarSendTo();
NetVarSendToTCP();
[/quote]

Also thanks I might move the post over. And i'll have a look a look through there too.

Share this post


Link to post
Share on other sites
BeerNutts    4401
[quote name='!Null' timestamp='1354047514' post='5004651']
We haven't been given the exact spec yet but i get the impression that a 1v1 would be enough but even if you got a 1v1 going it would be just as 'easy' to get more players going.
[/quote]

That's not really true at all. If you know you're making a 2 player game (1v1), then you wouldn't (or at least I wouldn't) waste time on making it client server, you should just make it peer-to-peer.

If it were me, and for a school project (with a strict deadline), I'd design the 1v1 FPS game like this:
Every update sent will include the players position and velocity. If nothing substantial happens (player is just moving), then you send an update every x milliseconds (say 100 mS) to the remote player.
The Clients sends immediate updates for actions (Bullet Fired, item picked-up, bullet hit).
So, when one client gets an update from the other player, he ensures the player is where he's supposed to be, and gives him his current velocity. If a special action occurs, like bullet fired, he puts the bullet into his local world and starts to move it.

All bullet hits happen locally (so, if the local player see it hit himself, it happens, but if the local player see the bullet hit the remote player, it may not, if that remote player has actually moved on his local machine).

Anyway, that's the general idea I'd start with since it's fairly simple and shouldn't be too difficult to implement in a short amount of time. Of course, there are tons of other ways you could do this, and mine may not even be the bets for this situation, but just one I thought of.

Good luck.

Share this post


Link to post
Share on other sites
[quote name='BeerNutts' timestamp='1354051866' post='5004683']
That's not really true at all. If you know you're making a 2 player game (1v1), then you wouldn't (or at least I wouldn't) waste time on making it client server, you should just make it peer-to-peer.
[/quote]

You say that as if making it "peer-to-peer" would be easier than establishing a client-server model. In my experience, it's the other way around; If you run the game on the server, and treat clients as dumb input/output terminals, you greatly simplify the architecture of the network system, and there's a whole class of problems that you don't have to worry about (like cheating, or overly ridiculous sync issues).

[b]@!Null[/b]

I have a video tutorial that demonstrates how one could design and implement a relatively simple networking system:

http://www.youtube.com/watch?v=4xZRfzOtxzA

I'm doing this within the blender game engine, using python, but the concepts are the same no matter what languages/platforms you use.

Hope that helps

Share this post


Link to post
Share on other sites
BeerNutts    4401
[quote name='Goran Milovanovic' timestamp='1354128116' post='5005025']
You say that as if making it "peer-to-peer" would be easier than establishing a client-server model. In my experience, it's the other way around; If you run the game on the server, and treat clients as dumb input/output terminals, you greatly simplify the architecture of the network system, and there's a whole class of problems that you don't have to worry about (like cheating, or overly ridiculous sync issues).
[/quote]

In my experience (having done both), I think it is easier to do p2p for 1v1 games, but that may not be the case with everyone. Hopefully, by the time the OP has to start developing it, he'll have a grasp on doing either method and can choose which he wants. BTW, I don't think he's going to be concerned with cheating for a class project.

I'll have to check out your video, it looks interesting, thanks!

Share this post


Link to post
Share on other sites
!Null    380
Thanks guys for all the support. I'll continue to try to make this work and when I'm done i'll post the result (after its submitted otherwise It wont get marked at all)

Goran Milovanovic
Thanks I'll have a look at it :)

Share this post


Link to post
Share on other sites
BCullis    1955
[quote name='!Null' timestamp='1354047514' post='5004651']
I've been looking through some of the functions and stumbled through some networking functions

(list of functions)
[/quote]

I think there's a big assumption being overlooked here: they're using an academic-proprietary scripting language. That may well remove a lot of the complexity of the task depending on how the script-hooked methods are designed.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this