rbray89

[1.0][Release-5-0][April 28, 2015] Active Texture Management - Save RAM!

Recommended Posts

Correction on an earlier posting.

I had an issue where Active would make contracts disappear, but if Active is the only mod, the contracts are fine. Wonder if this changes things...But its weird that contracts, alone, would be affected, anyways?

What do you think I can do?

- - - Updated - - -

This disables contracts. Sorry, got no log files of it though.

Active Team -

For a file having the same issue with multiple mods, click here:

http://forum.kerbalspaceprogram.com/threads/96581-No-Contracts-Texture-ram-mods

There is an output log attached and a description of the issue.

Edited by Friend Bear

Share this post


Link to post
Share on other sites

I wish I could be a better tester, but I am a little sick. I did do some spelunking last night as I tried to get KSP to run. I experienced that, like others have shared, I cannot run KSPx86 with as many mods as I could before. I was able to get it to run, but the crashes were incredibly-ridiculously frequent to the point of unplayability.

I have been able to run KSPx64 with little issues before so I tried it as well and I got VERY poor performance at the main menu and in-game; about 4-6fps and it eventually crashed. After a while I tried again, this time without ATMx64 and it worked beautifully. So there are definitely still issues going on. In addition to the poor FPS I noticed the following issues/conflicts:

-Some toolbar Icons were shrunk and blurry as others described

-The career flags get duplicated

-Most stock textures look blurrier

-Texture Replacer does not work at all

Anything else I can do to help test, let me know.

Share this post


Link to post
Share on other sites
So things are still a little unstable. without ATM, i was crashing every couple of loads. With atm, im not crashing, but i come across peculiar bugs like ships not loading past the command pod and.... God.

http://steamcommunity.com/sharedfiles/filedetails/?id=326151084

EDIT: Close and reload did not fix ship not loading, or make God go away. Game broken.

Screenshot looks like pretty much like RealChute bug. Try updating it to xxx.3 version or disabling for test purposes.

I'm getting constant startup crashes (in the end of loading, after Module Manager patches are being applies, last string of text I see is something like /Squad/blabla/fueltank3-2). There is even no crash report to show =\ Without ATM loading completes ok. Any ideas where to start looking?

Edited by Mystique

Share this post


Link to post
Share on other sites

I can say with some (MUCH) degree of certainty that the cfg files we have in-place are being used. That being said, with the new additions, there may be config updates that are required to optimize the textures for display.

Share this post


Link to post
Share on other sites

Prior to 0.25 and the latest ATM, it seemed as though GameData subdirectories were not being accessed by ATM unless there was either a .cfg for the directory in BoulderCo/ActiveTextureManagerConfigs or the mod provided its own. However, now it appears like ATM is seeing everything and using the default configuration (ActiveTextureManagement/config.cfg) unless there is an override. Several mods that I previously didn't have .cfg files for, and that only have icons/small UI widget textures, are now being scaled:

  • FAR Editor Analysis (Toolbar)
  • Fusebox
  • Distant Object Enhancement Settings
  • ActionGroupManager
  • KSPScienceLibrary
  • StageRecovery

Additionally, Squad changed the folder layout of the GameData/Squad folder slightly, so there is a slight change needed for the Squad.cfg. TaranisElsu's TAC mods have also been reorganized, as well as Universal Storage. For reference, I've collected my additions/changes in a .zip file available here: WIP ATM Configurations.

These are not endorsed by rbray89 so if you try them and things explode, don't blame him or ATM! These work for me!

Edit: Perhaps icons/UI widget textures could be ignore by ATM (at least for scaling) by detecting dimensions and skipping anything smaller than, say, 100x100?

Edited by ozraven
Suggestion added.

Share this post


Link to post
Share on other sites
Prior to 0.25 and the latest ATM, it seemed as though GameData subdirectories were not being accessed by ATM unless there was either a .cfg for the directory in BoulderCo/ActiveTextureManagerConfigs or the mod provided its own. However, now it appears like ATM is seeing everything and using the default configuration (ActiveTextureManagement/config.cfg) unless there is an override. Several mods that I previously didn't have .cfg files for, and that only have icons/small UI widget textures, are now being scaled:

  • FAR Editor Analysis (Toolbar)
  • Fusebox
  • Distant Object Enhancement Settings
  • ActionGroupManager
  • KSPScienceLibrary
  • StageRecovery

Additionally, Squad changed the folder layout of the GameData/Squad folder slightly, so there is a slight change needed for the Squad.cfg. TaranisElsu's TAC mods have also been reorganized, as well as Universal Storage. For reference, I've collected my additions/changes in a .zip file available here: WIP ATM Configurations.

