The status of the 'save' functionality

Discussion in 'Planetary Annihilation General Discussion' started by cwarner7264, October 7, 2014.

  1. totalannihilation

    totalannihilation Active Member

    Messages:
    215
    Likes Received:
    168
    The one thing that really bothers me is...
    how far is chronocam to a "save_state" feature? it records everything
    loading a game should be very similar to loading an in-game replay
  2. dom314

    dom314 Post Master General

    Messages:
    896
    Likes Received:
    1,196
    @totalannihilation. Considering you can just go anywhere in chrono cam, jumping between times while the game state changes to reflect that, I really don't understand why it would be hard to do.

    But here's the thing, I also don't know how chrono cam actually works at all, so I could not and would not take my opinion seriously.
  3. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    My understanding is that while the chronocam contains all the data needed to replay a game, it lacks some game-state/run-time data that is needed to actually be a player.
    There's a dev post around here that gives further details. Lemme see if I can find it.
  4. bengeocth

    bengeocth Post Master General

    Messages:
    1,285
    Likes Received:
    657
    okay guys saving is hard to set up.

    You have to run a loop saving the exact position, orientation, health, something, something something something of every single instance of every single object.

    When you load in a game, you are not playing the same one, its set up to feel that way. It is literally building the new game from the ground up, with the map features, the buildings, the units, and this takes time. I program. It took me a while to create a save/load system for a 2D game that saves custom maps. And it wasn't even in binary, since i didn't intend to distribute it, so every world was saved to a text file.

    Not to mention if you have a problem with a loop, things will happen in insane ways- the game might put the health of your commander as its x value- having it appear on the other side of the planet with a third of it health.

    Its a very delicate process, setting this up, especially for this game.

    so stfu everyone who is mad at uber for no save function.

    EDIT: Plus the chronocam! holy moly, it is insane!
    Last edited: October 8, 2014
  5. Nalin

    Nalin New Member

    Messages:
    8
    Likes Received:
    8
    This is correct. Chronocam will give you all the information about all the units in the game, like position, health, and whatnot, and the initial server release is expected to come with a tool that will let you set up a game from a replay, but it won't tell you stuff like what the AI is thinking, what the build order on factories is set to, what your units are targeting, and so on. So when you load a replay using that tool, it will be like starting a fresh game with some pre-existing units on the field.
    pizwitch and Raevn like this.
  6. mayhemster

    mayhemster Well-Known Member

    Messages:
    394
    Likes Received:
    425
    I suspect getting a decent filesystem together is the main issue as various patches have broken replays. I imagine standardizing and future-proofing the filesystem is the main issue as it could involve rewriting a fair bit of code depending on how it was originally put together and how it has evolved since.
  7. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I'd expect they will add things like commands to the data tracked by the chronocam as well. Would also allow to actually see all command queues in replays.
    proeleert likes this.
  8. tenaciousc

    tenaciousc Active Member

    Messages:
    125
    Likes Received:
    119
    I'd just like Uber to know that for some of us, the day that saves are implemented is the day we can start playing this game. For people with full time jobs, spouses, children, whatever obligations etc., playing this game in short increments is the only way we can play it. I cannot count how many games I've started and had to abandon because I couldn't save the game. Please don't mistake me for a hater, I LOVE this AWESOME game. I backed it in the Kickstarter for a decent amount. I only want to stress that this is an important feature for me, and I suspect many others. Thanks!
    cwarner7264 and lokiCML like this.
  9. lokiCML

    lokiCML Post Master General

    Messages:
    1,973
    Likes Received:
    953
    So if anybody wants to read the tech behind chronocam. Here's to blog posts by @forrestthewoods.
    vyolin likes this.
  10. vyolin

    vyolin Well-Known Member

    Messages:
    631
    Likes Received:
    479
    Having read through the developer post regarding ChronoCam, I might go out on a leg and say that it works nothing like what you describe at all.
    ChronoCam stores (or is supposed to store) an initial state and then small state deltas mapped to a timeline, thus updating state. As opposed to traditional P2P-game saves storing an initial state and then only user inputs mapped to a timeline, computing state.
    Which makes PA's approach superior in one way, that being not having to deal with how state changes come to pass, only when. Which in turn makes for a superior base for replays and saves, as far as hot joining, fast timeline manipulation and savegame version compatibility are concerned - at the cost of a much higher memory footprint.
    eroticburrito likes this.
  11. SXX

    SXX Post Master General

    Messages:
    6,896
    Likes Received:
    1,812
    I'm think there is also be some intermediate points in timeline with full game state to make ChronoCam work fast when player reconnect or warp to the time that was before he connected. Replay history of huge game might take multiple GBs while bandwidth used for reconnect just a lot lower.
  12. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I don't think it stores deltas, wasn't it explained in forrest blog that it stores everything as curves? So it basically has a mapping of time > curves and a curve itself as also a mapping of time > data
    So to get an arbitrary point in time you look up the curves that existed for that range of time and then you calculate the exact values from the curves. Thus you can view any point in a replay with logarithmic access speed, as you can i.e. binary search all curves you know for the ones in the timeframe you want to watch.
  13. vyolin

    vyolin Well-Known Member

    Messages:
    631
    Likes Received:
    479
    Most certainly, as this is a reasonable thing to do. Plus, the save file is supposed to be big already, a few 'fuill dumps' along the timeline should not make a huge difference there.
  14. vyolin

    vyolin Well-Known Member

    Messages:
    631
    Likes Received:
    479
    But what is such a curve but a collection of deltas at discrete points in time? The simulation, too, is not continuous but rather discrete, after all. Or are you insinuating they are interpolating over all data points to form a continuous curve? Would be crazily elegant if they did. And crazy.
  15. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Read the articles that are linked a few posts above and you will find these images in there:
    [​IMG] ยด
    [​IMG]
    [​IMG]
    [​IMG]

    source: http://forrestthewoods.com/the-tech-of-planetary-annihilation-chronocam/

    So yeah, crazy elegant. Ofc for a unit that is given a dozen different movements in a minute they will have far more than one curve, but i.e. a unit that moves in a straight line with no interruption has only a bunch of curves for the whole time it moves, no matter how long that time is. So storage wise it's not as perfect as one might assume without considering the complexity of movements that units may do (though for example bullets probably never change, so one bullet probably is exactly one movement curve on every axis).
    The biggest advantage is the ball example of perfect accuracy as well as the speed at which it is possible to jump anywhere in the replay.

    EDIT:
    though I guess a curve basically is two values and a time that passes between them, so yeah in that sense 2 deltas.
    tatsujb likes this.
  16. vyolin

    vyolin Well-Known Member

    Messages:
    631
    Likes Received:
    479
    Doesn't a unit always have all the curves but if it doesn't do anything its curves resemble a constant function? My guess about those pictures is @forrestthewoods doing us a favour by connecting all the dots so it is easier on the eyes and brain.
    But the gist of it still stands, one way or another, it is an awesome foundation for everything related to game-time manipulation.
  17. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Sure it has all the curves, but a curve can say: value starts at 100 and ends at 200, curve duration is 100 seconds.
    That's enough to store a constant movement from 100 to 200 over 100 seconds, using only 3 numbers to store it.
    So I think that the pa server only creates new curves if the changes in a value with a curve deviate from a linear change too much. Ofc this happens a lot, but for stuff that has a linear change (or no change at all, as that basically is just a curve from 100 to 100 over endless many seconds) only one curve is required.
    To start a replay from time x the server has to lookup the curves that were active at time x and put x into them to calculate the values. It does not matter what curves existed before that.

    ... I think, it has been a while since I read the article xD
  18. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    My only comment, is that I hear Uber is capable of loading games up from replay files already, but it starts off as a new game which loses all the input values from the old. Well, I wouldn't mind having that much this very moment. Plz release as experimental prototype feature Uber?

    At least, until you also store orders for units with it. I can handle starting a game and going across giving new orders to everything all over again.
  19. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    I think the AI can't handle that and the biggest group that wants to store the game is the group of "vs AI players"
    tatsujb likes this.
  20. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    Hey, that much can start broken, and then be fixed later. I can see people complaining about it, don't get me wrong, but it has uses even in it's broken state. Tbh, you could even use cheat-mods to delete and readd units on the AI team to reset their status and the AI gives them new commands. No biggie.

Share This Page