Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Zlodo

Member Since 05 Jan 2009
Offline Last Active Today, 05:44 PM

Posts I've Made

In Topic: preventing system crash or power outage from wiping savegame: best methods

24 March 2015 - 01:58 PM

 


You can have a look at how sqlite achieves atomic commits using a rollback or a write ahead journal:

 

that was about the only thing i found from googling this

 

http://en.wikipedia.org/wiki/Journaling_file_system

 

it helped refresh my memory about how such things work.  I was into systems programming before I got into game programming, but that was a LONG time ago, back in the DOS 3.0 and DOS 4.0 days.

 

from the wikipedia description, recovery seemed rather non-trivial, especially compared to round robin saves or new save each time.

 

going to SQLite to save what is essentially a header-less 264x264 monochrome bitmap is probably overkill. also, these must page in real time, so performance is "mission critical code". in my mind, "mission critical code" and SQLanything don't belong in the same universe. 

 

 

All "SQLanything" aren't created equal - I suggested using SQLite, not Oracle. It's server-less and writes everything into a single binary file. You could easily store your bitmaps in there as blobs and get the atomic updates, resilience to crashes etc for free. If you use it like just as a key/value store for binary blobs you don't even need it to parse any sql (not that it would matter because parsing a few sql statements when initializing your app wouldn't kill you anyway)

 

As an aside, SQLite and "mission critical" do belong in the same universe, unless you don't consider airliners flight software to be mission critical:

http://sqlite.org/famous.html


In Topic: preventing system crash or power outage from wiping savegame: best methods

23 March 2015 - 03:56 PM

You can have a look at how sqlite achieves atomic commits using a rollback or a write ahead journal:

http://sqlite.org/atomiccommit.html

 

Of course, as said above it relies on the hard disks not lying about flushing their caches onto the physical media. But even in that case it would be a good protection against crashes.

 

You may also consider just using sqlite to store your game save and let it deal with that.


In Topic: Programmatic Pixel Art

23 March 2015 - 01:57 PM

Well the thing is that things like gimp can directly load and save XPM images so you can just edit them like normal images and then just #include them in your code. You still have to decode them into an RGB format before you can use them anyway, so I'm not sure it's really very useful.

 

If you really want to embed images directly into your executable, you might be better off just including images in PNG or JPG in your code using something like bin2c and using stb_image (a full featured image loader that fits entirely in a header file) to decode them.


In Topic: what is the origin of your nickname/Internet handle?

23 March 2015 - 12:56 PM

I just made up a senseless word.

 

Apparently it happens to be the name of a city in Montenegro, though. At least it's not a derogatory word in some other language (to the best of my knowledge at least)


In Topic: Programmatic Pixel Art

23 March 2015 - 12:42 PM

Has anyone ever tried to do that, you ask? Oh yeah. I can guarantee you that in the medieval ages of computing people were routinely hardcoding graphics directly in their source code like that.

 

You may want to have a look at the XPM format, a text based bitmap format that is also actually valid C code defining palette and pixels as arrays. Some editors even recognize it and can turn into bizarre text editor / image editor hybrids:

Screenshot-xterm-linux.xpm-GVIM.png


PARTNERS