These are not endorsed by rbray89 so if you try them and things explode, don't blame him or ATM! These work for me!

Edit: Perhaps icons/UI widget textures could be ignore by ATM (at least for scaling) by detecting dimensions and skipping anything smaller than, say, 100x100?

Hmmm... I like that idea. Ignoring things that are really small and wouldn't benefit from re-scalling. I'll add that in tonight.

Share this post


Link to post
Share on other sites
Hmmm... I like that idea. Ignoring things that are really small and wouldn't benefit from re-scalling. I'll add that in tonight.

AmbientLight, FuseBox, MechJeb's icons, PartAngleDisplay. These all use tiny icons that are blurry messes when rescaled. Lots of mods have this, so I do support this plan.

Share this post


Link to post
Share on other sites
Screenshot looks like pretty much like RealChute bug. Try updating it to xxx.3 version or disabling for test purposes.

Got rid of it and it worked. Thanks!

Share this post


Link to post
Share on other sites
I can say with some (MUCH) degree of certainty that the cfg files we have in-place are being used. That being said, with the new additions, there may be config updates that are required to optimize the textures for display.

Well the thing is, I can't seem to get the compression to turn off. My current JSI.cfg looks like this:

ACTIVE_TEXTURE_MANAGER_CONFIG
{
folder = JSI
enabled = false
}

But my monitors still look like this:

sXTRDQZl.jpg

Did I do it wrong?

The basic version seems to work fine, though, so I guess I'll use that instead.

Share this post


Link to post
Share on other sites

I don't know if I did something wrong, as far as I know I didn't, but after getting the last version I experienced a notable fps drop. I was getting around 20-25 fps everywhere and after removing ATM it went back to the usual 50-60. Forgot to mention I was using the aggressive version.

Edited by Jofe

Share this post


Link to post
Share on other sites
Well the thing is, I can't seem to get the compression to turn off. My current JSI.cfg looks like this:

ACTIVE_TEXTURE_MANAGER_CONFIG
{
folder = JSI
enabled = false
}

But my monitors still look like this:

http://i.imgur.com/sXTRDQZl.jpg

Did I do it wrong?

The basic version seems to work fine, though, so I guess I'll use that instead.

It seems I accidentally dropped the folder checking, so by default, everything is made unreadable and smaller... I'll fix that tonight.

- - - Updated - - -

I don't know if I did something wrong, as far as I know I didn't, but after getting the last version I experienced a notable fps drop. I was getting around 20-25 fps everywhere and after removing ATM it went back to the usual 50-60. Forgot to mention I was using the aggressive version.

probably due to log spam from another mod not liking the textures as non-readable. Fixing tonight.

Share this post


Link to post
Share on other sites

@rbray89,

I want to thank you very much for continuing to work on this mod, and for helping us all to get our game working again. :) Version 3-6 finally did the trick for me, yay! I too am having blurry MechJeb icons, but it looks like you'll have that fixed shortly as well, so I'm good. Again, thank you so much, you're a saint for listening to my upset complaints earlier, too.

Everyone who uses this mod should give as much rep as possible to rbray89, IMHO. I know I'm going to!

Later! :D

Share this post


Link to post
Share on other sites

Regarding startup crashes - it's a conflict with TextureReplacer-1.7.2 & Endraxials Planets and Moons For TR 2014 v2.0 O_O Very strange, it worked perfectly fine before update.

Share this post


Link to post
Share on other sites

I've just tried start KSP with just ATM and I always have a cdt during initial loading screen

KSP 32, Win 8 64, x86Release-basic (also x86Release), no other mods

Share this post


Link to post
Share on other sites
@rbray89,

I want to thank you very much for continuing to work on this mod, and for helping us all to get our game working again. :) Version 3-6 finally did the trick for me, yay! I too am having blurry MechJeb icons, but it looks like you'll have that fixed shortly as well, so I'm good. Again, thank you so much, you're a saint for listening to my upset complaints earlier, too.

Everyone who uses this mod should give as much rep as possible to rbray89, IMHO. I know I'm going to!

Later! :D

Don't forget rep to sarbian!

Share this post


Link to post
Share on other sites
So... as far as I can tell, I won't be able to stop KSP from loading (or re-loading) textures. It will always load them.

Told you so :P

So you guys haven't found a way without using reflection either? Damn it :(

I think ill go with this for my stuff:

                typeof(GameDatabase)
.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
.Single(field => field.FieldType == typeof(DateTime))
.SetValue(GameDatabase.Instance, DateTime.Now);

It makes KSP not reload already loaded images on startup, is way less invasive and imo how Squad should have implemented it in the first place.

