ID:2306646   Oct 18, 11:41 pm (See the best response by Ter13.) Whenever an animation is activated for the first time it appears choppy as though it is loading it or something. Also I noticed same thing for my maps, I have 3 dmi files for each continent when I go close to a continent I get 1 sec lag, but that only happens once for each graphic. I mean aren't they already loaded at compile time??
 <-> Oct 19, 7:12 am Do you have your preload_rsc set? If it's set to 0 then no resources are preloaded and you only download them as you need them. 1 preloads all the compiled resources. 2 preloads all the compiled and dynamic resources.
 <-> Oct 19, 8:01 am In response to IceFire2050 Best response IceFire2050 wrote: Do you have your preload_rsc set? If it's set to 0 then no resources are preloaded and you only download them as you need them. 1 preloads all the compiled resources. 2 preloads all the compiled and dynamic resources. This won't make any difference. preload RSC only affects how stuff is sent between client and server. Just because the client has the graphics downloaded doesn't mean it's in memory yet. Victorqr is running into streaming latency. Basically the animation that he's running isn't loaded in memory yet. The time it takes to expand PNGs varies greatly because PNGs are a compressed data format. The only way to prevent this is to force graphics to be loaded ahead of time by showing them to the client. One workaround is to output the icon to a hidden output element on the screen when the user logs in. Take any extremely large graphics with lots of frames of animation and jam them into a list. Then output them to that hidden output element one at a time. This will lock up the client, but will force the graphic to be loaded into memory so that when you are ready to show it it won't be choppy. Another option is to just not use overly large animations with a ton of frames.
 <-> Oct 19, 9:18 am well I don't have much of a problem with animations as I have with some dmi files containing many large objects. And yeah I'm trying to cut back on graphics since I went overkill with large icons. Btw now that we mention the preload_rsc is it possible that I split graphics in 2 rsc like main map rsc and level interior rsc. Since they use entirely different graphics I mean I've never tried anything like this, will it be effective? Also is it possible that byond will improve support for games with many resources?? I mean I get almost 0 lag from code but graphics are killing me.
 <-> Oct 19, 10:07 am Btw now that we mention the preload_rsc is it possible that I split graphics in 2 rsc like main map rsc and level interior rsc. Since they use entirely different graphics I mean I've never tried anything like this, will it be effective? Also is it possible that byond will improve support for games with many resources?? I mean I get almost 0 lag from code but graphics are killing me. You could do that, but when you compile an included rsc file, it gets compiled into the project's main RSC file, so it wouldn't make a difference.
 <-> Oct 19, 10:10 am Feared so, so there is no way that I can remove graphics and add dynamically later??
 <-> Oct 19, 10:19 am There is, but using the dyn.rsc will only make matters worse. The problem is that BYOND is only loading graphics on first use on the client rather than loading them ahead of time. The only reasonable way to force graphics to be loaded ahead of time is to collect them in a list like I said, then display them in an output to a client at login. Or you could literally generate an object with one of every icon file included in your project using locate() \ref to pull them sequentially from the RSC, and then show it to the client during loading... But again, this is kind of a weird way to go about this.
 <-> Oct 19, 11:46 am Yeah I got it first option seems better. What I wanted though was like a system where I can selectivelly load/unload resources from cache so it wont get bloated, but anyway since the game is not yet ready I'll leave optimizations for the end, I will fix the memory loading though by loading them to the client thanks for the help.
 <-> Oct 21, 4:50 am (Edited on Oct 21, 7:56 am) Ok tried it and it works wonders no more lag or weird crashes. But I noticed that unit animations take a lot of RAM like 500MB for each unit. And I also noticed each time I output the graphics RAM keeps increasing. Shouldn't RAM increase only on the first time?? I just do this usr<<'Footman_Idle.dmi'; And I get 60MB RAM cumulative each time command executed What are the limitations in animations in terms of size and frame number?? I use 8Dir movement. I have already reduced frame number like *Walk 27 frames *Run 21 frames *Idle 45 frames *Attack 46 frames *Hit 22 frames *Death 52 frames Is there anyway I can optimize units?? Maybe its a bad thing I'm using rgb16?? I can convert them to rgb8.
 <-> Oct 21, 8:55 am PNG files use 4 bytes per pixel when loaded into memory. They are stored as one big sheet, so the total dimension of the texture * 4 bytes is how much memory they take up. If you are doing icon operations on a file, that makes a whole new icon file. If your assets are seriously that big, you need to really heavily consider reducing your asset load.
 <-> Oct 21, 9:12 am I see thanks for the clarification, I noticed that due to horrendous grouping I have small icons with very large canvases, I didn't consider that empty pixels would also take up space. I'll also reduce frames in certain animations and create smaller loops.
 <-> Oct 21, 1:10 pm (Edited on Oct 21, 1:39 pm) Ok I calculated all the graphics individually and it summed up to 5.2GB. So yeah I seemed to do something terribly wrong decreasing canvas sizes I managed to get it to 2GB but I fear that it is still a lot because after 1600MB I get random crashes. So I'll keep cutting stuff I guess I'll be safe around 1500MB, what is the maximum value of RAM consumption that BYOND can operate safely on?? damn I haven't even added sounds yet, are sounds RAM heavy?? But seriously isn't there any kind of control to remove unused stuff from RAM like deleting stuff or something? Deleting atom does not reduce RAM maybe I need somehow to delete the appearance prototype...
 <-> Oct 21, 1:54 pm What the hell are you doing? 1.5Gigs of sprites?
 <-> Oct 21, 2:12 pm 900MB are unit sprites and 200 their cloth masks rest graphics account to around 800-900MB but I can cut them down like 400-500 MB more. 20 units x 6 animations x 8dirs with 80x80 size. initially they got 5GB because I had them 200x200 I never tested all the graphics together and didn't realize empty canvas makes a difference to be honest I assumed that graphics more or less eat up as much RAM as hard drive space. I can reduce frames by 30% easily(since they are rendered from 3D models) But I also noticed that a small sound file 4 MB ate up around 50MB of RAM I mean that sounds a lot if I have 15 tracks that gets really high, So if there is a way for removing assets from memory dynamically I will be able to manage everything. Since as I said all graphics are split between main map and level map. Just deleting object didn't work
 <-> Oct 21, 4:08 pm Good lord 1.5gb
 <-> Oct 22, 1:23 am Ok got everything to the lowest possible, it all works without the crashes at around 1450MB. But now I'm worried on sound and video cut-scenes is it possible to play them with an external player?? I mean run works but I don't know how to close the file later. And also I get a permission dialogue for each run that really breaks the game. I'd like it to play externally on the background without player noticing it. Also memory management on graphics should be a standard feature I mean most rts games use a lot more assets than I did. Also wouldn't it be great to be able to display a graphic and when no longer needed to be able to remove it from memory?? And when you are about to need it again you can add it again, this is not unreasonable in most engines its the garbage collection norm. Isn't this feasible in Byond?? maybe there could be an automatic behavior like Client/CleanUnusedGraphics=0 0 is default behavior and =1 would also free Memory when a certain graphic is not used anywhere. Or if that is too much there could be an experimental feature where we could get a reference of an object in memory and then manually remove it. That would allow us to do this: ` var/sound/s=sound('MainTheme.ogg'); usr<
 <-> Oct 22, 10:30 am How the hell are your resources so big? I thought mine was bad and I have around 270MB worth of resources. And that's for a card game with 12000 cards, each with a unique 32x32 icon with 4 directions along with about 200 of them having a 160x160 icon with 4 directions.
 <-> Oct 22, 10:31 am ...I really think you are doing something intensely stupid if you are using 1.4 gigs of sprite data.