Jump to content

[1.8.1] Kerbal Konstructs - 1.8.1.15 - 15.Dec.2019


Ger_space

Recommended Posts

1 hour ago, Mekan1k said:

So... Since https://spacedock.info/mod/1247/Gameslinx's Planet Overhaul (Stockalike Planet Pack) was released, is there a config to make the bases fit the kerbin?

(I am asking because I am HOPELESS at the whole modding thing.)

No, as there is no automated way to do this. about 1000 objects would need to be adjusted by hand, so If you want to do this, I'll be happy to link to your configs.

Link to comment
Share on other sites

9 hours ago, Mekan1k said:

So... Since https://spacedock.info/mod/1247/Gameslinx's Planet Overhaul (Stockalike Planet Pack) was released, is there a config to make the bases fit the kerbin?

(I am asking because I am HOPELESS at the whole modding thing.)

7 hours ago, Ger_space said:

No, as there is no automated way to do this. about 1000 objects would need to be adjusted by hand, so If you want to do this, I'll be happy to link to your configs.


ger, does KK allow to choose what type of "offset" statics have?

specifically, PQSCity Mods can have "repositionToSphere = true" (or false),  "repositionToSphereSurface = true" (or false) and "repositionToSphereSurfaceAddHeight = true" (or false)

 

iirc KK statics by default use:

repositionToSphere = true
repositionToSphereSurface = false
repositionToSphereSurfaceAddHeight = false

 

are those hardcoded or can they be changed? (EDIT: it seems they are indeed hardcoded)

 

because the most simple solution to all compatibility problems would be to have all statics use 
repositionToSphereSurface = true
repositionToSphereSurfaceAddHeight = true

 

