I would like to create an FPS game but need to manage bandwidth on servers. What things do I need to design in to do this?
开发者_如何学PythonFor example should I use TCP or UDP?
What data do I need to send and should I compress it somehow? I'm thinking I need position, heading, pitch, firing gun boolean.Other considerations I've missed? Any help is appreciated.
Thats not true. How you can say, that all all real-time action games using UDP. You can't know, because you don't have write these games and only the networkprogrammer of these games knows, what they are using. I personally know, that 2 realtime network shooter (one of them are mmo) definitly use TCP network. Its save and better to handle. And at last. If you program UDP to make a game, you must code 80% of the protocols TCP to make your packettransfer save. So, UDP is unacceptable today.
Best Regards.
May I direct you to the best online resource I've found on this subject?
Networking for Game Programmers
I highly recommend creating a 2D networked game before you even think about making a 3D one. Once you've read Fiedler's articles, you'll have a much better idea of how to accomplish this.
Some general notes:
- All real-time action games use UDP. No exceptions.
- In order to hide client-side input lag, implement client-prediction.
- In order to hide any other lag, implement interpolation and extrapolation.
Have fun!
精彩评论