Code Monkey home page Code Monkey logo

ksploadondemand's Introduction

KspLoadOnDemand

Makes KSP assets (atm only part textures) load once required instead of all on startup.

For the latest version, feedback and bug reports check out the KSP forum thread (http://forum.kerbalspaceprogram.com/threads/73236-WIP-Loading-textures-only-as-required) or create a github issue (https://github.com/Faark/KspLoadOnDemand).

LICENSE Do whatever you want as long as you mention that your stuff is based on this and ofc do whatever is inferred by licenses of 3rd party stuff used by this project.

LoadOnDemand uses the LibSqusih (https://code.google.com/p/libsquish/) software distributed under the following licenses:

Copyright (c) 2006 Simon Brown                          [email protected]

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the 
"Software"), to	deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to 
permit persons to whom the Software is furnished to do so, subject to 
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

LoadOnDemand uses the TargaImage (http://www.codeproject.com/Articles/31702/NET-Targa-Image-Reader) softwaredistributed under the following licenses:

 TargaImage

 Design and implementation by
 - David Polomis ([email protected])


 This source code, along with any associated files, is licensed under
 The Code Project Open License (CPOL) 1.02
 A copy of this license can be found in the CPOL.html file 
 which was downloaded with this source code
 or at http://www.codeproject.com/info/cpol10.aspx

 
 COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
 INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS
 FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR
 NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
 OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE
 DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
 OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
 REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
 ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS
 AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.

 Use at your own risk!

ksploadondemand's People

Contributors

faark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ksploadondemand's Issues

Reports of incompatibility with 0.90

So, I have yet to test this as KSP is still updating, but it would be great to look into this as early as possible. With KSP in beta, the RAM usage of the base game is about to get a lot higher and modding is getting bigger than ever. The world really needs LOD.

[3.4] KSP fails starting with compression enabled

this is the last log output from LOD:

20.11.2014 21:33:34: Trying GpuCopy of 0/D:\Steam\SteamApps\common\Kerbal Space Program\GameData\NearFutureSpacecraft\Spaces\crewutilitypod\crewutilityint_part1.mbm-ToBitmap-Clone-SetAlpha255-Resized-ToCached
20.11.2014 21:33:34: Unhandled exception!
20.11.2014 21:33:34: System.NotSupportedException: Width & Height must be divisible by 4 for DXT, no automatic adjustment exists so far.
at LodNative.CachedTexture.GenerateDXTCompressionFromBitmap(BitmapFormat source)
at LodNative.TextureInitialization.GenerateHighRes(ITextureBase source_texture)
at LodNative.TextureInitialization.Generate_OnLoaded(ISegment loaded_data)
at LodNative.Disk.ConsumeReadDataScope.Run()
at LodNative.Work.WorkThread()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
20.11.2014 21:33:34: Assigned texture 0/D:\Steam\SteamApps\common\Kerbal Space Program\GameData\NearFutureSpacecraft\Spaces\crewutilitypod\crewutilityint_part1.mbm-ToBitmap-Clone-SetAlpha255-Resized-ToCached
20.11.2014 21:33:34: ThumbUpdated: 1
20.11.2014 21:33:34: Trying GpuCopy of 0/D:\Steam\SteamApps\common\Kerbal Space Program\GameData\NearFutureSpacecraft\Spaces\crewutilitypod\crewutilityint_part2.mbm-ToBitmap-Clone-SetAlpha255-Resized-ToCached
20.11.2014 21:33:34: Assigned texture 0/D:\Steam\SteamApps\common\Kerbal Space Program\GameData\NearFutureSpacecraft\Spaces\crewutilitypod\crewutilityint_part2.mbm-ToBitmap-Clone-SetAlpha255-Resized-ToCached
20.11.2014 21:33:34: ThumbUpdated: 2
20.11.2014 21:33:34: Trying GpuCopy of 0/D:\Steam\SteamApps\common\Kerbal Space Program\GameData\NearFutureSpacecraft\Spaces\crewutilitypod\blank.tga-Clone-SetAlpha255-Resized-ToCached
20.11.2014 21:33:34: Assigned texture 0/D:\Steam\SteamApps\common\Kerbal Space Program\GameData\NearFutureSpacecraft\Spaces\crewutilitypod\blank.tga-Clone-SetAlpha255-Resized-ToCached
20.11.2014 21:33:34: ThumbUpdated: 0
20.11.2014 21:33:34: Leave RequestedUpdate: False

and here the KSP stack output

(0x76EF2F71) (KERNELBASE): (filename not available): RaiseException + 0x48
(0x5B985DDF) (clr): (filename not available): GetPrivateContextsPerfCounters + 0x26c5d
(0x5B9864F9) (clr): (filename not available): GetPrivateContextsPerfCounters + 0x27377
(0x2B3210EA) ((module-name not available)): (filename not available): (function-name not available) + 0x0
(0x2B32A5CA) ((module-name not available)): (filename not available): (function-name not available) + 0x0
(0x2A44BA58) ((module-name not available)): (filename not available): (function-name not available) + 0x0
(0x04A16150) (Mono JIT code): (filename not available): (wrapper managed-to-native) object:wrapper_native_5C17DA78 (void*) + 0x28 (04A16128 04A16173) [010A4E70 - Unity Root Domain] + 0x0
(0x53DCD645) (Mono JIT code): (filename not available): LoadOnDemand.NativeBridge:b__8 () + 0x3d (53DCD608 53DCD653) [010A4E70 - Unity Root Domain] + 0x0
(0x04A76B6B) (Mono JIT code): (filename not available): LoadOnDemand.Logic.WorkQueue:Update () + 0xa3 (04A76AC8 04A76C60) [010A4E70 - Unity Root Domain] + 0x0
(0x049AE629) (Mono JIT code): (filename not available): (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) + 0x41 (049AE5E8 049AE67D) [010A4E70 - Unity Root Domain] + 0x0
(0x100F00B6) (mono): (filename not available): mono_set_defaults + 0x22bf
(0x1005D6DF) (mono): (filename not available): mono_runtime_invoke + 0x51
(0x01245C38) (KSP): (filename not available): Behaviour::Transfer + 0x28748
(0x012E0DC6) (KSP): (filename not available): Behaviour::Transfer + 0xc38d6
(0x012E0BD5) (KSP): (filename not available): Behaviour::Transfer + 0xc36e5
(0x012389FB) (KSP): (filename not available): Behaviour::Transfer + 0x1b50b
(0x01238A71) (KSP): (filename not available): Behaviour::Transfer + 0x1b581
(0x01238A87) (KSP): (filename not available): Behaviour::Transfer + 0x1b597
(0x012AF559) (KSP): (filename not available): Behaviour::Transfer + 0x92069
(0x01323E4B) (KSP): (filename not available): Behaviour::Transfer + 0x10695b
(0x0132566B) (KSP): (filename not available): Behaviour::Transfer + 0x10817b
(0x0158E948) (KSP): (filename not available): AnimationEvent::Transfer<StreamedBinaryRead<1> > + 0x119b28
(0x015C3830) (KSP): (filename not available): AnimationEvent::Transfer<StreamedBinaryRead<1> > + 0x14ea10
(0x7662919F) (KERNEL32): (filename not available): BaseThreadInitThunk + 0xe
(0x772A0BBB) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x84
(0x772A0B91) (ntdll): (filename not available): RtlInitializeExceptionChain + 0x5a

OpenGL Support

So, feel free to reject this, I know it's a big task, but I would like to submit it anyhow.

The lack of OpenGL support actually prevents me from using KLOD. The following are the statistics for RAM usage when running KSP with different configurations:
DirectX: >4GB (crashes very early while loading)
ATM + DirectX: >4GB (crashes while loading)
KLOD + DirectX: >4GB (crashes while loading)
ATM + KLOD + DirectX: 3.7GB (Crashes between 5 and 50 minutes after load due to memory)

OpenGL: >4GB (crashes while loading)
ATM + OpenGL: ~3GB (Runs stably for 2-6 hours before crashing due to memory)

I have a ton of mods, yes. But I don't even use EVE or Texture Replacer. There also might be an issue with ATM not fully working properly with KLOD, but that's more of a hunch.

There is apparently some glitch in the DirectX build of KSP which causes texture duplication and extra needless overhead from what I have heard around the forums. As a programmer myself, I am well aware of the difficulties in doing something like supporting another whole API/architecture, but if possible, it would be greatly appreciated. I would like to note that ignoring the out of memory issue with KLOD + ATM, the game loads and runs noticeably faster.

EDIT: I can post LOD logs later if desired; just let me know if that would be helpful

Thanks for taking a look!

KSP .25 incompatibility

I suspect all we need is a recompile for the current KSP release. Since 0.25, people have been reporting a message about incompatibility and invalid operations and/or whatnot. I'd try to do it myself, but the project files refuse to load in "sharp develop" which is what I use to recompile other mods for my own preferences.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.