this post was submitted on 05 Jun 2024
185 points (100.0% liked)

Games

32041 readers
838 users here now

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.

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 7 points 4 months ago (13 children)

It still feels like it should be orders of magnitude less. For example, if each piece of cheese has an ID number that maps to cheese, an ID for what area it's in, three coordinates for where exactly it is, and maybe a few more variables like how much of it you've eaten. Each of those variables is probably only a couple of bytes, so each item is probably only 20B or so, which means that even if you interacted with a million different items and there was no compression going on then that's still only 20MB of save data.

[–] [email protected] 14 points 4 months ago (6 children)

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] 9 points 4 months ago (1 children)

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] 3 points 4 months ago

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

load more comments (4 replies)
load more comments (10 replies)