Jump to content

[WIP] KerbTown v0.13 Beta - Place static buildings, cities, launch sites & more!


Razchek

Recommended Posts

is there any reason you can't have a key in the cfg file specify the transform, or iterate over the gameobjects and use the first one with a given name like "spawnPoint" so it's automatic?

perhaps i can. i will try to add that feature and make it as the default transform name.

Link to comment
Share on other sites

@HoneyFox: as I understand, it looks like as complicated for modders as for users to create a building with this spawnpoint thing with "mark as launchsite", or your explanation is not clear enough. Maybe a straigtht and simple working example could help.

Link to comment
Share on other sites

@HoneyFox: as I understand, it looks like as complicated for modders as for users to create a building with this spawnpoint thing with "mark as launchsite", or your explanation is not clear enough. Maybe a straigtht and simple working example could help.

I'm working on it and have such plan:

modders need to add a line in the part.cfg: (example codes are from the Wayland Launch Tower's cfg)

STATIC
{
...
angularDrag = 1
crashTolerance = 1
maxTemp = 1
breakingForce = 1
breakingTorque = 1

DefaultLaunchPadTransform = waylandtower_spawn

...
}

So you see that last line sets up the name of the spawn point.

Now when you try to mark this model as a launch site in game, the second box will be automatically set to "waylandtower_spawn" so that you don't need to fill in by yourself.

I know that it might be better to simply hide the second box, but i'm thinking about how to support multiple spawn points in one model later (which is a feature Ryan wrote several "TODO"s for)... and that's why I made such design.

Oh, just wondering... do you think multiple-spawn-point feature is really needed?

Edited by HoneyFox
Link to comment
Share on other sites

It's worthwhile for runways so you can pick which end you want to spawn at, but for actual launch pads not particularly.

well then the feature is still needed. But i might need to make some improvement... if there's only one spawn transform defined in the part.cfg, it will be the default one and that second box can be hidden. If not, perhaps a label and "Prev"/"Next" buttons can be provided to allow you to choose which spawn transform you want to mark as launch site with the current name. (so it will be possible to have "AirfieldName-09" & "AirfieldName-27" two launch sites for you to choose to takeoff, though they are actually in the same runway model)

Edited by HoneyFox
Link to comment
Share on other sites

have been fixing some bugs and do more tests, and working with several modeling guys.

And here's something to show :)

screenshot108.png

Yes, i'm playing KSP with NathanKell's wonderful RSS and this platform is located at Lat 0, Lon 154W, same location as the "Ocean Odyssey" in RL.

Edited by HoneyFox
Link to comment
Share on other sites

Just browsed through the source to figure out how you solved the launch bug.

So there was something wrong with the assumed transform name of the launch location? Could you explain what you figured out changed between KSP version?

Link to comment
Share on other sites

One feature which will be very great is camera freedom (being on the ground, or sometime under, is not very helpful) and use various coordinates system, as X,Y,Z position is not very common in-game. Kerbtown gives lat./long. already, I guess it might not be too hard to do this way.

For the camera, the plug-in doc show a view from above (in house manipulation), but there is no info about any available keys in it.

Link to comment
Share on other sites

Just browsed through the source to figure out how you solved the launch bug.

So there was something wrong with the assumed transform name of the launch location? Could you explain what you figured out changed between KSP version?

no, there's no tranform name assumption any more in this KSP version. You just need to register your new sites to the PSystemSetup, where all launch sites' (stock: LaunchPad & Runway) information is stored. and you need to provide the transform name during the register.

Link to comment
Share on other sites

One feature which will be very great is camera freedom (being on the ground, or sometime under, is not very helpful) and use various coordinates system, as X,Y,Z position is not very common in-game. Kerbtown gives lat./long. already, I guess it might not be too hard to do this way.

For the camera, the plug-in doc show a view from above (in house manipulation), but there is no info about any available keys in it.

Fixing it...

EDIT: Fixed... will be in next release.

Edited by HoneyFox
Link to comment
Share on other sites

Fixing it...

EDIT: Fixed... will be in next release.

great :)

I know that it might be better to simply hide the second box, but i'm thinking about how to support multiple spawn points in one model later (which is a feature Ryan wrote several "TODO"s for)... and that's why I made such design.

