ID:132197
 
I'm creating a game that I knew would be somewhat memory intensive from the beginning. Prism uses pre-rendered graphics so it is easy to generate high-FPS, 8 direction animations. I have posterized my sprites down to about 16-20 levels and reduced the number of frames to a bare minimum. The numbers I'm about to cover are from before I reduced my file size. I'm bringing this up because I would really like to use more than 3-4 frames per animation.

I have things working OK now, but I'd still like to know why DMIs take up SO much memory in DS. Here are some examples:

Base human dmi: 3376 kb on disk
...when loaded onto a map in dream seeker: 130,504 kb
Boots armor overlay dmi: 1890 kb on disk
...when loaded onto a map in dream seeker: 104,684 k
Chest armor overlay dmi: 3131 kb on disk
...when loaded onto a map in dream seeker: 104,932 k

[edit]I should mention that the above numbers were retrieved using a completely blank project and loading the DMIs one at a time onto the map. There was no other code or resources that could have reflected upon the numbers.

The end result is 15.4 megs of art taking up a memory footprint of 742 megs.

Like I said, I've managed to shrink my file size down considerably (15.4 megs down to 4-5 megs). Even with the reduced size, I'm concerned that multiple characters with different armor on the map will take up obscene amounts of memory.
I'm looking forward to some insight.
DMI's are a compressed format (PNG) on disk, but reside in RAM uncompressed. We could improve this since we don't really need the full DMI in memory (it's used primarily for masking)... your numbers are concerning for sure!

That said, it usually isn't an issue because DS will unload icons as needed-- it only really needs to load into RAM those icons that are in use. I can't recall the heuristic we use for this (it's something I can look up). You could always play with it more and see if this is problematic for you.
In response to Tom
Tom wrote:
DMI's are a compressed format (PNG) on disk, but reside in RAM uncompressed. We could improve this since we don't really need the full DMI in memory (it's used primarily for masking)... your numbers are concerning for sure!

That said, it usually isn't an issue because DS will unload icons as needed-- it only really needs to load into RAM those icons that are in use. I can't recall the heuristic we use for this (it's something I can look up). You could always play with it more and see if this is problematic for you.

Thanks for the speedy reply, Tom! I'd like to see further investigation into this, so I will post it as a feature request. For the time being, I have been able to compress the number of colors/frames so that this isn't a huge problem for me.
In response to Tom
If you wanted to improve DMI's one of the first things you might want to look into is a method of dealing with duplicate frames.
NefariousDevelopment wrote:
Base human dmi: 3376 kb on disk
...when loaded onto a map in dream seeker: 130,504 kb
Boots armor overlay dmi: 1890 kb on disk
...when loaded onto a map in dream seeker: 104,684 k
Chest armor overlay dmi: 3131 kb on disk
...when loaded onto a map in dream seeker: 104,932 k

[edit]I should mention that the above numbers were retrieved using a completely blank project and loading the DMIs one at a time onto the map. There was no other code or resources that could have reflected upon the numbers.

Are you sure it's empty project?
My project with 360 icons each 7 KB (equals 2,520 KB) takes only 26 MB in memory. Anyways, 64 MB difference is huge. That's like uncompressed 4096x4096 texture.
In response to Zaoshi
Zaoshi wrote:
NefariousDevelopment wrote:
Base human dmi: 3376 kb on disk
...when loaded onto a map in dream seeker: 130,504 kb
Boots armor overlay dmi: 1890 kb on disk
...when loaded onto a map in dream seeker: 104,684 k
Chest armor overlay dmi: 3131 kb on disk
...when loaded onto a map in dream seeker: 104,932 k

[edit]I should mention that the above numbers were retrieved using a completely blank project and loading the DMIs one at a time onto the map. There was no other code or resources that could have reflected upon the numbers.

Are you sure it's empty project?
My project with 360 icons each 7 KB (equals 2,520 KB) takes only 26 MB in memory. Anyways, 64 MB difference is huge. That's like uncompressed 4096x4096 texture.

Positive. All I did was create a blank project with verbs for adding icons to a mobs overlays. I recorded the memory results after each addition and subtracted from the previous addition to get the memory foot print of individual icons.

It sounds like I am dealing with much bigger files than you are, so I am probably seeing a more drastic disk:memory ratio than you are.
In response to NefariousDevelopment
NefariousDevelopment wrote:
Zaoshi wrote:
NefariousDevelopment wrote:
Base human dmi: 3376 kb on disk
...when loaded onto a map in dream seeker: 130,504 kb
Boots armor overlay dmi: 1890 kb on disk
...when loaded onto a map in dream seeker: 104,684 k
Chest armor overlay dmi: 3131 kb on disk
...when loaded onto a map in dream seeker: 104,932 k

[edit]I should mention that the above numbers were retrieved using a completely blank project and loading the DMIs one at a time onto the map. There was no other code or resources that could have reflected upon the numbers.

Are you sure it's empty project?
My project with 360 icons each 7 KB (equals 2,520 KB) takes only 26 MB in memory. Anyways, 64 MB difference is huge. That's like uncompressed 4096x4096 texture.

Positive. All I did was create a blank project with verbs for adding icons to a mobs overlays. I recorded the memory results after each addition and subtracted from the previous addition to get the memory foot print of individual icons.

It sounds like I am dealing with much bigger files than you are, so I am probably seeing a more drastic disk:memory ratio than you are.

it doesnt "SOUND" like you're dealing with much bigger files.YOU ARE dealing with much bigger files,i mean if you're still talking about that 3D Project of yours,Than the size of those files are totally normal!
In response to Kidpaddle45
No, they're not normal.
In response to Darker Legends
LOL Someone deleted my comment? O.o

Well i'll repeat:
I'm pretty sure the issue is actually from the fact that the DMI files were made to support 2D Icons and his are 3D.
They were made using multiple 3D Program and lets not forget that they are animated.
In response to Kidpaddle45
The graphics don't contain any 3d related data. Each frame of animation is rendered sequentially into one PNG, and then that png is altered to be DMI-compatible. Or maybe each frame is a separate image and is then loaded into DM's icon editor manually. Either way, there is no 3D related stuff going on in the game. Nor in BYOND.
In response to Metamorphman
Metamorphman wrote:
Nor in BYOND.

Not true. There are quite a few 3D demos, which seems to always result in something that looks like the original DOOM.
In response to Medicator
No that's just 2D made to look 3D, and even then those games are really slow. BYOND will never go 3D at this point.
In response to ExPixel
http://lmgtfy.com/?q=define%3A3d

By definition, they are 3D games. All 3D games use 2D objects(or 1D in the case of points) to make a game that appears 3D.

Also, yes, they're very slow and they'll never have any purpose in BYOND, but it's interesting nonetheless.
In response to ExPixel
ExPixel wrote:
and even then those games are really slow.

Slow.. see below!

http://www.byond.com/members/onefishdown

Pay attention to http://www.byond.com/games/OneFishDown/TheRoyalNonesuch

I just wish he released the source a wave of old-school runescape type games would of hit BYOND and possible made us greater!