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.

TheManInBoots

What exactly do you mean when you say "we will try to investigate"??

Do you have like a whole lab team working on it??  (laugh)
And I mean, how can you investigate it if you don't have my game?

Crimson Wizard

Quote from: TheManInBoots on Thu 05/09/2019 02:26:13
What exactly do you mean when you say "we will try to investigate"??

Refer to your description of a problem, and look into code to see what could possible go wrong under similar conditions.
Maybe ask more questions...
When I say "we" I mean we have more than 1 person who works on the Editor.

Quote from: TheManInBoots on Thu 05/09/2019 02:26:13
And I mean, how can you investigate it if you don't have my game?

Sometimes it's possible to reproduce similar conditions by making a test game.

Of course, ideally I'd like to have your game project that fails, but idk if it's okay for you to upload (also guess it may be huge).

TheManInBoots

I mean I trust you with this, and I think everyone, me included, can only profit if you can improve the program.
I PM ed you a link with the game file.
Well at least the sprite file tripled down in size after compressing the sprite files. The whole thing is about 4GB big.

Crimson Wizard

Ok I downloaded it.

According to the data in Game.agf you are using slightly older beta (around 3.5.0.8 - 3.5.0.10).

When I tried opening your project with the most recent beta it shows following warning:
Quote
Sprite file (acsprset.spr) contained less sprites than the game project referenced (99 sprites were missing). This could happen if it was not saved properly last time. Some sprites could be missing actual images. You may try restoring them by reimporting from the source files.
(And some of the sprites are actually replaced with dummy "blue cup" image. But they seem to all have kept the source reference, so could be restored from source.)

This is a special test that we've added recently specifically to prevent crashes if sprites were not saved correctly. It was added around v.3.5.0.13.

Could you download very latest Beta and try using it with your project instead?

TheManInBoots

Hey I installed the latest version of AGS I found (v 3.5.0.16).

So the sprites that were replaced by the dummy blue cup, that was mostly an unlucky coincidence. With the bug I had when I saved new sprites, it would not save them but I would only get those blue dummy cups when opening the project again. But only sometimes it would save also some of the old files as blue dummy cups, that usually were saved correctly. So apparently just before I uploaded the game I saved the game and the sprites were saved as blue dummy sprites, but that was all due to the bug I described.

However, after installing the new version, I re-imported from source ALL my sprites, just to be sure.
However I still keep getting the same warning that you quoted in your message everytime I open the project, even though I have not a single blue dummy sprite anymore.

The good news is, now I CAN save the sprites and I CAN add new sprites, which makes me really excited, because I can finally add some cool, elaborate animations to my game! The work you guys have done in the new beta version on the sprite import and organization is really visible. Sprite folders are loaded faster, and the import is way faster, and does not slow down when I add dozens of high resolution sprites.

With that said, the initial warning that you also saw remains, which does not hinder my working, but is maybe just annoying.
Do you want to get to the roots of this problem?
I might re-upload the game with the correct sprites if it would really help, but I don't think it is necessary, also because you could simply add ANY kind of sprites as place holders for the blue dummy sprites I believe, in order to test it. It does not change anything to the cause of the problem.

TheManInBoots

While testing the new beta version, and the sprite import, in my project but also in new projects, I came across a few bugs that the new beta version still has. I'm sure you guys are working on it, and I don't know if that is interesting to you, but this are the things that did not work correctly:

When I try to Assign Sprites to a View by Right Clicking on them (in any project), I get a big Error Message:

These two:

https://drive.google.com/file/d/1XWoiLcPGc1KfyYYAhXTN3lrff3V5-rWJ/view?usp=sharing

https://drive.google.com/file/d/1_Sj3JxRRv9bdvkE_HI0ZHm7h5GGoJmYi/view?usp=sharing


In written form:

Error: Input string was not in a correct format.
Version: AGS 3.5.0.16

System.FormatException: Input string was not in a correct format.
   at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
   at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
   at System.Convert.ToInt32(String value)
   at AGS.Editor.SpriteSelector.SpriteContextMenuEventHandler(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripMenuItem.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.ToolStripDropDown.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 System.Windows.Forms.ToolStripDropDown.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)


So now I have to add every single sprite manually to a view loop by clicking on the "Create new Frame" button in the view tab.
Because the "Create new Frame" button moves further to right for each frame you add, and it's kind of annoying to follow the the button with your cursor to keep clicking, I avoided that problem by restoring down the program and adjusting the proportions so that the two sides, left and right, are very close together, because then you keep seeing the button on the same spot and you can just keep clicking it and adding new sprites. But when I did this I noticed another tiny bug: When you restore down the program like that and "squeeze" the right and left side of the program window together, and then click on the work space, sometimes when afterwards you maximize it the proportions of the property panel gets messed up. Meaning that the right column, where you read and type in the property values is moved to the right and you cannot see or read the values anymore, so I have to re-adjust that after I maximized the program again.


Another bigger bug is that everytime after running the game I get (in all projects, no matter which room or game) this error message:

https://drive.google.com/file/d/1URyVAO30_9AWnYVe17V44bn8zlSGKcq6/view?usp=sharing


Also, sometimes when you open a sprite folder, the tab all of a sudden switches by itself and I would find myself on a view tab, and I would have to click on the Sprites tab again to view the sprite folder I opened.


