Architecture of networked game engineMultiplayer architecture in games like Diablo 2How to network this entity system?Server architecture software sidePassing a list of existing entities to a new client when using a component system?UDP Netcode Architecture for Fighting GameEntity Component Architecture and Scripting without using threadsHow would a game-state snapshot system be implemented for networked real-time games?Is there a pattern for handling multiple game states?server/client architecture, how to combine physics data, scene graph and database over the network?Multiplayer game servers architecture

Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?

Analog is Obtuse!

Does Marvel have an equivalent of the Green Lantern?

How often can a PC check with passive perception during a combat turn?

How could mana leakage be dangerous to a elf?

Should my manager be aware of private LinkedIn approaches I receive? How to politely have this happen?

Does image quality of the lens affect "focus and recompose" technique?

Should I include salary information on my CV?

How come I was asked by a CBP officer why I was in the US?

In the Marvel universe, can a human have a baby with any non-human?

Fitting a mixture of two normal distributions for a data set?

Does squid ink pasta bleed?

Why does the numerical solution of an ODE move away from an unstable equilibrium?

How should I behave to assure my friends that I am not after their money?

Why does the A-4 Skyhawk sit nose-up when on ground?

How risky is real estate?

Inverse-quotes-quine

Intuitively, why does putting capacitors in series decrease the equivalent capacitance?

Alphabet completion rate

Can a US President have someone sent to prison?

What can I do to find new work while my workplace is closed due to an accidental death?

Architecture of networked game engine

What do you call the action of someone tackling a stronger person?

Content builder HTTPS



Architecture of networked game engine


Multiplayer architecture in games like Diablo 2How to network this entity system?Server architecture software sidePassing a list of existing entities to a new client when using a component system?UDP Netcode Architecture for Fighting GameEntity Component Architecture and Scripting without using threadsHow would a game-state snapshot system be implemented for networked real-time games?Is there a pattern for handling multiple game states?server/client architecture, how to combine physics data, scene graph and database over the network?Multiplayer game servers architecture






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


So after working on my game engine for 2 years, I´ve decided to step into the networking environment. I just don´t know if its good idea to rewrite the engine, or how much work it will take (but still want to try it). I´m little bit confused by some approaches, so thats why I´m here.



In short I have an architecture like this:
There is a main object, that controls the whole engine world(physics steps, rendering, audio, input, entities). Then there is a Game instance that is running inside the loop and "creating the content of the game".



I already started with ENet, created a small console chatting app - but packets were just strings. But I´m not sure if I understand the concept of game networking, so here is my idea:



There is a server and clients. Server is controlling everything. Client sends messages.



So basically:
When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



Am I right?



So basically, clients does not have anything, except input controller and keyboard. So when they press keys, action is done. And rendering for the scene render, but all they receive is just a "image" of the scene from the server? Or is there something I miss?



Thanks in advance.



Edit1
And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?










share|improve this question











$endgroup$











  • $begingroup$
    As illustrated by Bram's answer, whole books are written on the topic. You could narrow the scope of your question to a specific issue. Also, the type of architecture that you'll implement could be influenced by the type of game you'll produce.
    $endgroup$
    – Alexandre Vaillancourt
    7 hours ago










  • $begingroup$
    Actually, I couldn´t specify my issue, because my problem was the design of the whole hierarchy. However, at least got a little light on the problem, so maybe solution is closer than i thought. Anyway, do you have any good book for this topic as a recommendation? Thanks.
    $endgroup$
    – Pins
    3 hours ago

















3












$begingroup$


So after working on my game engine for 2 years, I´ve decided to step into the networking environment. I just don´t know if its good idea to rewrite the engine, or how much work it will take (but still want to try it). I´m little bit confused by some approaches, so thats why I´m here.



In short I have an architecture like this:
There is a main object, that controls the whole engine world(physics steps, rendering, audio, input, entities). Then there is a Game instance that is running inside the loop and "creating the content of the game".



I already started with ENet, created a small console chatting app - but packets were just strings. But I´m not sure if I understand the concept of game networking, so here is my idea:



There is a server and clients. Server is controlling everything. Client sends messages.



So basically:
When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



Am I right?



