RTS devlog #6: 1000 units bandwidth

You're viewing a single comment in a conversation. View all the comments
  • 7 Comments

  • Order by
  • What's preventing you from doing exclusively delta updates?

    I haven't done complex/large scale network implementations in a while, but after studying the subject a whole lot, lately I've just realised that it might be doable to just take a purely data oriented approach and have the entire game sync up to a "game state" object that keeps info on absolutely everything in the game.

    The whole game is drawn from reading that game state object and interacting with it sends events to the state manager to tell it what values to update.

    The state manager can then just keep track of a buffer of changes, and send that over the network to every other party.

    • So when you join, the server sends the full state and from there it's only delta updates.

      The way I see it, the actual implementation would be pretty close to the way git works when handling text file contents. But then just like git, you can run into merge conflicts but in practice these would be the same ones as a regular implementation.

        • [-] [+]
        • 1
        • Ashley's avatar
        • Ashley
        • Construct Team Founder
        • 1 points
        • (4 children)

        I think the big problem is delta updates don't send a position, so over time errors would accumulate and everything would drift too far from where it's meant to be. Sending the full updates over 2 seconds uses a tiny amount of bandwidth and means errors only accumulate for up to 2 seconds.

        • but thinking in vectors, why don't just update destinations on delta? so basically

          if CurrentDestination != FinalDestination != StartingPoint then delta FinalDestination, so they will move in a predictable way only if the destination is not the starting point (they reached destination) or have a different target to move to.

        • That's the case for your implementation, and I suppose that in a game where everything either moves in a straight line or does not move at all, I guess that makes sense.

          In a more general context, I can't see why just sending the position as well with the delta updates would cause any issue.

          I don't know how the MP plugin works, but since pretty much everything in Construct can save and load from JSON, I can definitely see how it would be doable to implement this as a general purpose layout synchronisation technique. Unless the performance hit from saving/loading JSONs in substantial that is. But in real case scenarios you'd only tag the objects you want to synchronise and that should work fine.

            • [-] [+]
            • 3
            • Ashley's avatar
            • Ashley
            • Construct Team Founder
            • 3 points
            • *
            • (1 child)

            If you send positions with deltas, then do you send deltas when the position changes? If so it's near enough reinventing full updates, which use too much bandwidth for this project. If not then there's probably still going to be drift away from the true position, so you'd need something like full updates to occasionally correct it.

            The bandwidth requirements for this project are pretty serious too - sending any data that is not strictly necessary could push the bandwidth over the 100 KiB/s goal.