That way i can keep pretty much everything as it was, even simplify it since its not necessary anymore to remove the files form the DBs listing.

Have thought about replacing the loaders as well, but my stuff only handles few textures, thus the replacement loader would have to forward calls to the games original code. That could get tricky easily, especially if multiple mods do so. I also despise DatabaseLoader<>'s seemingly "on image per frame" principle.

Share this post


Link to post
Share on other sites
Told you so :P

So you guys haven't found a way without using reflection either? Damn it :(

I think ill go with this for my stuff:

                typeof(GameDatabase)
.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
.Single(field => field.FieldType == typeof(DateTime))
.SetValue(GameDatabase.Instance, DateTime.Now);

It makes KSP not reload already loaded images on startup, is way less invasive and imo how Squad should have implemented it in the first place.

That way i can keep pretty much everything as it was, even simplify it since its not necessary anymore to remove the files form the DBs listing.

Have thought about replacing the loaders as well, but my stuff only handles few textures, thus the replacement loader would have to forward calls to the games original code. That could get tricky easily, especially if multiple mods do so. I also despise DatabaseLoader<>'s seemingly "on image per frame" principle.

Haha...

Yeah. Though I do like the way sarbian figured to alter the extension list. That way, we can load everything up using our loading system (as ideally we would load all files anyways) and keep the "white-screen" out of the picture so to speak.

Not sure if DatabaseLoader<> only does one texture per frame or not. I remember having to add code to handle multiple images each update otherwise some would be lost if I just used the most recently added.

It also provides the possibility of on-demand loading of other assets too... (models & sounds) which I think could be great.

Share this post


Link to post
Share on other sites

I see Sarbian has added a DDS loader plugin. Any thoughts on a future ATM release having an option to generate DDS images and store those in the texture cache, and loading those if they're newer than an existing texture? There'd be a big hit the first time you run, as the DDS images are built, but afterwards, it'd be drastically quicker. I don't know if it's actually possible (I haven't looked into KSP code for a while now).

Share this post


Link to post
Share on other sites
I see Sarbian has added a DDS loader plugin. Any thoughts on a future ATM release having an option to generate DDS images and store those in the texture cache, and loading those if they're newer than an existing texture? There'd be a big hit the first time you run, as the DDS images are built, but afterwards, it'd be drastically quicker. I don't know if it's actually possible (I haven't looked into KSP code for a while now).

It isn't outside the realm of possibility. My choice of PNG was simply for convenience and disk-space. The annoying thing will be figuring out how to save it as DDS.

Share this post


Link to post
Share on other sites

I had a look since it would be indeed much faster. Paint.NET has a save to DDS option and the old open source seems to have it too.

If it's not enough then it s matter of converting crunch code from C++.

Share this post


Link to post
Share on other sites

Yes its a pretty seamless integration, would even work nicely together with my stuff.

Though i wonder why you never worked around that white screen in the first place. LOD creates temporary textures that it does replace later on.

Not sure if DatabaseLoader<> only does one texture per frame or not.

Well it is built for/around/based on unity's continuations/coroutines. I'm definitively no expert but afaik "yield return null;" does mean "next frame". There are a few built-in things you can return (like a WWW object) that use the engine internal magic and might load multiple, but i doubt it would be optimized for data throughput. Also have you tried to not "yield return null;", maybe even just yield break? Though that would probably lead you back to the "withe screen" & defeat the purpose of coroutines...

I wonder whether there is a low latency (at least lower than "next frame") way to signal a coroutine from a different thread. Never mind, we are talking about Unity :D

It also provides the possibility of on-demand loading of other assets too... (models & sounds) which I think could be great.

Well i'd love to see this in stock KSP. Its partially the reason why i started LOD. But i doubt it will ever come unless Unity offers a way to load a texture without getting short freezes.

Share this post


Link to post
Share on other sites

Is there somewhere in the ksp.log that says how much memory was saved?

like below?

....

[LOG 16:38:23.977] ActiveTextureManagement: Name: Squad/Strategies/Icons/UnpaidResearchProgram

[LOG 16:38:23.977] ActiveTextureManagement: Format: DXT5

[LOG 16:38:23.977] ActiveTextureManagement: MipMaps: 5

[LOG 16:38:23.977] ActiveTextureManagement: Size: 25x25

[LOG 16:38:23.977] ActiveTextureManagement: Readable: False

[LOG 16:38:23.977] ActiveTextureManagement: Memory Saved : 0B

[LOG 16:38:23.977] ActiveTextureManagement: Memory Saved : 0kB

[LOG 16:38:23.977] ActiveTextureManagement: Memory Saved : 0MB

....

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.