Jump to content

[KSP 1.12.x] kOS v1.4.0.0: kOS Scriptable Autopilot System


Dunbaratu

Recommended Posts

4 hours ago, Denko666 said:

I put a KSP log here: https://www.dropbox.com/s/2cg6xurzipt8qnn/KSPlog.txt?dl=0

I looked through it, and there are quite a few errors mentioning:


[ERR 15:23:27.518] Cannot find a PartModule of typename 'ModulekOSVoidAction'

I added both kOS mod and the kOSforAll mod. Maybe the error because of kOSForAll...

This ship deff. has a kOS CPU in its design. But as is visible in the control panel of kOS, no CPUs are found.: 

Album s2IYQtc will appear when post is submitted

 

Do you have any idea what WBIPartScrapper is?  It's getting confused on loading vessels, claiming the kOSNameTag is not in agreement with something else index-wise.  I have no idea what WBIPartScrapper is but it seems to be getting logged during IR doing something or other.

Also, looking around in github, ModulekOSVoidAction is something that the action groups extended mod is doing, not something kOS is doing directly itself.

Based on these two things - can you experiment  with removing these other two mods one at a time to see if that fixes anything?  Please do it from a new saved game because removing a mod can and will delete ships from your saved game - you have been warned.

BTW  I can't see your screenshot.  For whatever reason it points to an error page in IMGUR.

Link to comment
Share on other sites

48 minutes ago, Steven Mading said:

Do you have any idea what WBIPartScrapper is?  It's getting confused on loading vessels, claiming the kOSNameTag is not in agreement with something else index-wise.  I have no idea what WBIPartScrapper is but it seems to be getting logged during IR doing something or other.

Also, looking around in github, ModulekOSVoidAction is something that the action groups extended mod is doing, not something kOS is doing directly itself.

Based on these two things - can you experiment  with removing these other two mods one at a time to see if that fixes anything?  Please do it from a new saved game because removing a mod can and will delete ships from your saved game - you have been warned.

BTW  I can't see your screenshot.  For whatever reason it points to an error page in IMGUR.

'WBI' is a prefix used by @Angel-125 in his mods (Pathfinder, Buffalo, ...). That module might be by him.

Link to comment
Share on other sites

Quote

 

Do you have any idea what WBIPartScrapper is?  It's getting confused on loading vessels, claiming the kOSNameTag is not in agreement with something else index-wise.  I have no idea what WBIPartScrapper is but it seems to be getting logged during IR doing something or other.

Also, looking around in github, ModulekOSVoidAction is something that the action groups extended mod is doing, not something kOS is doing directly itself.

Based on these two things - can you experiment  with removing these other two mods one at a time to see if that fixes anything?  Please do it from a new saved game because removing a mod can and will delete ships from your saved game - you have been warned.

BTW  I can't see your screenshot.  For whatever reason it points to an error page in IMGUR.

 

@Steven MadingI made a copy of the entire KSP installation and then excluded WildBlueIndustries from the mods... and i got a working kOS :'( 

AGEx is still loaded so it looks like the ModulekOSVoidAction isn't the culprit.

I'm browsing WildBlueIndustries mods sourcecode on Github, trying to find the entry for this WBIPartScrapper. Hopefully i can find it. But nevertheless, I hope @Angel-125 is going to know what needs to be changed. 

Edited by Denko666
Link to comment
Share on other sites

3 hours ago, Steven Mading said:

So if I change the .version in our master github branch (where CKAN points to) then it will be seen by CKAN?

Yes. I did this with one of my own mods a while back as a test, and it worked exactly that way.

Quote

In my mind "change the master branch" *IS* making a release.  It's just missing the step where we upload the zip to other sites.

The KSP-AVC spec doesn't require the URL property to point to your master branch on GitHub. If your master branch is special to your work flow, you're free to pick any other location as long as you can store an up to date .version file there.

Edited by HebaruSan
Forum submit button was glitching out
Link to comment
Share on other sites

21 minutes ago, Denko666 said:

@Steven MadingI made a copy of the entire KSP installation and then excluded WildBlueIndustries from the mods... and i got a working kOS :'( 

AGEx is still loaded so it looks like the ModulekOSVoidAction isn't the culprit.

I'm browsing WildBlueIndustries mods sourcecode on Github, trying to find the entry for this WBIPartScrapper. Hopefully i can find it. But nevertheless, I hope @Angel-125 is going to know what needs to be changed. 

@Steven Mading Found it: https://github.com/Angel-125/Pathfinder/blob/master/Pathfinder/ResourceDistribution/WBIPartScrapper.cs It is in one of the most important mods from @Angel-125 

