Sprindex.dat gone, only blue cups visible in the sprite manager

Started by AGD2, Thu 18/07/2013 10:22:51

Previous topic - Next topic

AGD2

Okay, I've run into a big problem here and I'm wondering if anybody knows of a solution.

I was working on a game in AGS and I used the test game without debugger (CTRL+F5). The game launched and about 5 seconds later, the power went out. It came on again so I rebooted and reloaded the game into the editor. I used CTRL+F5 again and then jumped to a specific room with CTRL+X. The room in question had been open in AGS at the time of the power failure and AGS gave a fatal error that the file was badly packed. I visited a few other rooms and they looked fine. The sprites all displayed and animated in those rooms correctly.

Thinking it may have been an issue with the acsprset.spr file, I made a duplicate copy and put it in a safe place. Then I renamed the backup_acsprset.spr file to acsprset.spr file. Compiling the game and using CTRL+F5 at this point gave a fatal error upon loading that "There was an error drawing object 0. Its current sprite, 1281, is invalid."  No biggie, I thought. It must have been an issue with that particular room file being corrupt and not the sprite file. So, I simply renamed reverted back to my original acsprset.spr file. Whenever AGS has corrupted the sprite file in the past, I have been able to do this without issues.

However, this time, when I used CTRL+F5 again, the game kept giving the same error message above. Upon looking in the Sprite Manager, I noticed that all the sprites were displaying as blue cups, and a quick glance at the game folder revealed that my sprindex.dat was completely gone. The sprindex.dat seems to store the data for which sprites are which, but doesn't get backed up between compiles like the other crucial sprite files do.

So, now I have no way to get the sprites in the sprite manager back to their original versions. When looking in the game.agf file, it appears that all of the sprites' source folders and filenames are stored. I'm going to lose significant progress if I can't get around this issue. Does anybody know if it's possible to rebuild the sprindex.dat file somehow by reading the data contained in the game.agf and current acsprset.spr files?

Thanks for any insight!

Crimson Wizard

First of all, sprindex.dat is only generated if you enable "Compress the sprite file" option in General Settings. Something I frankly forgot about.
I fiddled with those files a bit and found this solution.

Way to reproduce a problem:
* Create a project (use any template with ready sprites).
* Set "Compress the sprite file" to true.
* Build EXE and close the Editor.
* Delete sprindex.dat.
* Open project again. You will notice that all sprites are wrong (mine were all black). This will stay no matter how you will rebuild the project or restore backups of acsprset.spr.

Solution
* COPY backup_acsprset.spr to some other safe place. This is very important because the one in the project folder will be overwritten after next steps.
* Open bad project.
* Go to General Settings and set "Compress the sprite file" to false.
* Save project and close the Editor.
* Delete acsprset.spr AND new backup_acsprset.spr in the project folder.
* Copy original backup_acsprset.spr into project folder as acsprset.spr.
* Open the project. It should be OK now, because it took the original uncompressed sprite cache.
* You may now turn "Compress sprites" on again.
* Continue working...


EDIT: Corrected solution: you MUST copy backup_acsprset.spr to the safe place before changing "Compression" setting.

AGD2

Hmmm, that didn't seem to work for me. When I followed those steps, all the sprites still showed up as blue cups in the Sprite Manager. I guess I compiled the source and played around with the settings too many times before I tried what you said (although the timestamp on my backup_acsprset.spr was from 2 days ago - before his happened).

At any rate, I downloaded the latest AGS 3.3 beta and noticed the new option to "Replace Sprites From Source". Let me say that whoever added that feature is an angel! It allowed me to recover all of the sprites from the folders on my hard drive and set them back up in the source, as intended. A few stragglers that had been copied and pasted from the clipboard needed to be tracked down manually, and I had to tweak a few things here and there, but I have now brought it back from the dead and MADE A BACKUP. Thanks for the tips. :)

Incidentally, is this the type of thing that could be prevented if AGS made a backup of the sprindex.dat file when you compile? If so, any plans to do that?

Crimson Wizard

Quote from: AGD2 on Thu 18/07/2013 18:42:17
Incidentally, is this the type of thing that could be prevented if AGS made a backup of the sprindex.dat file when you compile? If so, any plans to do that?
Actually that's a good idea. Furthermore, I think that restoring spritecache should be done by the editor, not manually by user.
Might have sense to try this at some point.

SMF spam blocked by CleanTalk