(of course I'm not suggesting that all KK statics need to be changed to use that) but if there is anyone that wants to invest some time in improving compatibility between planet packs I'd say that's the best place to start

Edited by Sigma88
Link to comment
Share on other sites

6 minutes ago, Sigma88 said:


ger, does KK allow to choose what type of "offset" statics have?

specifically, PQSCity Mods can have "repositionToSphere = true" (or false),  "repositionToSphereSurface = true" (or false) and "repositionToSphereSurfaceAddHeight = true" (or false)

 

iirc KK statics by default use:

repositionToSphere = true
repositionToSphereSurface = false
repositionToSphereSurfaceAddHeight = false

 

are those hardcoded or can they be changed?

 

because the most simple solution to all compatibility problems would be to have all statics use 
repositionToSphereSurface = true
repositionToSphereSurfaceAddHeight = true

 

(of course I'm not suggesting that all KK statics need to be changed to use that) but if there is anyone that wants to invest some time in improving compatibility between planet packs I'd say that's the best place to start

Good Idea. For now this is hardcoded, but it should be pretty easy to implement this and convert the configs to a new format. (with a new setting).
For Kerbin-Side this could be done by me.

This would not help with legacy statics, but loading them once and forcing them to write out using a stock Kerbin should be enough to convert tem to the new format.
 

Some statics will not work at all (for example anything on the water) as the waterline is actually floating above the surface, so this will end up bad, if the planet is scaled (because the water depth gets higher as well). So I need to create switch for that in the editor.

perhaps I can play around with this today, but I have no idea when I can release this, because from sunday on I'll be on vacation for 14 days.  

 

Link to comment
Share on other sites

24 minutes ago, Ger_space said:

Some statics will not work at all (for example anything on the water) as the waterline is actually floating above the surface, so this will end up bad, if the planet is scaled (because the water depth gets higher as well). So I need to create switch for that in the editor.

as far as I know the water level is always at zero meters*

so when you get the altitude of the surface as a negative number you know that you are underwater so you need to add that much offset to get the static to show up at water-level

I would say, floating PQSCity can simply use "repositionToSphere" so they are always snapped to altitude zero, while for PQSCity that are supposed to be on the ground (or on the bottom of the ocean) would be more effective to use repositionToSphereSurfaceAddHeight

(for the reasons mentioned in my previous post)

 

 

24 minutes ago, Ger_space said:

This would not help with legacy statics, but loading them once and forcing them to write out using a stock Kerbin should be enough to convert tem to the new format.

if you plan to do this with KK it might get some undesired results. for example:

let's say someone installs a pack on a modified kerbin for the first time, then KK automatically calculates the new offset (to use repositionToSphereSurfaceAddHeight = true) and overwrites the statics.

the problems with this approach is that on a modified kerbin the position is already wrong, so recalculating it in terms of offset from surface would not solve the issue.

this process should be done on stock kerbin (so that the statics are recalculated correctly) and then you can install the modified kerbin

 

I'd say that the safest option would be to allow KK to read from the config the values of 

  • repositionToSphere
  • repositionToSphereSurface
  • repositionToSphereSurfaceAddHeight

 

then if anyone wants to take the time of updating old building packs to use this new system, they are free to do so, and I will be happy to help with the math involved and also in the serialization of the system.

 

 

 

---

* you can change that with kopernicus but nobody does, and there's really no reason why anyone should to be honest.

 

also, "zero meters" is intended as "zero meters from Sphere" which means "1 planet radius from the center of the planet"

Edited by Sigma88
Link to comment
Share on other sites

1 hour ago, Sigma88 said:

 

I'd say that the safest option would be to allow KK to read from the config the values of 

  • repositionToSphere
  • repositionToSphereSurface
  • repositionToSphereSurfaceAddHeight

 

then if anyone wants to take the time of updating old building packs to use this new system, they are free to do so, and I will be happy to help with the math involved and also in the serialization of the system.

 

KK never saves the statics without user interaction. So if an old static gets loaded it will always be placed at the same position as long as its not saved from within the editor. I wanted add an variable called useSurfaceOffset = true
 

As I also maintain Kerbin-Side I will not begin to manually edit the statics :/, as long I can write code for this. 

I might also change the PQSCity objects to PQSCity2 and fill up the objectname variable, as abusing the gameobjects name for storing the group name is always possible (Launchsites need to have the name of the launchsite )

How do you get the KK groups settings at the moment? Do you need some variables or functions to be public accessable?

 

Link to comment
Share on other sites

1 minute ago, Ger_space said:

How do you get the KK groups settings at the moment? Do you need some variables or functions to be public accessable?

if you are talking about Sigma Dimensions, there are two main points

 

1- automatic loading of KK groups into SD

this is how SD load "groups" (in general, not necessarily kk groups):

SD has a public static Dictionary<string, Dictionary<string, List<object>>>         [link]

the key (string) of the first dictionary is the CelestialBody.name of the planet that hosts the group in question

the key of the second Dictionary is the name of the group and the list of objects is a list of PQSCity and PQSCity2 mods that are part of said group

 

specifically for KK, what I do with KKtoSD is building up a similar dictionary at KSPAddon.Startup.MainMenu.Awake() looking at the KK configs containing statics and instances and then feeding the content of this dictionary to the public dictionary in SD

as I said KKtoSD is far from optimal, mostly because I just check the position vector to identify pqscity mods

 

I thought about it and I came to the conclusion that the best approach for compatibility between SD and KK is to have a third "bridge" plugin (like KKtoSD but better developed) so that if I need to change SD's internal structure I can do so without worrying about breaking the whole KK,

 

also, when this should happen, it will be easier to push an update for the bridge plugin than having to push an update for KK

 

2- manual loading of KK groups into SD

SD can also load groups on its own, from a cfg syntax that is explained here basically, SD identifies pqscitymods by name and adds them to a group

so having easily accessible names would go a long way towards SD compatibility (and the new system you added I'd say is already good enough, at least it was in my tests)

 

(I went a bit overboard with the explanation, so sorry for the wall of text :D)

Link to comment
Share on other sites

7 minutes ago, Sigma88 said:

2- manual loading of KK groups into SD

SD can also load groups on its own, from a cfg syntax that is explained here basically, SD identifies pqscitymods by name and adds them to a group

so having easily accessible names would go a long way towards SD compatibility (and the new system you added I'd say is already good enough, at least it was in my tests)

 

(I went a bit overboard with the explanation, so sorry for the wall of text :D)

no problem. I like text :-)

Now my wall of text :sticktongue:

1. You could simply parse the KK configs for the vector to group mapping. 

UrlDir.UrlConfig[] configs = GameDatabase.Instance.GetConfigs("STATIC");

foreach (UrlDir.UrlConfig conf in configs)
{
	foreach (ConfigNode instanceCfgNode in con.config.GetNodes("Instances"))
	{
		string groupname = instanceCfgNode.GetValue("Group");
		string position = instanceCfgNode.GetValue("RadialPosition");
		.... and so on and more sanity checking if the values are present
	
	}
}

 

2. or how about you add an

Quote

Dictionary <GameObject>,<String> kkGroupMapping

and KK fills this with c# reflection calls whenever the SD assembly is loaded? 

You can then grab every gameObject you find and check the KK group of it with

if (kkGroupMapping.Containskey[myPQSGameObject])
	mygroup = kkGroupMapping[myPQSGameObject]

And you can alsway make reflection calls the other way around, also this might become messy as KK has some complex data structures you would also need to reflect. 

Option 3.

I make this internal call  public and you link your bridge plugin agains KK, as I don't intent to change much anymore and the internal API Version stays the same, so you don't need to recompile that often. 

 

 

 

Link to comment
Share on other sites

2 minutes ago, Ger_space said:

Option 3.

I make this internal call  public and you link your bridge plugin agains KK, as I don't intent to change much anymore and the internal API Version stays the same, so you don't need to recompile that often. 

I like this :)

if I understand that correctly I will be able to get pqsCity, Group, CelestialBody from each of the "StaticInstance" in the array which is all I need anyways.

 

Link to comment
Share on other sites

2 minutes ago, Sigma88 said:

I like this :)

if I understand that correctly I will be able to get pqsCity, Group, CelestialBody from each of the "StaticInstance" in the array which is all I need anyways.

 

Yes, StaticInstance is the class which holds all the information about any Object. From there you can access everything within KK. all other tables are just for faster lookup times. Thats also the reason why GetAllStatics returns an array and not a List object, Arrays are faster in c# and produce no garbage in foreach() loops :cool:

if you set the StaticInstance.RadialPosition and call StaticInstance.update() to move an object. (ok when I make this class also public accessable) 

 

Link to comment
Share on other sites

2 minutes ago, Ger_space said:

Yes, StaticInstance is the class which holds all the information about any Object. From there you can access everything within KK. all other tables are just for faster lookup times.

 

thanks for that, helps a lot with compatibility which is one of the things I always try to maximize :)

 

