Jump to content
  • Advertisement
Sign in to follow this  
!Null

Networking A Game

This topic is 2085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement

It's an FPS


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

[quote name='!Null' timestamp='1354038870' post='5004590']
It's an FPS


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


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

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.


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

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.


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).

@!Null

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



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

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).


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
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!