I cannot save my game anymore when I add new Sprites. The sprites can't be saved

Started by TheManInBoots, Sun 18/08/2019 02:06:37

Previous topic - Next topic

TheManInBoots

Hi everyone!

I cannot make Adventure Game Studio function anymore for a game that I have been working on over the last months.

Each time I add at least one new Sprite and then try to save the project, I get and an error message with this bug report:



Error: Attempted to divide by zero.
Version: AGS 3.4.1.13

System.DivideByZeroException: Attempted to divide by zero. ---> System.DivideByZeroException: Attempted to divide by zero.
   at save_sprites(Boolean )
   at save_game(Boolean compressSprites)
   at AGS.Native.NativeMethods.SaveGame(Game game)
   at AGS.Editor.NativeProxy.SaveGame(Game game)
   at AGS.Editor.AGSEditor.SaveGameFilesProcess(Object parameter)
   at AGS.Editor.BusyDialog.RunHandlerOnThread()
   --- End of inner exception stack trace ---
   at AGS.Editor.BusyDialog.Show(String message, ProcessingHandler handler, Object parameter)
   at AGS.Editor.AGSEditor.SaveGameFiles()
   at AGS.Editor.Components.FileCommandsComponent.CommandClick(String controlID)
   at AGS.Editor.ToolBarManager.ToolbarEventHandler(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at AGS.Editor.ToolStripExtended.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)



I tried restarting the program, even restarting my computer, with no results. The problem remains.
Also it took quite a long time to save new files- the sprites- in the project, before the error occured, way longer than it does with new projects I work on.
I have a very high resolution for the game -1600x900- and I use high quality photos as graphics. My sprite file is a little over 2,8 GB big. I have approximately 1500 graphic files, maybe some more, around 1700, I cannot say for sure because the automatic graphic numbering of the software is not entirely regular.
I can still save projects with new Sprites when I open other projects, just with this game I have been working on for so long it does not work.

I have no idea how I could fix this problem, but I would greatly appreciate any helpful advice, I have been working on this game for a long time and I would soon finish it, but now this is holding me back.

TheManInBoots

Slasher

Hi

I  believe going over the 2G sprite size will cause problems.. Not sure if this is exactly your problem..

Have you tried setting compress sprite file to true in the general settings?

Cassiebsg

If sprite compression is already on, change to the new BETA version, since the 2GB limit has been removed (or increased).
The only other alternative is loading the sprites from an outside source as dynamic sprites.
There are those who believe that life here began out there...

TheManInBoots

I installed the newest version on this site (3.4.3.1).
So, after that:
Setting compress sprite files to true, false and true again and saving the project every time in between (yeah, weird, I know!?) allowed me to add about ten more sprites before the same problem and error message occurred.
Yeah, adding dynamic sprites could help me out a little bit for a few sprites if dynamic sprites are really not saved in the sprite file.
However I would still like to add an elaborate intro animation which will include at least 500 more sprites, and I cannot add all those as dynamic sprites, that would be insane and really impractical.

I experimented a little bit and noticed that if I set "compress sprite files" to true from the very beginning of a project I can add high number of sprites without problems and also without the extreme slowing down of the system when adding and saving sprites.
So my assumption is that  clearly the software has problems changing the sprite file from compressed to not compressed, and also re-saving and re-structuring the sprite file properly, once you added a high enough number of non compressed sprite files.

