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

Games

32545 readers
2269 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
[–] FeelzGoodMan420@eviltoast.org 15 points 5 months ago (14 children)

Most games never hit anywhere near that, but some large open world rpgs like Skyrim track the location of every single object in the game world. Like you can drop a piece of cheese on the bottom left corner of the map, come back 500 hours later, and it'll still be there. now imagine all of the objects you're buying and selling and manipulating over those hundreds of hours. Now add in a shit ton of script mods and other stuff that may add even more objects. And add in all of the quest data and interaction data that gets saved etc etc, and your save file can easily hit multiple gigabytes, with each file approaching 200mb.

[–] smeg@feddit.uk 7 points 5 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.

[–] vithigar@lemmy.ca 14 points 5 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.

[–] addie@feddit.uk 9 points 5 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.

[–] cactusupyourbutt@lemmy.world 3 points 5 months ago

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

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