So basically, clients does not have anything, except input controller and keyboard. So when they press keys, action is done. And rendering for the scene render, but all they receive is just a "image" of the scene from the server? Or is there something I miss?



Thanks in advance.



Edit1
And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?










share|improve this question











$endgroup$











  • $begingroup$
    As illustrated by Bram's answer, whole books are written on the topic. You could narrow the scope of your question to a specific issue. Also, the type of architecture that you'll implement could be influenced by the type of game you'll produce.
    $endgroup$
    – Alexandre Vaillancourt
    7 hours ago










  • $begingroup$
    Actually, I couldn´t specify my issue, because my problem was the design of the whole hierarchy. However, at least got a little light on the problem, so maybe solution is closer than i thought. Anyway, do you have any good book for this topic as a recommendation? Thanks.
    $endgroup$
    – Pins
    3 hours ago













3












3








3


1



$begingroup$


So after working on my game engine for 2 years, I´ve decided to step into the networking environment. I just don´t know if its good idea to rewrite the engine, or how much work it will take (but still want to try it). I´m little bit confused by some approaches, so thats why I´m here.



In short I have an architecture like this:
There is a main object, that controls the whole engine world(physics steps, rendering, audio, input, entities). Then there is a Game instance that is running inside the loop and "creating the content of the game".



I already started with ENet, created a small console chatting app - but packets were just strings. But I´m not sure if I understand the concept of game networking, so here is my idea:



There is a server and clients. Server is controlling everything. Client sends messages.



So basically:
When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



Am I right?



So basically, clients does not have anything, except input controller and keyboard. So when they press keys, action is done. And rendering for the scene render, but all they receive is just a "image" of the scene from the server? Or is there something I miss?



Thanks in advance.



Edit1
And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?










share|improve this question











$endgroup$




So after working on my game engine for 2 years, I´ve decided to step into the networking environment. I just don´t know if its good idea to rewrite the engine, or how much work it will take (but still want to try it). I´m little bit confused by some approaches, so thats why I´m here.



In short I have an architecture like this:
There is a main object, that controls the whole engine world(physics steps, rendering, audio, input, entities). Then there is a Game instance that is running inside the loop and "creating the content of the game".



I already started with ENet, created a small console chatting app - but packets were just strings. But I´m not sure if I understand the concept of game networking, so here is my idea:



There is a server and clients. Server is controlling everything. Client sends messages.



So basically:
When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



Am I right?



So basically, clients does not have anything, except input controller and keyboard. So when they press keys, action is done. And rendering for the scene render, but all they receive is just a "image" of the scene from the server? Or is there something I miss?



Thanks in advance.



Edit1
And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?







c++ game-design architecture networking






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 9 hours ago







Pins

















asked 9 hours ago









PinsPins

2521 silver badge13 bronze badges




2521 silver badge13 bronze badges











  • $begingroup$
    As illustrated by Bram's answer, whole books are written on the topic. You could narrow the scope of your question to a specific issue. Also, the type of architecture that you'll implement could be influenced by the type of game you'll produce.
    $endgroup$
    – Alexandre Vaillancourt
    7 hours ago










  • $begingroup$
    Actually, I couldn´t specify my issue, because my problem was the design of the whole hierarchy. However, at least got a little light on the problem, so maybe solution is closer than i thought. Anyway, do you have any good book for this topic as a recommendation? Thanks.
    $endgroup$
    – Pins
    3 hours ago
















  • $begingroup$
    As illustrated by Bram's answer, whole books are written on the topic. You could narrow the scope of your question to a specific issue. Also, the type of architecture that you'll implement could be influenced by the type of game you'll produce.
    $endgroup$
    – Alexandre Vaillancourt
    7 hours ago










  • $begingroup$
    Actually, I couldn´t specify my issue, because my problem was the design of the whole hierarchy. However, at least got a little light on the problem, so maybe solution is closer than i thought. Anyway, do you have any good book for this topic as a recommendation? Thanks.
    $endgroup$
    – Pins
    3 hours ago















$begingroup$
As illustrated by Bram's answer, whole books are written on the topic. You could narrow the scope of your question to a specific issue. Also, the type of architecture that you'll implement could be influenced by the type of game you'll produce.
$endgroup$
– Alexandre Vaillancourt
7 hours ago