Angel, i hope you're reading this. Can you look at it when it is combined with the kOS mod? 

Link to comment
Share on other sites

16 minutes ago, Denko666 said:

@Steven Mading Found it: https://github.com/Angel-125/Pathfinder/blob/master/Pathfinder/ResourceDistribution/WBIPartScrapper.cs It is in one of the most important mods from @Angel-125 

Angel, i hope you're reading this. Can you look at it when it is combined with the kOS mod? 

Pathfinder/ModuleManagerPatches/MM_Skills is where the part scrapper is added. My mods have a number of command pods that add kOS if the mod is installed. Not sure what parts are generating your error but it might be from one of mine. Anyway, try removing the MM patch and see if that helps.

Edited by Angel-125
Link to comment
Share on other sites

1 hour ago, Angel-125 said:

Pathfinder/ModuleManagerPatches/MM_Skills is where the part scrapper is added. My mods have a number of command pods that add kOS if the mod is installed. Not sure what parts are generating your error but it might be from one of mine. Anyway, try removing the MM patch and see if that helps.

Restored WildBlueIndustries folder in Gamedata; but removed the MM_Skills patch and now kOS works even with WBI mods installed =D YAY!

Thanks to all of you @Angel-125 @Steven Mading and @Madmax ,you saved my sanity ;) 

Link to comment
Share on other sites

Hi, I installed this today - 

I put a KAL9000 on one of my ships.  Put it on the launchpad and retired to the documentation.  First goal to programatically deploy an airbrake.

After a while my computer locked up.  Then KSP crashed.