Oh, just wondering... do you think multiple-spawn-point feature is really needed?

I just figured out what does this mean: having for example a large muti-purpose building (called Mega-One for example) with two helipads, one small rocket pad, one VTOL pad we have 4 spawn points (ex: heli1_spawn, heli2_spawn, rocket_spawn and vtol_spawn).

So the first box should be the object name (Mega-One), the second box the spawn point name (any of the *_spawn), that's correct ?

It can be useful despite not common, maybe better with aircraft carrier (1 runway, 1 helipad) or big airport (multiple runway depending on size + which role they have)

Link to comment
Share on other sites

great :)

I just figured out what does this mean: having for example a large muti-purpose building (called Mega-One for example) with two helipads, one small rocket pad, one VTOL pad we have 4 spawn points (ex: heli1_spawn, heli2_spawn, rocket_spawn and vtol_spawn).

So the first box should be the object name (Mega-One), the second box the spawn point name (any of the *_spawn), that's correct ?

It can be useful despite not common, maybe better with aircraft carrier (1 runway, 1 helipad) or big airport (multiple runway depending on size + which role they have)

The first box is just a name for the launch site, has nothing related to the model. The second is correct, it is the spawn point name inside the model.

Link to comment
Share on other sites

no, there's no tranform name assumption any more in this KSP version. You just need to register your new sites to the PSystemSetup, where all launch sites' (stock: LaunchPad & Runway) information is stored. and you need to provide the transform name during the register.

OH! so they quietly made a sensible spawn system. When they did that, and everything broke, I asked the devs if they could make a system that would be sensible and be accessible to mods, cause the various mod spawn systems kept breaking with each version.

Turns out they already had, but just never responded...

I have a water launch system in my mod which does it in a very hacky way. I wonder if I could give it a transform name, and then create that transform just in time, at the right lat/long as the flight scene starts. It seems KT must be rushing to do some of the same when the scene starts. It might still be affected by the Put To Ground though, which is problematic in the water.

Link to comment
Share on other sites

OH! so they quietly made a sensible spawn system. When they did that, and everything broke, I asked the devs if they could make a system that would be sensible and be accessible to mods, cause the various mod spawn systems kept breaking with each version.

Turns out they already had, but just never responded...

I have a water launch system in my mod which does it in a very hacky way. I wonder if I could give it a transform name, and then create that transform just in time, at the right lat/long as the flight scene starts. It seems KT must be rushing to do some of the same when the scene starts. It might still be affected by the Put To Ground though, which is problematic in the water.

They do have such a system but it's not public, that's why i had to use .net reflection to access the system.

If you mean to use the stock KSP spawning function, you need to place something there which contains colliders, so that the system can use Raycast to judge where to place the rocket exactly, otherwise Put-To-Seabed will happen. If you don't do that, something really bad will happen (which is what i've experienced when i was testing my sea launch platform).

Currently i changed the mechanism of KT a bit so that these static objects are created and placed when entering the space center scene, and it only runs once.

Link to comment
Share on other sites

If you mean to use the stock KSP spawning function, you need to place something there which contains colliders, so that the system can use Raycast to judge where to place the rocket exactly, otherwise Put-To-Seabed will happen. If you don't do that, something really bad will happen (which is what i've experienced when i was testing my sea launch platform).

So if there was a dock object just below the water surface with a spawn point, and we build ships with launch clamps of an appropriate height, would it spawn at more or less the water level, the clamps lifting it off the submerged dock, and decoupling it would result in a gentle launch?

Meanwhile, if launching a submarine, without the clamps, the craft would spawn on the submerged dock, and buoyancy would lift it off the surface and clear to sail?

Link to comment
Share on other sites

hmm... looks like multiple-spawn-point feature is not very useful... because of two reasons: 1. you can always create separated models and place them together in the game. 2. The game will clean other vessels on the same object when you want to launch a new vessel, this will give some trouble and confusion to players.

Edited by HoneyFox
Link to comment
Share on other sites

So if there was a dock object just below the water surface with a spawn point, and we build ships with launch clamps of an appropriate height, would it spawn at more or less the water level, the clamps lifting it off the submerged dock, and decoupling it would result in a gentle launch?

