@[email protected]
link
fedilink
English
147M

Bold of you to assume the data in save files is packed binary and not something like JSON where { “x”: 13872, “y”: -17312, “z”: -20170 } requires 40 bytes of storage.

@[email protected]
link
fedilink
English
97M

Agreed. JSON solves:

  • the ‘versioning’ problem, where the data fields change after an update. That’s a nightmare on packed binary; need to write so much code to handle it.
  • makes debugging persistence issues easy for developers
  • very fast libraries exist for reading and writing it
  • actually compresses pretty damn well; you can pass the compress + write to a background thread once you’ve done the fast serialisation, anyway.

For saving games, JSON+gzip is such a good combination that I’d probably never consider anything else.

@[email protected]
link
fedilink
English
37M

protobuf does all of these (well, except compression which you dont need)

@[email protected]
link
fedilink
English
27M

That’s excusable in My First Game™ but surely professional AAAAA game would never cut corners and code something so lazily, eh?

@[email protected]
link
fedilink
English
17M

looking at you x3

and rimworld

@[email protected]
link
fedilink
English
57M

It’s not really laziness. Storing as JSON solves or prevents a lot of problems you could run into with something bespoke and “optimally packed”, you just have the tradeoff of needing more storage for it. Even then, the increased storage can be largely mitigated with compression. JSON compresses very well.

The problem is usually what they’re storing, not how they’re storing it. For example, The Witcher (first one) has ~20MB save files. These are mostly a bespoke packed binary format, but contain things like raw strings of descriptions in multiple localisations for items being carried, and complete descriptors of game quests. Things that should just be ID values that point to that data in the game files. It also leads with like… 13KB of zero-padding for some reason.

@[email protected]
link
fedilink
English
17M

Good points!

Create a post

Welcome to the largest gaming community on Lemmy! Discussion for all kinds of games. Video games, tabletop games, card games etc.

Weekly Threads:

What Are You Playing?

The Weekly Discussion Topic

Rules:

  1. Submissions have to be related to games

  2. No bigotry or harassment, be civil

  3. No excessive self-promotion

  4. Stay on-topic; no memes, funny videos, giveaways, reposts, or low-effort posts

  5. Mark Spoilers and NSFW

  6. No linking to piracy

More information about the community rules can be found here.

  • 1 user online
  • 182 users / day
  • 788 users / week
  • 2.29K users / month
  • 6.32K users / 6 months
  • 1 subscriber
  • 4.88K Posts
  • 101K Comments
  • Modlog