how does the grenade launcher bullet network work?

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators


  • Hi

    Can anyone discuss to me what happens when a player fires a grenade launcher?

    Does the flow looks someting like:

    1. client tag each bullet with an id and immediately sends network message that he has just fired
    2. server receives fire message from client, adds it to a master list of bullets
    3. every 50 ms server broadcasts all bullet positions, and resolves any collisions (with players and geometry)
    4. each client receives updated bullet positions from server and renders them correctly. If the grenade hits or its timer has expired, it explodes. all of these info came from the server.

    And if someone knows where all the network code is in the source please do point it out.

    Thanks.
    David Ang
    mickey
    Newbie
     
    Posts: 5
    Joined: Thu Feb 26, 2009 4:20 pm

Tue Mar 03, 2009 8:02 am

  • For 2.4.2 this is true, except that the client just sends an input message (button pressed), and the server generates the ID (entity number).

    In 2.4.2:

    1. client sets a button flag to 1 and sends an input packet
    2. server sends a network message of the grenade's creation (with an ID)
    3. server calculates the grenade position every 50ms, and sends it to the client
    4. finally, server sends a destroy message for the grenade to the client, and sends a particle effect and a sound message to the client too

    In 2.5, it is:

    1. client sets a button flag to 1 and sends an input packet
    2. server sends a network message of the grenade's creation (with an ID)
    3. server calculates the grenade position every 50ms, but does not send it (unless it's influenced by e.g. a jumppad)
    4. client calculates the grenade position every render frame, and shows it
    5. finally, server sends a destroy message for the grenade to the client, and sends a damage message to the client too, which the client will use to draw the explosion

    So the difference is:

    - In 2.5, the position isn't resent each frame.
    - In 2.5, the sound and particle effect are in one message
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Tue Mar 03, 2009 11:08 am

Tue Mar 03, 2009 9:11 pm

  • divVerent wrote:5. finally, server sends a destroy message for the grenade to the client, and sends a damage message to the client too, which the client will use to draw the explosion


    thanks for the response guys. Does #5 also mean that calculating if a player has been hit is also done in the server and sends the clients if someone is hit?

    How about collision with the geometry? I think this can be done by each of the clients - ie, no network message needs to be sent here.
    David Ang
    mickey
    Newbie
     
    Posts: 5
    Joined: Thu Feb 26, 2009 4:20 pm

Wed Mar 04, 2009 6:58 am

  • Collision with geometry is partially detected by the client (for bouncing, or stopping at the end of the shot). But the exact point is calculated by the server, just as well as whether someone is hit, to prevent cheating by using a manipulated client.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE



Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest