Can I improve high resolution animation that lags?

Started by TheManInBoots, Sun 17/11/2019 19:52:38

Previous topic - Next topic

eri0o

QuoteDynamic Sprites. These cannot be released until game author tell so by calling DynamicSprite.Delete(), obviously

Wait, if a dynamic sprite goes out of scope (losing that pointer forever), it doesn't get deleted?

Crimson Wizard

Quote from: eri0o on Mon 20/01/2020 22:03:51
QuoteDynamic Sprites. These cannot be released until game author tell so by calling DynamicSprite.Delete(), obviously

Wait, if a dynamic sprite goes out of scope (losing that pointer forever), it doesn't get deleted?

It does get deleted. I did not want to go into each detail about dynamic sprite, because it's not relevant to the issue.

eri0o

Thanks!

TheManInBoots

#43
I'm glad, those are valuable insights Crimson Wizard.

It's cool to know all this. I experimented with it, and I was able to reduce the locked sprites to 100 KB in my original game with the video intro.

What striked me however is that it tells me that I have only 131172KB total sprite cache available. Only 131 MB?

I set the Sprite cache to 2 GB in Default Setup.
I saved the game in the editor.
I built the .EXE file.
I ran the game from the editor.
I ran the game over the winsetup file. Same result.

I have 3,84 GB usable RAM.
I have 1,759 GB total Graphic card memory.

Why could it be that I have only  131MB free cache??


Quote from: Crimson Wizard on Mon 20/01/2020 21:24:13
Thing is... it does not seem to unlock locked sprites after calling Mouse.ChangeGraphic again.
Ok, good thing we also talked about the other means to preload sprites! It's always good to find out a little bit more beyond what seems relevant at the moment!

Quote from: Crimson Wizard on Mon 20/01/2020 21:24:13
I also found another bug, related to locked size counter
Does the locked size counter actually have a limit?

Quote from: Crimson Wizard on Mon 20/01/2020 21:24:13
I also removed obligatory player's view precaching. That made game startup almost instant for me.
Same for me, with your plugin there is no frozen black screen.


Side note: The character who's view sprites are locked into cache is always the character ID 0. I tried setting different characters as player anywhere in the scripts before the room was loaded, but that did not work (maybe it could be possible if you communicate directly to the machine...). I think it's not the first player's view, but simply Character ID 0's view that is being locked.
In order to reduce locked sprites I set character ID 0 to an empty view and created a different character whom I set up as my player.

Also interesting to know: the Speech, Idle and Blinking view are not being locked into cache. Only the normal view.

Crimson Wizard

#44
Quote from: TheManInBoots on Wed 22/01/2020 20:20:36
What striked me however is that it tells me that I have only 131172KB total sprite cache available. Only 131 MB?

I cannot answer this, what are other numbers in the message? It should say "Sprite cache size: X (limit Y, locked Z)".

Quote from: TheManInBoots on Wed 22/01/2020 20:20:36
Does the locked size counter actually have a limit?

Yes, technically it's 4 billion, as a 32-bit unsigned integer, but it is not used for anything but statistics.

Quote from: TheManInBoots on Wed 22/01/2020 20:20:36
The character who's view sprites are locked into cache is always the character ID 0. I tried setting different characters as player anywhere in the scripts before the room was loaded, but that did not work

You can set it in the editor, by opening a character for edit and pressing "Make this the player character" button (it's right above the view preview).

TheManInBoots

#45
Quote from: Crimson Wizard on Wed 22/01/2020 20:34:56
what are other numbers in the message? It should say "Sprite cache size: X (limit Y, locked Z)".
It says:
Code: ags
Sprite cache size: 78319KB (limit: 131172 KB, 100 locked)

But actually don't worry, it's fine.
As soon as the sprite cache size surpasses the limit, the limit grows with it, so it's not actually a problem for me.
I thought the limit defines the maximum cache size.
Quote from: Crimson Wizard on Wed 22/01/2020 20:34:56
You can set it in the editor, by opening a character for edit and pressing "Make this the player character" button (it's right above the view preview).
Oh yes of course, you're right. Been so long I used the button, I didn't even see it! Thanks.


And anyways, I'm happy you also found a few things that can be improved in the engine and that can make the program better.

Crimson Wizard

Quote from: TheManInBoots on Fri 31/01/2020 00:04:41
It says:
Code: ags
Sprite cache size: 78319KB (limit: 131172 KB, 100 locked)

But actually don't worry, it's fine.
As soon as the sprite cache size surpasses the limit, the limit grows with it, so it's not actually a problem for me.
I thought the limit defines the maximum cache size.

It should! so... weird. But if you are running that test build I made, maybe I broke something else unintentionally...

TheManInBoots

#47
Hm... It's actually when I build and run the normal game from the editor. And I tried it out, it's the same when I start it via the winsetup.
This sprite cache seems to be a real trouble maker!
You told me about the counter that is inaccurate. The sprite limit is not very accurate now as well it seems. Maybe I'm just interpreting it wrong.
However I wonder if multiple inaccuracies like that could also lead to game crashes in more extreme situations, like high resolution animations.

EDIT: Just to clarify what I meant by it, because I talked about inaccuracies before in this thread:
If the game does not keep track correctly of the statistics (the sprites, the maximum sprite cache etc.) maybe some calculation will create an error or the engine believes sprite cache is full even though it isn't.

SMF spam blocked by CleanTalk