Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Idea for physics across multiplayer games

Discussion in 'Multiplayer' started by IPete, Oct 4, 2008.

  1. IPete

    IPete

    Joined:
    May 15, 2008
    Posts:
    414
    Ok,

    I have been trying to think of a way to develop a fast paced action racing game with lets say upto 20 players.

    There would actually only be four actual players in the game - each on a different PC (the rest of the vehicles in the game would be AI controlled vehicles).

    I have been reading about physics being localised on every client and therefore physics reactions being seen incorrectly across the network on other players games.

    What if...

    ...because this is a standalone exhibit solution (i.e. just 4 PCs networked to each other), I make one player game control the first five vehicles' physics and it passes the physical responses to the other PCs as transform information via the hard wired network. The important bit is that the actual physics calculations for those five vehicles are done only on that one PC.

    Based on this idea, each of the other players PC's get to control another five vehicles - independently - each. The resultant information is passed over the network as before and so everyone sees the correct responses and only gets to have to deal with five vehicles maximum.

    Does that make sense? Am I missing anything in my thinking which would prove a probelm for me at some stage please?

    What do you think? Might that work in this instance?

    IPete2.
     
  2. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    In the end, you do it as you feel comfortable. Just remember, prediction is huge when you offset your physics to a serverside module. The way Unity is developed, you have to turn off the physics interaction on the client (players), and ALL object in your game zone (racetrack zone for instance) must have the physics interaction disabled.

    Here is the tricky part which makes this a PITA.
    A car in a racing game has the following properties that the server has to know about:

    Mesh
    Velocity
    Direction
    Orientation
    Location
    Mass


    From the direction, orientation, velocity and location, the server has to determine next location (ghost ahead of player at all times), what changes is if a player avoids the actual predicted path, so a differential taken from prediction to actual on every single game loop.

    This wholy reduces the amount of players you can have with a server side physics model. The only 2 truths the server knows is the predicted path result and the anounced path result, anything else, well, the server is just to ignorant of the player.

    HTH