Meanwhile, if launching a submarine, without the clamps, the craft would spawn on the submerged dock, and buoyancy would lift it off the surface and clear to sail?

Worth a try, i think both should work. and i think the clamp might be even not necessary because the buoyancy will help to lift the object if it's not super heavy. ah, you mean sub-launching a rocket? then clamp is needed to hold the rocket or the buoyancy will push it out of water.

Link to comment
Share on other sites

We can also launch on land, with an appropriate ramp and wheeled launch trolley to roll into the water, but a true dock would be nice.

P.S. yes, take advantage of underwater launching to launch either ships or subs, with the former needing to be held above the seabed, at water level (eyeballed estimation of clamp height or using a part as a rough ruler when building in SPH), for launch, just using clamps.

Edited by colmo
Link to comment
Share on other sites

Ok a new version release: (link is actually the same)

https://www.dropbox.com/s/pfssc2u341zp58a/KerbTown%20%28fixed%20for%20v0.23%29.zip

Fixed camera,

Add Lat/Lon input,

Launch site modeler should add "DefaultLaunchPadTransform = ..." in cfg files with the spawn point's name in Unity.

Code example:

	...
crashTolerance = 1
maxTemp = 1
breakingForce = 1
breakingTorque = 1
DefaultLaunchPadTransform = spawnPoint
...

In Unity the hierarchy should look like this:

...
model // The object that has "PartTools" component
launchPad // Actual model objects are inside this node
...
spawnPoint // This is the empty transform we need to add
...

Link to comment
Share on other sites

Thanks for the update, I got an exception with this release, on exiting KSP:

KerbTown: An exception was caught while destroying a static object.

(Filename: C:/BuildAgent/work/ea95e74f6e5f192d/Runtime/ExportGenerated/StandalonePlayer/UnityEngineDebug.cpp Line: 54)

NullReferenceException

at (wrapper managed-to-native) UnityEngine.Renderer:set_enabled (bool)

at PQSCity+LODRange.SetActive (Boolean active) [0x00000] in <filename unknown>:0

at Kerbtown.KerbTown.DestroySoInstance (Kerbtown.StaticObject staticObject) [0x00000] in <filename unknown>:0

UnityEngine.Debug:Internal_LogException(Exception, Object)

UnityEngine.Debug:LogException(Exception)

Kerbtown.KerbTown:DestroySoInstance(StaticObject)

Kerbtown.KerbTown:DestroyInstances(Dictionary`2)

Kerbtown.KerbTown:OnDestroy()

It prevent KSP to exit !

I just have one basic building made with data from plug-in doc (a mere cube without texture near KSC):

STATIC

{

name = building1

mesh = building1.mu

module = Part

category = none

author = JK

static = true

scale = 1

rescaleFactor = 1

cost = 0

subcategory = 0

title = Epicosity

manufacturer = Kerbice Building Inc.

description = Do not expose to sunlight, water, air, or space.

attachRules = 1,1,1,1,0

mass = 1

dragModelType = default

maximum_drag = 1

minimum_drag = 1

angularDrag = 1

crashTolerance = 1

maxTemp = 1

breakingForce = 1

breakingTorque = 1

Instances

{

RadialPosition = 158265.9,-425.9377,-578869

RotationAngle = 81.9403

RadiusOffset = 64.5

Orientation = 0,1,0

VisibilityRange = 100000

CelestialBody = Kerbin

LaunchSiteName =

Scale = 1,1,1

}

}

Link to comment
Share on other sites

Thanks for the update, I got an exception with this release, on exiting KSP:

It prevent KSP to exit !

I just have one basic building made with data from plug-in doc (a mere cube without texture near KSC):

Argh... I have never exited the game via the option in the main menu... Always close the game by clicking the "X" button of the window or sometimes via Windows task manager. (yeah I always run KSP in windowed mode)

Link to comment
Share on other sites

Argh... I have never exited the game via the option in the main menu... Always close the game by clicking the "X" button of the window or sometimes via Windows task manager. (yeah I always run KSP in windowed mode)

I only play windowed too, but rarely use "the hard way" :cool:

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...