Jump to content

External modding program - What functions do you want to have?


*Aqua*

Recommended Posts

Hello!

Currently I'm putting some code together to create an external program which can display and allow editing of various stuff.

It already can scan the KSP directory for savegames, saved crafts and other stuff. Scanning the GameData directory is next but won't be hard.
While scanning it creates a database similiar to the game database in KSP (hierarchical tree made of ConfigNodes). This database also makes it easy to parse all kinds of KSP-compatible cfg scripts. It already can parse *.sfs and *.craft files. Part cfgs probably also work. I only need to add two or three more checks to make the parser more robust and some optimation (currently needs several minutes to parse savegames and craft files - I know it was much faster in an earlier version).

Some of the goals I want to archieve are:

  • ModuleManager script editor (combining code blocks? or simple text editor with code validation? not decided yet)
  • Scanning of plugins to determine available PartModule, etc. classes (nice for MM script validation)
  • Log file filtering
  • Mod support (ModuleManager!, AVC?, CKAN?, others?)
  • Savegame editing (cheating [money, etc.], fixing [revive dead docking ports, etc.])
Spoiler
  • Editing of Physics.cfg and settings.cfg (KSP's main settings files)
  • Log files:
    • Filter for exceptions, warnings, etc. and custom search string.
    • Anti-spam switch to remove void and other meaningless log lines (tested: compresses a 52k lines output_log down to ~22k lines)
    • Making files or directories clickable in the log for opening text editor or explorer there?
  • Mods:
    • Editing
      • agencies, contracts, flags, parts and strategies
    • Scanning plugins for capatibilites (mainly for finding new PartModules)
    • Viewing readmes and licenses
  • Savegames:
    • editing of everything ;-)
    • crafts: modifying, deleting, copying to other savegames (or making them globally available)
    • subassemblies: see crafts

In the end this program is supposed to be a help for modders with deep KSP knowledge and players without knowledge of the inner workings of KSP.

 

WIP GUI. Don't expect it to look like this. It's just for demonstrating what it already can.
 

(Btw, TreeView sucks. The UI element needs 900 MB memory for this rather small tree! What the heck!?)


I'm now close to the point where I start implementing the GUI. But before I do that I want to know from you what kind of functions do you want to have or expect.
Just post any idea you have here.

I ask because there'll be a lot of information to display. I need to plan what to display when and where to avoid information overload and screen cluttering. Don't expect me to release this program anytime soon. There's still a lot of work to do.

Link to comment
Share on other sites

It would be nice to have a way to edit PART files much in the same way that you can edit plists is XCODE. Having the ability to quickly run though the creation of part files is really what would be nice to have. Imagine a big list of Part Modules, where you can go down and check off which ones you want to apply to the part, both from stock sources, and from mods. Then you can go down and either use checkboxes, dropdowns, or fill in forms to define the part parameters. Then an export function to either create a base part config, or convert those data to be a MM patch. That's the holy grail right there.

Link to comment
Share on other sites

A few ideas:

1) A save game check/fixer would be great. I know - this could (should?) be a app to it's self. Maybe do some basic checks and flag errors? Ex: (as in your OP) scan for the typical stuck docking port causes and flag for user fixing (or auto if your ambitious).

2) A search function - Find all vessels with part "X" or find vessel "VesselName". Good for those 8MB save files where you want to fix a specific vessel or remove parts from deleted mods.

3) Vessel insertion/extraction -  replace that vessel that the Kracken ate.

This could be really useful - I'll be following your progress.

Link to comment
Share on other sites

@saabstory88
I'm not sure if I understand you correctly. I never used XCode. You want an editor which displays stuff in a kind of table? I guess I have to do that. Some nodes have way to many properties so that other kinds of GUIs won't make sense.

