Maximum number of sprites?

Started by TimeTravellerR, Mon 20/08/2018 12:49:30

Previous topic - Next topic

TimeTravellerR

Hello,

what is the maximum number of sprites possible in a single game? I have a feeling I have hit the limit...

Crimson Wizard

#1
The latest stable 3.4.1 release has a limit of 30.000 sprites, and 2 GB of total size of sprites.

The next version, currently in WIP state, will have these two limits raised or removed completely.

Brief information on limits may be found in the manual: http://www.adventuregamestudio.co.uk/manual/ags83.htm#topic84

Slasher

It would take some doing and an enormous game to break the barrier (nod)

Monsieur OUXX

Quote from: Slasher on Mon 20/08/2018 14:04:36
It would take some doing and an enormous game to break the barrier (nod)

It depends if you design your game in an old-school manner or in a "modern" way. Nowadays, many animations are automatically generated (for example, imagine some rain falling, or the flickering surface of a lake -- generated using After Effects or Blender for example). If each animation has like 100 frames , then the total number can grow pretty fast.
 

Crimson Wizard

Also DynamicSprites are counting towards this limit, so if you are generatic lots of sprites and not deleting them you will run out eventually. (Well, if you are not deleting them you will run out memory anyway)

TimeTravellerR

Why I asked is that there are approximately 1,000 sprites in my game file, but adding just two more for a fighting animation crashes the game engine every time.

I have created a new game and I will continue making rooms in the new game.

This is for a non-game project so it doesn't matter that there are multiple game files.

But still it was very disturbing when you are happily adding more sprites then adding just two more and it crashes.

Thank you for your responses.

Crimson Wizard

How does it crash, what is the error message?

1000 sprites is pretty low, what is the resolution of the game you are working with and what's size of "acsprite.dat" file in your game folder?
If it's really approaching 2GB one final option that you have is turn sprite compression in General Settings, depending on case it may reduce sprite file size in half or more.

TimeTravellerR

Error message:

Error: Exception of type 'System.OutOfMemoryException' was thrown.
Version: AGS 3.4.1.12

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
   at System.Text.StringBuilder.set_Capacity(Int32 value)
   at System.Xml.BufferBuilder.ToString()
   at System.Xml.XmlTextReaderImpl.ParseText()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.Load(String filename)
   at AGS.Editor.ImportExport.ImportCharacterNew(String fileName, Game game)
   at AGS.Editor.Components.CharactersComponent.ImportCharacter(String fileName)
   at AGS.Editor.Components.CharactersComponent.ItemCommandClick(String controlID)
   at AGS.Editor.Components.BaseComponentWithFolders`2.CommandClick(String controlID)
   at AGS.Editor.GUIController._mainForm_OnMenuClick(String menuItemID)
   at AGS.Editor.ProjectTree.ContextMenuEventHandler(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)

appears in a greyish dialog

Slasher

Quote1000 sprites is pretty low, what is the resolution of the game you are working with and what's size of "acsprite.dat" file in your game folder?
If it's really approaching 2GB one final option that you have is turn sprite compression in General Settings, depending on case it may reduce sprite file size in half or more.
I've never done this and wonder if there is a downside to this as it's obviously not reversible...

Crimson Wizard

#9
Quote from: TimeTravellerR on Wed 22/08/2018 08:05:46
Error message:

Error: Exception of type 'System.OutOfMemoryException' was thrown.
Version: AGS 3.4.1.12

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
   at System.Text.StringBuilder.set_Capacity(Int32 value)
   at System.Xml.BufferBuilder.ToString()
   at System.Xml.XmlTextReaderImpl.ParseText()
   at System.Xml.XmlTextReaderImpl.ParseElementContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
   at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.Load(String filename)
   at AGS.Editor.ImportExport.ImportCharacterNew(String fileName, Game game)

This error indicates not a sprite import, but Character import. Is this actually the same error you were having earlier?
Here the "out of memory" exception occurs when the AGS is trying to allocate a memory for a string probably trying to read contents of the character file.

What is the size of this character file you were importing?


Quote from: Slasher on Wed 22/08/2018 09:06:02
Quote1000 sprites is pretty low, what is the resolution of the game you are working with and what's size of "acsprite.dat" file in your game folder?
If it's really approaching 2GB one final option that you have is turn sprite compression in General Settings, depending on case it may reduce sprite file size in half or more.
I've never done this and wonder if there is a downside to this as it's obviously not reversible...

It is reversible since AGS uses lossless compression, but if uncompressed size has already got over 2GB then switching compression off would break the file.
The downside of compression is that loading times may be slower during the game (the result depends on game resolution, but probably not a big problem for modern computers).

TimeTravellerR

I get this message importing a character with 9 views - pretty bog standard and with 9 sprites per loop for a total of 81 sprites including the flipped loops for left right etc.

Virtually same message when I import two more sprites, to create a new view, add them to the new view, and then run...

...and it crashes without running.

I have created a new game to import characters into new scenes, and now it won't import some of the character either. I am experimenting at the moment to see if it will import one or two characters then crash or if it is specific character that crash it.

One thing- some of these characters include large picture files, much larger than "normal". But then, why is it crashing when they come into a new game when they were already successfully loaded in the old game?

All a bit of a puzzler. As I said, fortunately this is not with the aim of a compiled game, but unfortunately if it keeps happening my project has hit a rather large rock.

Crimson Wizard

#11
Quote from: TimeTravellerR on Thu 23/08/2018 07:12:14
Virtually same message when I import two more sprites, to create a new view, add them to the new view, and then run...

...and it crashes without running.

Sorry, it's hard for me to believe that the error message is exactly the same when you do different operation. Is it still possible check for the actual error message again? Also, you say it crashes without running, is it editor that crashes or the game starts and then crashes?

Quote from: TimeTravellerR on Thu 23/08/2018 07:12:14
One thing- some of these characters include large picture files, much larger than "normal". But then, why is it crashing when they come into a new game when they were already successfully loaded in the old game?

I do not know much details, but may make a guess that in the old game you probably were adding sprites part by part, but when you try to import a character file containing all those sprites in XML format (probably it uses base64 encoding, but not sure) the XML document is too large for the program to parse at once. This is just a guess.


Anyway, something that needs to be checked out also, how large your sprite file is already? It's called "acsprset.spr" (I think I gave wrong name earlier) and located in the game project root folder. If it's close to 2GB already then this may also be a cause of errors, but if it isn't then there might be something else causing the problem.
Also, what is your game's native resolution, and average sprite sizes?

SMF spam blocked by CleanTalk