Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (843)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Realtime networking architecture for space shooter  (Read 3623 times)
0 Members and 1 Guest are viewing this topic.
Offline markus.borbely

Junior Devvie

« Posted 2010-12-09 07:35:17 »


I'm thinking about writing a descent clone. That is, you fly around in your futuristic ship in a maze and blast the other players with futuristic weapons. However, when really thinking about networking, I have some problems.

* How smart is the server? Does it handle more than connections, scores and shuffling messages around.
* What is a good solution for determining hits? (bullets can be both lightspeed and "slow" (slow =~ 200 m/s)
      Should this be on the client that fired the bullet? (potential cheat problem and it works to good when the network is congested)
      Should it be on the server? (the server need to have a complete physical representation of the game, otherwise the safest solution)
      Should it be on the client that is hit? (similar problems as when it is on the client that fired the shot).
      Should it be a combination? The firing client determines the exact hit (with the 3D geometry) and the server checks that the shot is within bounds.

I am thinking something like this:
* When connected, the server tries to determine the average ping of the client. Then server tells the client the server time. Everybody knows about the server time. Every state update package includes the server time, like: "I am Here at this Time".
* Every time a client updates its state (not counting simply traveling forward) such as turning ever so slightly, it sends a message to the server to update this. The server makes sure this is reasonably (to prevent cheat) and forwards it to the other clients. Kind of like dead reckoning, but always sending updates with player input.
* All clients simulate physics.
* When a client finds that the new packet from the server mismatches with where it is in the local simulation, it is eased to the new position over a few frames. It can be that a ship collided with something static in the local simulation but the player really avoided the obstacle.
Offline dbotha

Senior Newbie

« Reply #1 - Posted 2010-12-10 09:22:55 »

If you haven't already you should probably start with reading how some FPS style games do it. I imagine they already solve a lot of your problems ('lightspeed' bullets, etc.):

Source Multiplayer Networking
Latency Compensating Methods...
Quake 3 Networking
Unreal Networking Architecture

I think you are on the right track with some of your latter points but I do have a few suggestions (although take these with a grain of salt as I have yet to implement a multiplayer fps). A completely authoritative server is a good idea as it will limit cheating. Thus it should definitely handle more than just connections and in fact should simulate the whole game. The client should only be sending user input to the server (take a look at the data structure they use in the second article); for this to work the server has to simulate everything. You can use client side prediction to make the game feel responsive to the user whilst you await the outcome of the predictions. Also I'd use UDP for the transport if you're not already.
Offline markus.borbely

Junior Devvie

« Reply #2 - Posted 2010-12-13 15:35:45 »

Thanks, I have just started reading, and it looks like a good set of links for my purpose!

Thank you!
Pages: [1]
  ignore  |  Print  

EgonOlsen (39 views)
2018-06-10 19:43:48

EgonOlsen (21 views)
2018-06-10 19:43:44

EgonOlsen (41 views)
2018-06-10 19:43:20

DesertCoockie (187 views)
2018-05-13 18:23:11

nelsongames (122 views)
2018-04-24 18:15:36

nelsongames (121 views)
2018-04-24 18:14:32

ivj94 (862 views)
2018-03-24 14:47:39

ivj94 (122 views)
2018-03-24 14:46:31

ivj94 (758 views)
2018-03-24 14:43:53

Solater (139 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!