$begingroup$
As illustrated by Bram's answer, whole books are written on the topic. You could narrow the scope of your question to a specific issue. Also, the type of architecture that you'll implement could be influenced by the type of game you'll produce.
$endgroup$
– Alexandre Vaillancourt
7 hours ago












$begingroup$
Actually, I couldn´t specify my issue, because my problem was the design of the whole hierarchy. However, at least got a little light on the problem, so maybe solution is closer than i thought. Anyway, do you have any good book for this topic as a recommendation? Thanks.
$endgroup$
– Pins
3 hours ago




$begingroup$
Actually, I couldn´t specify my issue, because my problem was the design of the whole hierarchy. However, at least got a little light on the problem, so maybe solution is closer than i thought. Anyway, do you have any good book for this topic as a recommendation? Thanks.
$endgroup$
– Pins
3 hours ago










2 Answers
2






active

oldest

votes


















4












$begingroup$

TLDR - start simple and build up. Getting to AAA quality networking in an action game is complicated but may not even be necessary for your game.




So basically: When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



Am I right?




Basically, yeah. There are multiple networking architectures, but the common server-authoritative model used in most real-time action games follows that model.



As Bram noted in comments, though, the client typically does have more work to do to overcome network latency even for non-twitch games. The simplest version is to make sure the client acknowledges input before waiting for the server response. Even your Web browser does this (clicking a link animates right away even though it might take some time for the new page to load).



Likewise, the server might have to do a lot of work to overcome the latency as well, depending on the type of game. The server has to keep in mind that by the time it receives any input from the client(s), the player had actually entered that input many milliseconds ago. A common approach is to use object history buffers so the server can simulate "back in time" based on its estimate of when the input was actually pressed on the client.



Going back to the client, some deeper prediction can be required for inputs. For example, a client might immediately respond to input and move, but then adjust that movement based on the eventual response from the server. Various techniques can be applied to smooth over the times when the server response contradicts the client prediction.



Further, the client can't just apply movements from the server for other objects, because that would cause objects to only move when packets come in. A client might have its own small history buffer of positions from the client and smoothly interpolate between them; or the client might extrapolate and predicate movement (though this will result in frequent rubber-banding in many games).



When local player A observes remote player B, local player A can see their own inputs immediately. However, remote player B's movements will be delayed by the time it takes for B's input to get to the server and then back down to player A's client. Every player sees a very stale version of every other player, which can be problematic for games where players are meant to interact at close range frequently. This often just relies on the actual game design avoiding creating situations where this can matter much, as well as on history buffers and the like.



There's a whole 'nother topic about timing and syncing of certain kinds of action, where you might want all players see an ability activate simultaneously despite network latency. Actions might have a warmup animation that is compressed on remote clients so that everyone sees the action happen at near the same instant despite the network latency.



I recommend that you look at the classic Halo GDC talk https://www.youtube.com/watch?v=h47zZrqjgLc.




Edit1 And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?




That depends a bit on what you mean by "physics."



Typically, the server is only going to do physics on objects that affect gameplay. This is both to cut down on server processing costs (physics is CPU intensive) and to cut down on bandwidth costs (synchronizing every little piece of rubble would use a lot of bandwidth).



Depending on the game, the server might do almost no real physics (just very basic capsule movement and ray casts); or the server might do full physics on a small class of objects (set pieces that can move and players can stand on or hide behind); or the server might do full physics on a variety of objects (for games where the environment is highly interactive and can be used against other players).



All the rest of the physics will be done purely on the client. Small debris, background objects, VFX physics, etc. The result will be physics objects that will interact naturally with each other but will be non-collidable or weightlessly pushed around by any server-authoritative objects (like players).



The short version of that being that both server and client need to do "physics" of some variety, but typically on different sets of objects. The client will still apply positions/velocities from server objects into its local sim but can't apply any counter-force (these are typically called "kinematic" objects in most physics libraries/toolkit).






share|improve this answer









$endgroup$












  • $begingroup$
    By the physics, in my case, i ment Box2D world that is running the simulation on the bodies. But finally I understand how to start designing it. I will try first very simple try, just transfer map and movements, without prediction things. After comleting this, I will try to adapt even the client prediction and movement smoothness.
    $endgroup$
    – Pins
    3 hours ago


