and regarding efficiency, my code is probably not the most efficient, but I have almost no background in coding so that was expected :D

 

Link to comment
Share on other sites

1 minute ago, Sigma88 said:

thanks for that, helps a lot with compatibility which is one of the things I always try to maximize :)

 

and regarding efficiency, my code is probably not the most efficient, but I have almost no background in coding so that was expected :D

 

I needed to learn a lot, when I got suddenly the heritage of KK. 

I checked in the changes into github, so you can get a copy and start coding. I updated also the lated test-release on github. so you don't need to build your own KK 

Link to comment
Share on other sites

@SpannerMonkey(smce) 

I added now an AudioPlayer StaticModule into KK

You can get the release here: https://github.com/GER-Space/Kerbal-Konstructs/releases/tag/1.1.9.2

 

	MODULE
	{
		name = AudioPlayer				// internal identifier
		namespace = KerbalKonstructs	// internal identifier
		audioClip = KerbalKonstructs/FreeStatics/Sound/TestSample  // The sound as an .ogg or wav file
		minDistance = 1					// loudness falloff start distance
		maxDistance = 2500				// at which distance shoud the sound stopped
		loop = true						// loop the sample or play it once (currently only looping is supported)
		volume = 1 // range from 0 to 1 how load the sound should be
	}

