Re: Access specific objects from a binary file



On Apr 30, 8:33 pm, "Jürgen Lerch" <jyn...@xxxxxx> wrote:
Saluton!

On Tue, 29 Apr 2008 22:52:06 -0700 (PDT), Jeff Lait wrote:
Saving maps to disk during play just seems like such an unnecessary
complication.  You introduce tons of painful edge conditions: what if
you run out of hard disk space while saving?  What if someone plays
from a read-only hard drive mount?  Or has their home directory marked
read only?  Or deletes one of the files while playing?

What do you do if you run out of RAM? (HD space is nowadays
at least as plenty as RAM.)

As mentioned, modern OSes have virtual memory so running out of RAM is
not an option. Admittedly, 32bit OSes tend to have annoying 1.6gb,
2gb, or 3gb limits. But, in all honesty, if you don't have hard upper
cap of 1gb of memory free you do have problems.

Diskspace is actually more troublesome than ram. For example, you may
be running from a USB stick, or other system. I also rather
frequently run out of diskspace, but that's due to my tendency to
create gigabytes-per-hour data sets. Roguelikes shouldn't be doing
that.

A failure to memory allocation will cause damage at random parts of
your program, likely entailing a crash. A failure due to disk space
during your save method is a constrained problem you can deal with. A
failure due to diskspace in your scattered map loading/saving is much
more troublesome. There is no "ignore and continue" option - you have
to successfully save the map or the game is corrupt. Failing to save
a game to a single file doesn't have to corrupt the active game, so
all you have to do is report the failure and let the user try again at
their leisure.

How does such someone save on exit?

How do you save on exit when maps are stored to disk? The problem is
the same - on exit you want your *current* level saved as well. If
your desire is to have checkpointing so you can recover from a crash,
I'd much sooner advocate checkpointing with an actual saved game
rather than trying to rebuild from the map data. This is conceptually
simpler to create, has only one code path, and removes any need to
make some special "recover" program.

And if a file gets deleted, well, you just create it anew.

Either you have it in ram, so recreating it straightforward, but,
likewise, there's no good reason to have it on disk. Or you recreate
it by regenerating it. In which case this becomes a trivial cheat to
destroy troublesome encounters.
--
Jeff Lait
(POWDER: http://www.zincland.com/powder)
.



Relevant Pages

  • Re: Access specific objects from a binary file
    ... What do you do if you run out of RAM? ... don't come with unlimited disk space either). ... you can play your game with persistent levels (with non- ...
    (rec.games.roguelike.development)
  • Re: Hvy Plastic
    ... which multiplied their disk space use. ... i have a sea sector that somehow thinks it is a gold mine. ... it's a part of the game:) ... Tue May 5 19:57 Thistle endures lawless rioting several times ...
    (rec.games.empire)
  • Re: Virtual Memory is too low
    ... Free disk space is valuable if you have insuffient and less or not ... the option windows has provided and provide ... The aspect of virtual memory you refer to as a machine limitation is ... Adding RAM can reduce but not eliminate pagefile ...
    (microsoft.public.windowsxp.general)
  • Re: File became too large to edit.
    ... If there is insufficient disk space it can't ... pictures and documents. ... I added Ram memory to the max, ... allow editing after opening, telling me that there is not enough memory to ...
    (microsoft.public.word.docmanagement)
  • Re: Speeding up XP
    ... prevent other upgrades from being cost effective. ... A Gig or RAM will help as it will alleviate some of the substantial ... If you were going to throw money at some part of the system ... eat away at disk space so you'll be receiving low space warnings fairly ...
    (microsoft.public.windowsxp.general)

Loading