Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (117)
games submitted by our members
Games in WIP (563)
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 2556 times)
0 Members and 1 Guest are viewing this topic.
Offline markus.borbely

Junior Member





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

Hi!

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 Member





« 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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

BurntPizza (33 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (103 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!