2/12/18 and Memory
Added 2018-02-12 14:21:13 +0000 UTCHi folks,
Another blog about on the pitfalls in game design today. So the other night, I was working on adding the talking animations for the various expressions. Things were working fine and as expected after the first test, so I started to make similar animations for the rest of the expressions. A few step in, I got a message from Construct saying that the game's memory is getting excessively high. That surprised me, considering I had only added a few animations of about 15 or so frames each. Long story short, the images I had used, even though they only had 100px wide images shown, were actually the same size as the full body portrait that was present in the last demo, with a huge amount of empty space. Intuitively I felt this wouldn't be an issue, but after looking into some documentation I found that even with the invisible pixels, memory is still used. So the game was running animations with large images every change of a text box, and it caused a huge usage of memory.
What I learned from this, is that I'll need to balance quality of images and memory usage better. I'm preparing to scale down the player portrait, and I've already taken steps to make the mouth-sprite object to only include the mouth area themselves.
The next update will be mostly an extension/correction of the last one, and I'll hopefully be able to get it out this week, before the weekend if I plan right. It'll include the talking/blinking animations along with possibly a new text box design.
Comments
Thanks, I think I was also blowing it out of proportion with the larger images. After fully replacing everything with the more compact images, I'm now down to 31mb. Much more manageable.
Bagool
2018-02-13 02:55:30 +0000 UTCOh god that's horrible, it sounds like they're essentially forcing you into object pooling which trades RAM for CPU time, that's the sort of stuff you do when you're getting a CPU bottleneck (not something you're ever likely to encounter in a game like this). Good luck!
2018-02-12 23:02:52 +0000 UTCThat's another point to the issue that I didn't feel was worth covering. Apparently every layout (or room as you could call it) preloads all of the objects on it. So if I have the mouth object as before, with it's dozen or so animations featuring a dozen or so frames with each frame being the same size as the main picture all being kept in the background while the game runs, then that'll really tax the system. Before, with my mouth animations nearly done I was pushing a gb of RAM usage. Now with nearly the same amount of content but with resized images, I'm only getting 70mb. It'll be more difficult, but I'm going to need to come up with a way to destroy and create the portrait at a certain position when I need it. All of this is pretty new to me, but I think I've gotten the hang of it now.
Bagool
2018-02-12 22:26:47 +0000 UTC