Jump to content
  • Advertisement
Sign in to follow this  
TrueFurby

2DFPS - Client/Server Architecture

This topic is 2753 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

Ok, so here's the thing.. I decided to make a small simple 2D game where you see your character from top, you join the game, you choose your team, you are in some kind of arena and you can shoot other players, you can die and all players respawn when one team dies. That's all. Basically something like Counter Strike.

Though I don't want to start (I have done some simple games like Tetris before so I have some basic idea how to do the graphics and stuff) before I plan my client/server architecture.

What I will be using-
  • SDL for graphics
  • SDL_net for networkingFor communication I will definitely use UDP protocol, because it's action game, speed is main factor. Then I want to use only client-server communication no, peer-to-peer communication to keep it simpler (in some cases doesn't mean it's simpler but whateva). I have a pc where the server will be hosting the game all the time and anyone can join anytime.

    The things I am totally unsure how to do are things like movement, rotation, shooting, collision etc. through network, I've read some books and some articles about it but it's still not clear for me.

    For example movement. When you press some arrow button you automatically start moving on your pc and send instant request to server to change velocity if server approves you continue moving if it denies you will get back where you where... I guess it would be same with rotation.

    But what if will the packet where you change your rotation get lost? Solution for this should be the periodic 10-times-per-second update to server about your x/y/rot/vel..?

    Then shooting. You should, you send packet to server about it, it sends the packet to all other clients and they will create to bullet at the position you shot it at and the rest of the moving will happen it theirs pcs, again the same problem this packets will get lost or will arrive with delay and what? No bullet? Maybe someone will not die.

    Should there be something like.. you shoot, requests the permission from server if it approves it continues and if not bullet disappears and when the server receive request it automatically sends the packet to all other clients..

    Collision. I guess the server also needs all the data about map and objects in it, since server cannot afford to trust clients with the data, because if you only sends data about your x/y then you could go even through walls with little editing of your client or editing the packets sent, so with every 10-times-per-second update you check if this position is "walkable", and if it's not like thousand leagues from the last points so you don't have some kind of "teleport", another method against cheating, and if the position is good servers approves and you will move there (actually you will not move back, since you are still moving in your pc).

    Well that's all what bothers me now.

    I will be grateful to see some nice constructive answers!

    Thanks in advance for you help. =)

Share this post


Link to post
Share on other sites
Advertisement

Ok, so here's the thing..
...
I will be grateful to see some nice constructive answers!


Try reading the "FAQ" that's linked at the top of the forum. It has a wealth of links, that include links addressing these questions.
(The Source networking and Quake networking links might be a good place to start, for example)

Share this post


Link to post
Share on other sites

[quote name='True Furby' timestamp='1299689748' post='4783613']
Ok, so here's the thing..
...
I will be grateful to see some nice constructive answers!


Try reading the "FAQ" that's linked at the top of the forum. It has a wealth of links, that include links addressing these questions.
(The Source networking and Quake networking links might be a good place to start, for example)
[/quote]

Okay thanks. Btw.. one of the links there is broken, 404 for me.

....Q12) What should I put in my network packets, and how often should I send them?
A12) That depends on your goals and your game.
For an FPS style game, you might want to read about how Quake III,....[/quote]

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!