Is there any way to completely delete the sprite file (and it's sprite backup file and associated files) and then let the software save my project and my sprites from point zero so to speak, everything as compressed files? Because that should remove the bug in my estimation.

Crimson Wizard

Quote from: TheManInBoots on Mon 26/08/2019 17:19:56
Setting compress sprite files to true, false and true again and saving the project every time in between (yeah, weird, I know!?) allowed me to add about ten more sprites before the same problem and error message occurred.

You should not really do that, because if you compress, add a sprite, then uncompress, the uncompressed size may already exceed the limit and some of the previously added sprites will be lost or corrupted during the next save attempt.


Quote from: TheManInBoots on Mon 26/08/2019 17:19:56
So my assumption is that  clearly the software has problems changing the sprite file from compressed to not compressed, and also re-saving and re-structuring the sprite file properly, once you added a high enough number of non compressed sprite files.

Of course, IIRC usually AGS changes sprite file only partially when some sprites are changed or added. When you switch from compressed to uncompressed or back it has to redo whole package.


Quote from: TheManInBoots on Mon 26/08/2019 17:19:56
Is there any way to completely delete the sprite file (and it's sprite backup file and associated files) and then let the software save my project and my sprites from point zero so to speak, everything as compressed files? Because that should remove the bug in my estimation.

Hmm, theoretically speaking, if you have imported sprites from actual source files and you still have these source files on their original locations the AGS project can restore them from source, but you have to issue this command by hand, one group of sprite after another (there's no automatic process). Of course make sure you made a full backup of your game. Frankly I don't know how well that will proceed.


PS. Also, the BETA version which has sprite limit removed is 3.5.0, 3.4.3 does not have this yet.

TheManInBoots

Thanks for your input Crimson Wizard.

I was re-importing my frames from source, exactly what you suggested. It was going quite well but at some point I received this error message:

https://drive.google.com/file/d/1VlD_Bnz8kiGYPr33C6C2hvJ8n4y4p_-m/view

I'll look into the beta version.

Crimson Wizard

Quote from: TheManInBoots on Tue 27/08/2019 07:36:50
I was re-importing my frames from source, exactly what you suggested. It was going quite well but at some point I received this error message:

https://drive.google.com/file/d/1VlD_Bnz8kiGYPr33C6C2hvJ8n4y4p_-m/view

I'll look into the beta version.

Have you saved your project after reimport? I think it should resave sprite file at least once for stability.
TBH I have doubts beta version won't help in this regard.

TheManInBoots

Okay, I tried re-importing from source in the new beta version 3.5.0, saving and all, but the bug remains.

The sprite file or some memory remain corrupt.


morganw

You may be hitting a known issue that affects importing sprites, that they are all held in memory until you save the game project. The practical memory usage limit (of the import process, not the sprite cache file) is about 2GB, so if you had 2GB worth of sprites (sounds like you do) you won't be able to re-import them all without some intermediate saving.

If you re-import a smaller set of sprites, does it still crash?

TheManInBoots

Yes, I noticed that I could re-import smaller amounts of Sprites and then save the game, so I already tried that.
But the bug remains.  :~(


TheManInBoots

I guess it won't be worth it to try re-importing and saving smaller chunks in a non-beta version.

Crimson Wizard

Could you clarify, what kind of bug is that? is it same error message from your first post?

TheManInBoots

Now last time I tried in the beta version the program just crashed and freezed  and I have to close the program.

eri0o

Which error are you having? Doesn't it output anything on the screen?

TheManInBoots

No, it doesn't anymore. It just freezes and doesn't respond anymore.
Could be related to the beta version?

The error messages I received before I already posted them above in this thread.



Crimson Wizard

Quote from: TheManInBoots on Wed 04/09/2019 14:47:40
No, it doesn't anymore. It just freezes and doesn't respond anymore.

So it just freezes without error messages?

There's an issue that beta updates sprite data when you open new project, if there are lots of sprites it may take a short while (although idk how long in practice);
have you tried waiting for some time (and if yes then for how long)?

TheManInBoots

So when I open the project and open the Sprite folder, oftentimes it does not show the sprites, and my mouse curser turns to loading.
And then I wait a long time, 10 minutes, nothing happens. The only thing I can do is I restart the program and the project, go into the sprites folder, and repeat until the sprites are shown. Because sometimes it works. I had this problem only in the beta version, not before. The interesting thing is that when the sprites are not shown, I can still open the sub-folders, and even when the rest of the sprites are not shown, I can open the sub-folder where I added and saved two sprites successfully in the beta version, and they are being shown.

The freezing itself occurs when I try to import sprites.
So I imported multiple sprites over the right click, import sprites... option, and after selecting the images the import window opens, where you can select to use alpha channel and change other import details.
Then when I confirm and click on "Import All" it freezes. When I had the problem that the sprites were not shown in the sprite folder, it froze immediately. When I restarted the program several times until the sprites were shown in the sprite folder, it imported 3 sprites before freezing (you know how the sprites are being displayed one after another in the import window while being imported). In any case the import window and AGS freeze, and if I click around after several minutes, windows sends me this message that the program stopped working:
https://drive.google.com/file/d/1mFZXhC9FOl6_iP2NgE_yN-pM2e4aHIUB/view?usp=sharing

And I waited I guess 20 minutes and nothing happened. I don't think waiting any longer will do any good.
This is some tricky business here! :)

Crimson Wizard

Yeah, 20 minutes is too long... guess there's a crashing after all, or threads deadlock...

Thank you for telling extra details, we will try to investigate this.

SMF spam blocked by CleanTalk