@wasml
1) Good idea! I didn't think about that. I only had the dead docking ports and flipped parts (up-side down decouplers, etc.) in mind. I'll ask for a list of things to check for when I'm implementing this. :)
2) Good idea! Noted.
3) Also a good idea! It might be tricky to implement as the program only sees debris (if there's some left).

@Nansuchao
I guess this is an application of wasml's first proposal. Noted on my to-do-list as well.

 

Thank you! This kind of feedback is exactly what I'm looking for. :kiss:

Edited by *Aqua*
Link to comment
Share on other sites

12 minutes ago, *Aqua* said:


3) Also a good idea! It might be tricky to implement as the program only sees debris (if there's some left).

This would be very handy for other reasons, say you have a save file with a craft on a perfect trajectory, but you thought of a better way of doing the endgame, you build a new craft and replace the vessel already on the right trajectory. I know it would help me build my redistributable save game to replace craft in a save with newer better craft.

Link to comment
Share on other sites

Don't know how complicated it would be, but the MM patch maker sounds helpful. It could pull up a listing of parts in your game and then you could choose  from a list of part modules what you wanted to add, remove or alter. Kind of a MM IDE for KSP. 

Link to comment
Share on other sites

@selfish_meme
-> on my to-do list now ;)
I just got an idea: It might be easy to code a function which creates a .craft file from an existing and flying rocket you forgot to save. This can be handy if the autosave is already overwritten.

@Speadge
1. I put it on my list but it's a low priority one.
2. Deleting is ok but realigning attached parts probably won't be possible. I would need to extract the collider meshes to know where to attach to and where to orientate to. And the attachment probably must be done in a way similar to what KSP/Unity does or it krakens.
3. Please explain what you mean by this. Removing functions I can understand but what do you mean with "unneeded parts"?

@Kalzuron
Yeah, that's the idea behind this program. I just wanted a nice MM script editor.

@saabstory88
A hierarchical table with customized cells, got it! :)
I'll experiment with different GUIs so I can't promise the result will look like that.

 

Btw this will be a C#/WPF program. I can't guarantee it'll run on Linux and Mac. (Does Mono support WPF now?)

Link to comment
Share on other sites

19 hours ago, *Aqua* said:

2. Deleting is ok but realigning attached parts probably won't be possible. I would need to extract the collider meshes to know where to attach to and where to orientate to. And the attachment probably must be done in a way similar to what KSP/Unity does or it krakens.
3. Please explain what you mean by this. Removing functions I can understand but what do you mean with "unneeded parts"?

hi,

thanks for your reply.
according to the 2nd point: wouldnt it work by just getting the attachment nodes of a part i want to delete and the ones following?

i.e:
i have a 3 part rocket with a pod, tank and a rocket. So i could delete the tank by deleting the part out of the savegame and using the information of its attachment to the pod for attaching the rocket not longer to the tank but to the pod.. its the same Node at last.
For every following part that COULD be on the rocket (and for the booster itself) you (just) have to change the parentID in addition

 

3rd point:
i have no example here but i often have wondered about some modules in Parts that i will NEVER ever use there - ah, example: USI recycling for parts - thats not much, but i wont use that on a sattelite or a SSTO - for example. so i might just want to build THIS ONE lean ship without any ballast in its config-data..

Edited by Speadge
Link to comment
Share on other sites

@Speadge
2) Ah that's what you mean. I think that's possible for parts that are connected to 1 or 2 parts only.

3) I don't think the "balast" poses a problem. It's usually inactive as long as you don't use it. Often it's part of the used part class which means you can't remove that functionality without converting it to a completely different part.
Some mods don't care if you remove certain modules from a part cfg as they'll add them back during game start or scene switch. I know Kerbal Foundries does that. Others might do it too.

 

Funny thing:
I scan for part configs in the GameData directory. I have the RetroFuture parts mod installed and my program finds 156 cfgs in there (which is the right number). I let it process them all and end up with a list of 158 configs. :huh:
Also the Visual Studio debugger doesn't like Reflection which I use to analyze plugins. If an exception occures the program simply aborts without pointing me to the source of the problem.

A positive thing is that I sped up loading the KSP directory and parsing all important files. Instead of minutes it only takes about 20-30 seconds now to process about 800 files. :D

Link to comment
Share on other sites

1 hour ago, *Aqua* said:

@Speadge
3) I don't think the "balast" poses a problem. It's usually inactive as long as you don't use it.

it was just, that i'd might want to cleanup the contextmenu of a part when i use it. i.e. i never use the "recycle" thingy or different other things on some parts - so i'd might want to "clean" them up for better usage.

another thing is that i accidently once had 2 cfg settings for one part loading at startup. that resulted in a vessel, thad had double contextmenu items, cause i built it with the two cfg loaded.

Even after cleaning up the cfg, the vessel-file kept thos two module entries cause it was created with them.- thos scenarios might need a funtionality to analyze the modules of each part of a vessel and to add/ delete some.
sure, its easy done with a texteditor - but when you are builfing an edittool anyway, it might be helpful to have this too as well.

Link to comment
Share on other sites

As I said you'll probably can't remove all context menu switches you don't want to have. If they are declared in a module you can simply remove it* and you're done. If they are declared in the part itself you can't get rid of them by simple means.

* For my to-do list: Add a message or popup which warns the user before part manipulation. "Warning! Modifying of parts can result in krakens or broken mods."

 

4 hours ago, Speadge said:

Even after cleaning up the cfg, the vessel-file kept thos two module entries cause it was created with them.- thos scenarios might need a funtionality to analyze the modules of each part of a vessel and to add/ delete some.

That's difficult. The program can't know if modules or parts are duplicated on purpose or not, that means there won't be an auto-fix function.
I might be able to display a warning message after which the user can decide for himself what to do.

Link to comment
Share on other sites

 This looks super interesting and useful, and I really think this is a good idea.

What about having the ability to compare the stats/modules of different parts? I'm thinking that this could be done is by having different tabs that you can switch between like Linux Mint does with it's file explorer.

Hopefully that's a helpful idea. Good luck!

Link to comment
Share on other sites

@Tarrence12
I just looked at a screenshot of it and no, the GUI is way too complicated to make and also looks too cluttered. I think I'll go with something like a tree view for part selection & table for part properties.

Comparing parts will probably out of the question, too. The vanilla game has ~280 parts and some mods add 100+. I can't think of a comparision view which makes sense when there are so many parts.

@artwhaley
I'm not sure if Winforms offer the same possibilities to modify look and behavior like the WPF counterparts do. I'll investigate that but I think they are more limited.

Edited by *Aqua*
Link to comment
Share on other sites

Just to keep you hyped:

Spoiler

Firespitter, Version=7.1.5790.33347, Culture=neutral, PublicKeyToken=null needs assembly UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Firespitter, Version=7.1.5790.33347, Culture=neutral, PublicKeyToken=null needs assembly Assembly-CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
	FSliftSurface (superclass PartModule from Assembly-CSharp)
		relevant Members:
			System.Runtime.CompilerServices.CompilerGeneratedAttribute <OnStart>b__0
			KSPField liftTransformName
			KSPField power
			KSPField wingArea
			KSPField span
			KSPField displayName
			KSPField efficiency
			KSPField dragMultiplier
			KSPField zeroLiftDrag
			KSPField moduleID
			System.Runtime.CompilerServices.CompilerGeneratedAttribute CS$<>9__CachedAnonymousMethodDelegate1
	FSwingBase (superclass PartModule from Assembly-CSharp)
		relevant Members:
			System.Runtime.CompilerServices.CompilerGeneratedAttribute <OnStart>b__0
			KSPField displayName
			KSPField controlSurfaceName
			KSPField flapName
			KSPField leadingEdgeToggleName
...

 

Or in other words, dll parsing now works as expected.

The assembly (Firespitter.dll) is loaded, dependencies are listed (UnityEngine.dll & Assembly-CSharp.dll). And then the debug window dumps all objects which derive from PartModule and list their members (methods & fields). Ignore the System.xyz lines, they are filtered out before adding all that to the internal database. And it works for all plugins in my GameData directory.

I now stand before the descision to either keep adding more functions (for example there's still no MM script parser) or to start implementing the GUI. I can't decide. :huh:
 

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...