1












$begingroup$

If the client has a 100ms ping to the server, then there would be a delay of at least 6 extra frames between the user pressing a button, and seeing the result, probably more.



Even adding 1 frame from double-buffered rendering causes perceivable delay.



This means that client/server gaming is a lot more complicated than this, and prediction is involved.






share|improve this answer









$endgroup$















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "53"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgamedev.stackexchange.com%2fquestions%2f173099%2farchitecture-of-networked-game-engine%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4












    $begingroup$

    TLDR - start simple and build up. Getting to AAA quality networking in an action game is complicated but may not even be necessary for your game.




    So basically: When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



    Am I right?




    Basically, yeah. There are multiple networking architectures, but the common server-authoritative model used in most real-time action games follows that model.



    As Bram noted in comments, though, the client typically does have more work to do to overcome network latency even for non-twitch games. The simplest version is to make sure the client acknowledges input before waiting for the server response. Even your Web browser does this (clicking a link animates right away even though it might take some time for the new page to load).



    Likewise, the server might have to do a lot of work to overcome the latency as well, depending on the type of game. The server has to keep in mind that by the time it receives any input from the client(s), the player had actually entered that input many milliseconds ago. A common approach is to use object history buffers so the server can simulate "back in time" based on its estimate of when the input was actually pressed on the client.



    Going back to the client, some deeper prediction can be required for inputs. For example, a client might immediately respond to input and move, but then adjust that movement based on the eventual response from the server. Various techniques can be applied to smooth over the times when the server response contradicts the client prediction.



    Further, the client can't just apply movements from the server for other objects, because that would cause objects to only move when packets come in. A client might have its own small history buffer of positions from the client and smoothly interpolate between them; or the client might extrapolate and predicate movement (though this will result in frequent rubber-banding in many games).



    When local player A observes remote player B, local player A can see their own inputs immediately. However, remote player B's movements will be delayed by the time it takes for B's input to get to the server and then back down to player A's client. Every player sees a very stale version of every other player, which can be problematic for games where players are meant to interact at close range frequently. This often just relies on the actual game design avoiding creating situations where this can matter much, as well as on history buffers and the like.



    There's a whole 'nother topic about timing and syncing of certain kinds of action, where you might want all players see an ability activate simultaneously despite network latency. Actions might have a warmup animation that is compressed on remote clients so that everyone sees the action happen at near the same instant despite the network latency.



    I recommend that you look at the classic Halo GDC talk https://www.youtube.com/watch?v=h47zZrqjgLc.




    Edit1 And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?




    That depends a bit on what you mean by "physics."



    Typically, the server is only going to do physics on objects that affect gameplay. This is both to cut down on server processing costs (physics is CPU intensive) and to cut down on bandwidth costs (synchronizing every little piece of rubble would use a lot of bandwidth).



    Depending on the game, the server might do almost no real physics (just very basic capsule movement and ray casts); or the server might do full physics on a small class of objects (set pieces that can move and players can stand on or hide behind); or the server might do full physics on a variety of objects (for games where the environment is highly interactive and can be used against other players).



    All the rest of the physics will be done purely on the client. Small debris, background objects, VFX physics, etc. The result will be physics objects that will interact naturally with each other but will be non-collidable or weightlessly pushed around by any server-authoritative objects (like players).



    The short version of that being that both server and client need to do "physics" of some variety, but typically on different sets of objects. The client will still apply positions/velocities from server objects into its local sim but can't apply any counter-force (these are typically called "kinematic" objects in most physics libraries/toolkit).






    share|improve this answer









    $endgroup$












    • $begingroup$
      By the physics, in my case, i ment Box2D world that is running the simulation on the bodies. But finally I understand how to start designing it. I will try first very simple try, just transfer map and movements, without prediction things. After comleting this, I will try to adapt even the client prediction and movement smoothness.
      $endgroup$
      – Pins
      3 hours ago















    4












    $begingroup$

    TLDR - start simple and build up. Getting to AAA quality networking in an action game is complicated but may not even be necessary for your game.




    So basically: When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



    Am I right?




    Basically, yeah. There are multiple networking architectures, but the common server-authoritative model used in most real-time action games follows that model.



    As Bram noted in comments, though, the client typically does have more work to do to overcome network latency even for non-twitch games. The simplest version is to make sure the client acknowledges input before waiting for the server response. Even your Web browser does this (clicking a link animates right away even though it might take some time for the new page to load).



    Likewise, the server might have to do a lot of work to overcome the latency as well, depending on the type of game. The server has to keep in mind that by the time it receives any input from the client(s), the player had actually entered that input many milliseconds ago. A common approach is to use object history buffers so the server can simulate "back in time" based on its estimate of when the input was actually pressed on the client.



    Going back to the client, some deeper prediction can be required for inputs. For example, a client might immediately respond to input and move, but then adjust that movement based on the eventual response from the server. Various techniques can be applied to smooth over the times when the server response contradicts the client prediction.



    Further, the client can't just apply movements from the server for other objects, because that would cause objects to only move when packets come in. A client might have its own small history buffer of positions from the client and smoothly interpolate between them; or the client might extrapolate and predicate movement (though this will result in frequent rubber-banding in many games).



    When local player A observes remote player B, local player A can see their own inputs immediately. However, remote player B's movements will be delayed by the time it takes for B's input to get to the server and then back down to player A's client. Every player sees a very stale version of every other player, which can be problematic for games where players are meant to interact at close range frequently. This often just relies on the actual game design avoiding creating situations where this can matter much, as well as on history buffers and the like.



    There's a whole 'nother topic about timing and syncing of certain kinds of action, where you might want all players see an ability activate simultaneously despite network latency. Actions might have a warmup animation that is compressed on remote clients so that everyone sees the action happen at near the same instant despite the network latency.



    I recommend that you look at the classic Halo GDC talk https://www.youtube.com/watch?v=h47zZrqjgLc.




    Edit1 And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?




    That depends a bit on what you mean by "physics."



    Typically, the server is only going to do physics on objects that affect gameplay. This is both to cut down on server processing costs (physics is CPU intensive) and to cut down on bandwidth costs (synchronizing every little piece of rubble would use a lot of bandwidth).



    Depending on the game, the server might do almost no real physics (just very basic capsule movement and ray casts); or the server might do full physics on a small class of objects (set pieces that can move and players can stand on or hide behind); or the server might do full physics on a variety of objects (for games where the environment is highly interactive and can be used against other players).



    All the rest of the physics will be done purely on the client. Small debris, background objects, VFX physics, etc. The result will be physics objects that will interact naturally with each other but will be non-collidable or weightlessly pushed around by any server-authoritative objects (like players).



    The short version of that being that both server and client need to do "physics" of some variety, but typically on different sets of objects. The client will still apply positions/velocities from server objects into its local sim but can't apply any counter-force (these are typically called "kinematic" objects in most physics libraries/toolkit).






    share|improve this answer









    $endgroup$












    • $begingroup$
      By the physics, in my case, i ment Box2D world that is running the simulation on the bodies. But finally I understand how to start designing it. I will try first very simple try, just transfer map and movements, without prediction things. After comleting this, I will try to adapt even the client prediction and movement smoothness.
      $endgroup$
      – Pins
      3 hours ago













    4












    4








    4





    $begingroup$

    TLDR - start simple and build up. Getting to AAA quality networking in an action game is complicated but may not even be necessary for your game.




    So basically: When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



    Am I right?




    Basically, yeah. There are multiple networking architectures, but the common server-authoritative model used in most real-time action games follows that model.



    As Bram noted in comments, though, the client typically does have more work to do to overcome network latency even for non-twitch games. The simplest version is to make sure the client acknowledges input before waiting for the server response. Even your Web browser does this (clicking a link animates right away even though it might take some time for the new page to load).



    Likewise, the server might have to do a lot of work to overcome the latency as well, depending on the type of game. The server has to keep in mind that by the time it receives any input from the client(s), the player had actually entered that input many milliseconds ago. A common approach is to use object history buffers so the server can simulate "back in time" based on its estimate of when the input was actually pressed on the client.



    Going back to the client, some deeper prediction can be required for inputs. For example, a client might immediately respond to input and move, but then adjust that movement based on the eventual response from the server. Various techniques can be applied to smooth over the times when the server response contradicts the client prediction.



    Further, the client can't just apply movements from the server for other objects, because that would cause objects to only move when packets come in. A client might have its own small history buffer of positions from the client and smoothly interpolate between them; or the client might extrapolate and predicate movement (though this will result in frequent rubber-banding in many games).



    When local player A observes remote player B, local player A can see their own inputs immediately. However, remote player B's movements will be delayed by the time it takes for B's input to get to the server and then back down to player A's client. Every player sees a very stale version of every other player, which can be problematic for games where players are meant to interact at close range frequently. This often just relies on the actual game design avoiding creating situations where this can matter much, as well as on history buffers and the like.



    There's a whole 'nother topic about timing and syncing of certain kinds of action, where you might want all players see an ability activate simultaneously despite network latency. Actions might have a warmup animation that is compressed on remote clients so that everyone sees the action happen at near the same instant despite the network latency.



    I recommend that you look at the classic Halo GDC talk https://www.youtube.com/watch?v=h47zZrqjgLc.




    Edit1 And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?




    That depends a bit on what you mean by "physics."



    Typically, the server is only going to do physics on objects that affect gameplay. This is both to cut down on server processing costs (physics is CPU intensive) and to cut down on bandwidth costs (synchronizing every little piece of rubble would use a lot of bandwidth).



    Depending on the game, the server might do almost no real physics (just very basic capsule movement and ray casts); or the server might do full physics on a small class of objects (set pieces that can move and players can stand on or hide behind); or the server might do full physics on a variety of objects (for games where the environment is highly interactive and can be used against other players).



    All the rest of the physics will be done purely on the client. Small debris, background objects, VFX physics, etc. The result will be physics objects that will interact naturally with each other but will be non-collidable or weightlessly pushed around by any server-authoritative objects (like players).



    The short version of that being that both server and client need to do "physics" of some variety, but typically on different sets of objects. The client will still apply positions/velocities from server objects into its local sim but can't apply any counter-force (these are typically called "kinematic" objects in most physics libraries/toolkit).






    share|improve this answer









    $endgroup$



    TLDR - start simple and build up. Getting to AAA quality networking in an action game is complicated but may not even be necessary for your game.




    So basically: When client connects to the server, server creates new entity. Now, for example, when client presses 'A', packet is sent to a server containing this information. Server will proccess it, moves the entity.



    Am I right?




    Basically, yeah. There are multiple networking architectures, but the common server-authoritative model used in most real-time action games follows that model.



    As Bram noted in comments, though, the client typically does have more work to do to overcome network latency even for non-twitch games. The simplest version is to make sure the client acknowledges input before waiting for the server response. Even your Web browser does this (clicking a link animates right away even though it might take some time for the new page to load).



    Likewise, the server might have to do a lot of work to overcome the latency as well, depending on the type of game. The server has to keep in mind that by the time it receives any input from the client(s), the player had actually entered that input many milliseconds ago. A common approach is to use object history buffers so the server can simulate "back in time" based on its estimate of when the input was actually pressed on the client.



    Going back to the client, some deeper prediction can be required for inputs. For example, a client might immediately respond to input and move, but then adjust that movement based on the eventual response from the server. Various techniques can be applied to smooth over the times when the server response contradicts the client prediction.



    Further, the client can't just apply movements from the server for other objects, because that would cause objects to only move when packets come in. A client might have its own small history buffer of positions from the client and smoothly interpolate between them; or the client might extrapolate and predicate movement (though this will result in frequent rubber-banding in many games).



    When local player A observes remote player B, local player A can see their own inputs immediately. However, remote player B's movements will be delayed by the time it takes for B's input to get to the server and then back down to player A's client. Every player sees a very stale version of every other player, which can be problematic for games where players are meant to interact at close range frequently. This often just relies on the actual game design avoiding creating situations where this can matter much, as well as on history buffers and the like.



    There's a whole 'nother topic about timing and syncing of certain kinds of action, where you might want all players see an ability activate simultaneously despite network latency. Actions might have a warmup animation that is compressed on remote clients so that everyone sees the action happen at near the same instant despite the network latency.



    I recommend that you look at the classic Halo GDC talk https://www.youtube.com/watch?v=h47zZrqjgLc.




    Edit1 And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?




    That depends a bit on what you mean by "physics."



    Typically, the server is only going to do physics on objects that affect gameplay. This is both to cut down on server processing costs (physics is CPU intensive) and to cut down on bandwidth costs (synchronizing every little piece of rubble would use a lot of bandwidth).



    Depending on the game, the server might do almost no real physics (just very basic capsule movement and ray casts); or the server might do full physics on a small class of objects (set pieces that can move and players can stand on or hide behind); or the server might do full physics on a variety of objects (for games where the environment is highly interactive and can be used against other players).



    All the rest of the physics will be done purely on the client. Small debris, background objects, VFX physics, etc. The result will be physics objects that will interact naturally with each other but will be non-collidable or weightlessly pushed around by any server-authoritative objects (like players).



    The short version of that being that both server and client need to do "physics" of some variety, but typically on different sets of objects. The client will still apply positions/velocities from server objects into its local sim but can't apply any counter-force (these are typically called "kinematic" objects in most physics libraries/toolkit).







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 6 hours ago









    Sean MiddleditchSean Middleditch

    39.6k3 gold badges79 silver badges120 bronze badges




    39.6k3 gold badges79 silver badges120 bronze badges











    • $begingroup$
      By the physics, in my case, i ment Box2D world that is running the simulation on the bodies. But finally I understand how to start designing it. I will try first very simple try, just transfer map and movements, without prediction things. After comleting this, I will try to adapt even the client prediction and movement smoothness.
      $endgroup$
      – Pins
      3 hours ago
















    • $begingroup$
      By the physics, in my case, i ment Box2D world that is running the simulation on the bodies. But finally I understand how to start designing it. I will try first very simple try, just transfer map and movements, without prediction things. After comleting this, I will try to adapt even the client prediction and movement smoothness.
      $endgroup$
      – Pins
      3 hours ago















    $begingroup$
    By the physics, in my case, i ment Box2D world that is running the simulation on the bodies. But finally I understand how to start designing it. I will try first very simple try, just transfer map and movements, without prediction things. After comleting this, I will try to adapt even the client prediction and movement smoothness.
    $endgroup$
    – Pins
    3 hours ago




    $begingroup$
    By the physics, in my case, i ment Box2D world that is running the simulation on the bodies. But finally I understand how to start designing it. I will try first very simple try, just transfer map and movements, without prediction things. After comleting this, I will try to adapt even the client prediction and movement smoothness.
    $endgroup$
    – Pins
    3 hours ago













    1












    $begingroup$

    If the client has a 100ms ping to the server, then there would be a delay of at least 6 extra frames between the user pressing a button, and seeing the result, probably more.



    Even adding 1 frame from double-buffered rendering causes perceivable delay.



    This means that client/server gaming is a lot more complicated than this, and prediction is involved.






    share|improve this answer









    $endgroup$

















      1












      $begingroup$

      If the client has a 100ms ping to the server, then there would be a delay of at least 6 extra frames between the user pressing a button, and seeing the result, probably more.



      Even adding 1 frame from double-buffered rendering causes perceivable delay.



      This means that client/server gaming is a lot more complicated than this, and prediction is involved.






      share|improve this answer









      $endgroup$















        1












        1








        1





        $begingroup$

        If the client has a 100ms ping to the server, then there would be a delay of at least 6 extra frames between the user pressing a button, and seeing the result, probably more.



        Even adding 1 frame from double-buffered rendering causes perceivable delay.



        This means that client/server gaming is a lot more complicated than this, and prediction is involved.






        share|improve this answer









        $endgroup$



        If the client has a 100ms ping to the server, then there would be a delay of at least 6 extra frames between the user pressing a button, and seeing the result, probably more.



        Even adding 1 frame from double-buffered rendering causes perceivable delay.



        This means that client/server gaming is a lot more complicated than this, and prediction is involved.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 7 hours ago









        BramBram

        2,45510 silver badges15 bronze badges




        2,45510 silver badges15 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Game Development Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgamedev.stackexchange.com%2fquestions%2f173099%2farchitecture-of-networked-game-engine%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

            Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

            199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單