And I think a great thing would be to add an optional x- and y- offset for the FollowCharact(_EXACTLY) function, because this way you could very easily add shadow below the character without messing up baselines, it would be really useful for that. As for now if you add a z-Value to either the original character or the shadow character, it does never change the distance of the characters to each other, the program always aligns them on their original Baselines, so you never have an actual offset between the two, and you can't just create a shadow character below the original character to follow him around. This kind of leans in to another thread I posted, but we talked about the new version here, and if you think too that this might be useful, I think it'd be a great feature.



Crimson Wizard

Quote from: TheManInBoots on Fri 13/09/2019 15:35:56
So the sprites that were replaced by the dummy blue cup, that was mostly an unlucky coincidence. With the bug I had when I saved new sprites, it would not save them but I would only get those blue dummy cups when opening the project again. But only sometimes it would save also some of the old files as blue dummy cups, that usually were saved correctly. So apparently just before I uploaded the game I saved the game and the sprites were saved as blue dummy sprites, but that was all due to the bug I described.

However, after installing the new version, I re-imported from source ALL my sprites, just to be sure.
However I still keep getting the same warning that you quoted in your message everytime I open the project, even though I have not a single blue dummy sprite anymore.


Hmm maybe I missed something, or maybe sprite manager does not work as I thought (not displaying wrong sprites perhaps?) I will look into this again.

LATER EDIT:
I tested more and found out that as you restore sprites the "missing" number actually decreases (although not always correct - see below), so this part works. Just a guess, the sprites you may still be missing are numbers somewhere between 2105 - 2060 and these are sprites from the original game template which you cannot restore without original source.

However, more importantly, I found out there's another serious problem with the whole "substitute with blue cup" thing that may lead to more crashes when viewing the sprite manager if you fix few sprites, save the game and continue to browse sprites. I will have to fix this once again. Maybe I will also add a function that prints missing numbers to the text file for convenience.



Quote from: TheManInBoots on Fri 13/09/2019 16:05:18
Another bigger bug is that everytime after running the game I get (in all projects, no matter which room or game) this error message:

https://drive.google.com/file/d/1URyVAO30_9AWnYVe17V44bn8zlSGKcq6/view?usp=sharing

This was already fixed (version could be downloaded from the build server artifacts, e.g. here: https://cirrus-ci.com/task/5958941248323584 , but it may be temporary).
It is simply that the editor does not recognize engine's exit code correctly and thinks that something is wrong.


I will make a record of other problems you posted and put them on our issue tracker.


Quote from: TheManInBoots on Fri 13/09/2019 16:05:18
So now I have to add every single sprite manually to a view loop by clicking on the "Create new Frame" button in the view tab.

Note you can also right click on view frame itself and "assign sprites from folder" (which seems to do similar thing).



Quote from: TheManInBoots on Fri 13/09/2019 16:05:18
And I think a great thing would be to add an optional x- and y- offset for the FollowCharact(_EXACTLY) function

We prioritize fixing bugs now for 3.5.0, so new features and similar enhancements will be planned for next development period. But in regards to FollowCharacter, I believe you could try positioning "shadow" character yourself using charater.x and character.y properties either in repeatedly_execute_always or late_repeatedly_execute_always.

TheManInBoots

NO! You're totally right!

The original Sierra Game Template sprites were saved in sub-folders in the "stone roll" folder!
I tried to delete what I could delete of them a long time ago, and then I completely forgot about them!
I also never understood how they ended up in the stone roll folder.

Those ARE the sprites that are missing and still had the "blue cup dummy disease"!

So I changed all the references where those sprites were used and deleted them, or re-imported them from files, because source import was impossible!
Now I do not get that message anymore!

So it's solved, I just did not take care of those template sprites, the issue was not with the program, the program works just perfect with the testing of the Sprite saving!
Oh yeah, printing the missing numbers to the text file is a great idea! As soon as you told me the sprite number 2105 and mentioned game template, I knew immediately what the problem was. Also it would make it more professional!

I installed the newer version via the link you sent and now the editor recognizes the exit code, so that works now as well!

Yep, assign sprites from folder works, which leaves always the initial view frame and you have to delete it manually for each loop, but it works.
I also found out that you can click only once on the "Create New Frame" button, and then press and hold the Enter button to really quickly add frames that follow!

I implemented positioning in "Repeatedly Execute" for a shadow and yes, it works just fine.

I noticed two more things, I am not sure if you can call those bugs, but it certainly inhibits the work flow:
When you open a view tab, it sometimes takes a really long time to load the different loops, so it really lags sometimes and becomes really slow, as soon as you have several loops and some of them contain more than 20 sprites.
And then when you scroll down or up, then everything is being misplaced for about 4 seconds, until the correct view is slowly loaded. It is really uncomfortable looking at the view tab and editing the view because of that. Especially with an increasing loop number it becomes more and more unpleasant and difficult to find and edit a certain loop, because for each little scroll you have to wait 4 seconds.

And the other thing is that when Importing files I would really like to just press 'enter' in the import window instead of clicking on the import button every time.
That would really speed up the work flow. I assume that you guys probably would implement that in any case while advancing the beta version, since you're working so industriously on it, but that's what I noticed.


Btw., is there a way to turn off the notification every time you start AGS (the message that this is a beta version and you should be careful)?

Also I really like your style, Crimson Wizard, the way you help out and work on issues, I think it's really intelligent and it has been really helpful!



SMF spam blocked by CleanTalk