I reastarted KSP and it happened again.  This time I hit CTRL ALT F2 to see if I could find the process that might be causing the lock up when all of a sudden I get a message that KSP_64 has been killed due to lack of memory ( prior to installing KOS I could leave KSP running for hours on end.  I'm getting around two hours out of it at the moment before it dies ).

I installed the mod via CKAN.  And it's technically for 1.4.1.  Is there a more up to date version? ( the answer is no )

Killed process 14791 (KSP.x86_64) total-vm:14970552kB, anon-rss:11824248kB, file-rss:21688kB, shmem-rss:532kB
Out of memory: Kill process 14791 (KSP.x86_64) score 642 or sacrifice child

also when trying to use the internal editor the R, S and E keys do not work as they seem to be tied to Reload, Save and Exit and do not function at all.

Edited by NewtSoup
Link to comment
Share on other sites

5 hours ago, NewtSoup said:

I reastarted KSP and it happened again.  This time I hit CTRL ALT F2 to see if I could find the process that might be causing the lock up when all of a sudden I get a message that KSP_64 has been killed due to lack of memory ( prior to installing KOS I could leave KSP running for hours on end.  I'm getting around two hours out of it at the moment before it dies ).

What was your script doing?  It's impossible for one program to detect if another program will end a loop in a reasonable time (a classic Computer Science problem), so kOS *cannot* prevent scripts from blowing up the game if they are written to keep consuming resources in a loop in some way.  I don't know what was happening at the time, so I can't tell if it was your script or the kOS mod itself that was at fault yet.  Can you post the code?  If it's not the script then maybe the output log from KSP might have more clues too.

Quote

also when trying to use the internal editor the R, S and E keys do not work as they seem to be tied to Reload, Save and Exit and do not function at all.

The internal window is *supposed* to get first dibs on grabbing keys, before the outer frame with those buttons gets dibs on them.  But *lots* of mods have problems with this (input keyboard focus order) and it seems to be one of the areas where Unity is inconsistent between different installations.  I believe there was another mod that actually helped enforce focus rules a bit better on behalf of other mods, but that mod is now abandoned and no longer works on recent KSP versions.

I wish I had the ability to debug this but I simply can't without actually running on Linux (which seems to be the only Unity platform where it happens, thus my frustration with Unity's alleged cross-platformness on this.  They make too many things differ between the platforms in ways that I simply do NOT believe are the OS's fault - like on Linux they pad control characters (like Crtrl-C, tab, return, etc - anything with ASCII code less than 27) with ON bits instead of OFF bits when returning them as unicode 2-byte chars.  (so for example, the Return key, which by all rights SHOULD be 0x000D is instead 0xFF0D because of the incorrectly padded bits.)   Unity does this on their Linux port and I had to put in a special case fix for it, even though this is clearly a software bug on Unity's part, not something that Linux itself is doing.

So, basically fixing it requires someone who can compile and debug the mod on Linux look into it.

Link to comment
Share on other sites

7 hours ago, Steven Mading said:

What was your script doing?  It's impossible for one program to detect if another program will end a loop in a reasonable time (a classic Computer Science problem), so kOS *cannot* prevent scripts from blowing up the game if they are written to keep consuming resources in a loop in some way.  I don't know what was happening at the time, so I can't tell if it was your script or the kOS mod itself that was at fault yet.  Can you post the code?  If it's not the script then maybe the output log from KSP might have more clues too.

Quote

I wasn't running any script at all, the ship was just sitting on the launchpad while I was reading the KOS docs.  3rd time around I watched the memory bloat from 4.2gb to 8gb in an hour before I shut the game down myself.  I can't be certain it's KOS but it's only started doing this since I installed KOS.

As for the Key things I'll try removing afbw as that tends to pop up unannounced when typing stuff in the editor too.  

The output log no longer contains info pertaining to the crash as I've run the game since then and exited safely.  I'm going to run it now though and do exactly what I did before - which was browse the net while leaving my ship on the LP ( with the  KAL9000 monitor up )

 

Link to comment
Share on other sites

I'm actually quite excited to get this to work because I want to use it to control a mining operation.

First pseudocode:

start fuel cells
deploy drills
deploy radiators

while (lf !full && Ox !full ){
      If ore is empty run the drills until ore is full
      
      while ( ore !empty) {
           run ISRU until charge empty
           stop isru until charge full
           if Lf && Ox full then break
      }
}

stop isru
retract drills
stop fuel cell
retract radiators

 


I'm just reading up on how to not lock the game up while in loops and triggers and so forth.
 

 

Just curious however - will KOS run a script while in timewarp?
That is.. will I be able to warp while mining using KOS to control the power use like I want to?

Edited by NewtSoup
Link to comment
Share on other sites

You might also want to look into controlling WARP with that drilling script, given how long drilling takes.

(i.e. SET WARP TO 5. sets it to the 5th "step" of warp (so that would be 0=1x, 1=5x, 2=10x, 3=50x, 4=1000x, 5=10000x, etc, assuming stock warping with no mods).)

10 minutes ago, NewtSoup said:

I'm just reading up on how to not lock the game up while in loops and triggers and so forth.

If it was locking up just sitting there not running a script, then something may be wrong in the mod.  If you get it to happen again, please do let me see the output log that went with it.

 

[edit:]

RE: Can the script run while warping? (The question you asked while I was typing):

Short answer: Yes, BUT...

Long answer: While the Unity "physics" ticks *do* get called while the game is stuck in time warp (and thus the kOS computer does keep executing your program during those ticks), the KSP game disables many things so the script won't be able to affect the physical universe in a meaningful way.  It won't *crash* the script, but things like trying to turn on the throttle or steer the ship will have no effect until after you come out of time warp.

Edited by Steven Mading
previous post was edited with an additional question while I was replying to it.
Link to comment
Share on other sites

I have been sitting here typing and the ship has been on the launchpad with nothing runnig other than the KOS terminal and my memory usage has gone from 4.2gb to 8.2gb.  it's been about an hour.  I'm expecting a system freeze soon ( I have 16gb, with the OS overheads and chrome running I'm expecting it to fall over when KSP hits around 11gb )

 

Link to comment
Share on other sites

10.5 gb.. but I have to go out.  I'll catch the logs when I get back in.

 

[LOG 13:32:56.029] [MessageSystem] Save Messages
[LOG 13:32:56.043] [BetterTimeWarp]: Settings saved
[LOG 13:32:56.053] Game State Saved to saves/Sandbox 1/persistent
[LOG 13:32:56.127] [AutoSave]: Game Backed Up and Saved
[LOG 13:34:11.331] [OD] <--- ScaledSpaceDemand.UnloadTextures destroying NewMunSurfaceMap00 and NewMunSurfaceMap01
[LOG 13:34:22.750] [OD] --> ScaledSpaceDemand.LoadTextures loading NewMunSurfaceMap00 and NewMunSurfaceMap01
[LOG 13:34:33.179] [OD] <--- ScaledSpaceDemand.UnloadTextures destroying NewMunSurfaceMap00 and NewMunSurfaceMap01

( latest entries and the start of KSP panicking :)  )

Link to comment
Share on other sites

3 minutes ago, NewtSoup said:

I have been sitting here typing and the ship has been on the launchpad with nothing runnig other than the KOS terminal and my memory usage has gone from 4.2gb to 8.2gb.  it's been about an hour.  I'm expecting a system freeze soon ( I have 16gb, with the OS overheads and chrome running I'm expecting it to fall over when KSP hits around 11gb )

 

C#'s .net or mono runtime, much like Java runtime, is *weird* with how it uses the system's main memory.  There's so many indirection layers between the actual hardware memory and what the program is doing inside the runtime that it's very hard to deduce how much of its footprint it is *really* committed to holding on to just because it *looks* big and wasteful.

Often it's using the logic, "Allocating new memory is an expensive slow operation.  So even though the program has freed the memory I still won't give it back to the OS until I detect that other processes on the system are starting to have a demand for it.  As long as nobody else needs the memory, I'll still hold onto it in case the program grows again to its previous size."

That makes it a royal PITA for developers to try to detect if they have a "real" memory leak or not, since the footprint the OS reports for the runtime process includes this "I'll keep holding the freed memory just in case I need it later" amount, and thus never seems to shrink until other processes start demanding memory.  So it always *looks* like you have a memory leak, whether you actually *do* or not.

Link to comment
Share on other sites

Also useful will be a comparison to what happens if you do NOT have kOS installed and leave it sitting on the screen, and what happens if you DO have the kOS mod installed ,but don't have any kOS parts on the ship that is sitting on the launchpad.

(edit: I realize these tests would take a lot of time, but it would help narrow it down.)

Edited by Steven Mading
Link to comment
Share on other sites

Back now.  KSP has crashed and the tail of the log says:

[LOG 13:34:33.179] [OD] <--- ScaledSpaceDemand.UnloadTextures destroying NewMunSurfaceMap00 and NewMunSurfaceMap01
[LOG 13:37:58.007] Flight State Captured
[LOG 13:37:58.007] Saving Achievements Tree...
[LOG 13:37:58.007] Saving Achievements Tree...
[LOG 13:37:58.007] Saving Achievements Tree...
[LOG 13:37:58.010] [MessageSystem] Save Messages
[LOG 13:37:58.022] [BetterTimeWarp]: Settings saved
[LOG 13:37:58.031] Game State Saved to saves/Sandbox 1/persistent
[LOG 13:37:58.105] [AutoSave]: Game Backed Up and Saved
[LOG 13:43:00.335] Flight State Captured
[LOG 13:43:00.337] Saving Achievements Tree...
[LOG 13:43:00.337] Saving Achievements Tree...
[LOG 13:43:00.337] Saving Achievements Tree...
[LOG 13:43:00.342] [MessageSystem] Save Messages
[LOG 13:43:00.358] [BetterTimeWarp]: Settings saved
[LOG 13:43:00.370] Game State Saved to saves/Sandbox 1/persistent
[LOG 13:43:00.372] [AutoSave]: Game Backed Up and Saved
[LOG 13:48:02.150] Flight State Captured
[LOG 13:48:02.151] Saving Achievements Tree...
[LOG 13:48:02.151] Saving Achievements Tree...
[LOG 13:48:02.151] Saving Achievements Tree...
[LOG 13:48:02.158] [MessageSystem] Save Messages

Which is entirely unhelpful

I will now put a ship on the launchpad with no kOS parts on it and wait!

Same ship - KAL9000 Removed.

On the launchpad.  Freshly started client.

Memory usage is at 4.3gb

Link to comment
Share on other sites

8 minutes ago, NewtSoup said:


Which is entirely unhelpful 

I will now put a ship on the launchpad with no kOS parts on it and wait!

If there is a memory leak, it's not the tail of the log that matters.  It would be a repeating pattern of doing the same thing again and again during the life of the program.  So it really is the whole log that matters.  If there's a hosting site that will allow you to post a long text file, that would be the best place - don't edit a thing out - just put the whole thing.

Link to comment
Share on other sites

So the last client took an hour and a half (approximately ) to crash out.  The current one was loaded at 15:04, it's now 16:09 and memory has climbed from 4.3gb to 7.6gb

Now to 8.8 at 16:18

 

everything in the log looks normal.. the only repeating stuff is about game state and autosaves

 

Link to comment
Share on other sites

System locked up 50 minutes ago.  Disk read for the ksp process is at 104 gb. Write at 15mb.  Read soeed 109mb/s memory usage 12.3 gb. Im hitting the reset button

So there we go.  

the computer locked up at 16:38
the last log entry was at 16:38

I hit the reset button at 17:50 

 

 

I have removed kOS and I'm now going to wait at the launchpad again.  (I'm saving the last log before I start the KSP client )

link to log https://drive.google.com/open?id=1JYFNaXQx-W6s8OclZggo85NCMXR4xgL0

Edited by NewtSoup
Link to comment
Share on other sites

Ship loaded and on the launch pad.  kOS not installed.  Current Memory usage is 4gb.   Disk Read total is 2.3gb and the disk read speed is n/a (0)

Just going to leave it now and go back to browsing the web as I have done in the other tests :)

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...