Add this to any StaticModel definition and it will play the sound as soon you range.

Link to comment
Share on other sites

@Ger_space That definitely works... But adjusting the settings has no perceivable changes to volume or range of effect .   Using stock, as per delivered settings (copy pasted from thread) , and the addition of my  file path,  the sound was audible at full volume over 10km distant,  and reducing volume by half and reducing range to 500 (presumably meters? ) the track was still audible at 8.5km (another launch point) .

That little snag aside, it's a great addition and certainly starts to bring the place to life,...  Cheers 

PS checked the logs, nothing there apart from normal "we are here logs" from the statics etc

Link to comment
Share on other sites

7 hours ago, SpannerMonkey(smce) said:

@Ger_space That definitely works... But adjusting the settings has no perceivable changes to volume or range of effect .   Using stock, as per delivered settings (copy pasted from thread) , and the addition of my  file path,  the sound was audible at full volume over 10km distant,  and reducing volume by half and reducing range to 500 (presumably meters? ) the track was still audible at 8.5km (another launch point) .

That little snag aside, it's a great addition and certainly starts to bring the place to life,...  Cheers 

I should have tested it a bit more :blush:

But I think I know how I can fix this. It was late yesterday, I was just happy I got any sound out of an KK static.

Link to comment
Share on other sites

2 minutes ago, Sigma88 said:

@Ger_space I was trying to make use of the public method GetAllStatics() but the static class StaticDatabase is not public

is there a way to get around that? or do I need you to make that public as well?

you need to make this public as well. :blush: .sorry. 

I cannot provide a fix for this in the next few hous, as I'm traveling all day. 

Edited by Ger_space
Link to comment
Share on other sites

5 minutes ago, Ger_space said:

you need to make this public as well. :blush: .sorry. 

I cannot provide a fix for this in the next few hous, as I'm traveling all day. 

don't worry, I'm not releasing anything until the changes are included in an official KK release, and I'm not in any hurry so just do that whenever you have time :wink:

and thanks again of course :)

Link to comment
Share on other sites

a new beta version is now online. 

https://github.com/GER-Space/Kerbal-Konstructs/releases/tag/1.1.9.3

 

Changes since the last beta:

  • the StaticDatabase is now public accessable
  • fixed the AudioSource Module, so the falloff range now works (linear falloff from min to max range)
  • colliders (exept mesh colliders) are now rendered when the object is selected in the editor
  • AudioSource range is modified by the placed statics scale
  • added a trigger-collider only sample asset for the AudioSource module (you can now see the range how far the inner zone maximim volume is and scale the audiorange with it)
     

 

@Sigma88 I uploaded a new Version which has the StaticDatabase public

@SpannerMonkey(smce) The AudioSource now works as it should. The new Static is handy to place sounds without needing to modify existing assets and for placing sounds in a area without beeing visible. the mesh is scaled to 500m so you see the area when editing. to increase the area, 

 

Link to comment
Share on other sites

3 minutes ago, SpannerMonkey(smce) said:

@Ger_space Nice work all working as advertised , thanks for adding this :)

The complete version below,  (you want it for KS?) and has very little game impact, without scatterer installed clock is green even with multiple ships around.

  Hide contents

 

 

:o, I want to use that in GPP so badly. How cool!

Edited by Galileo
Link to comment
Share on other sites

1 hour ago, Angel-125 said:

Is there a way to force all the bases to be open? I keep having to re-add them in my game. Keep up the great work, I am having lots of fun exploring!

Activate the setting in the cheats section. (KSP difficulty settings)

I would need a log file when this happens. (Without the setting activated) I could not reproduce this.

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