Sign in to follow this  
Razchek

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

Recommended Posts

Razchek/HoneyFox, I'm using KerbTown in earnest and would love to fork it. Any possibility of getting hold of the source?

Share this post


Link to post
Share on other sites

Due to my recent travels in trying to figure out what's going on with the 4 dimensional positioning, I came across this:

https://github.com/HubsElectrical/KerbTown

I'm an amateur with code so I don't know if this is the complete code or recent etc...

Edit: Just saw, it's linked in the op too, but no idea if it contains the 0.23 fixes...

Share this post


Link to post
Share on other sites
I was going to try regardless of it being dead or not, I was just curious if there were problems to look out for. I got a 0.23 fixed version from this post. It seems to be working.

The only thing that confuses me a little is how objects are placed. First there are 3 axes + height to position things. That is one axis to much in my head. :confused:

Secondly I don't really get where the info about placed objects goes. There is Instances data inside the part.cfg files, those contain all the data I enter when placing a part. Additionally the same date is inside the savegame in a file named KTInstances.cfg. When I change data directly in the part.cfg, stuff gets duplicated. I have not yet tried what happens if I delete the KTInstances.cfg or change it to match the part.cfg.

I have the strong suspicion however that having different data inside the two files is a bad idea :P

I'm looking into automatically placing stuff neatly aligned between two positions so I don't have to line up dozens of street pieces by hand. I hope it's possible at all.

So whats what here, could anyone shed some light?

First, the latest source code is in the link posted by HoneyFox (it is possible it is not a direct link, I don't remember, but plug-in link is on his github project page).

Right link for the right version is seriously confused, I've suggested to HoneyFox to create his own thread to avoid confusion all people made...

Yes, 3 axis is really weird but that's not such a big deal. The instances in savegame looks like kind of "private stuffes", I rely on the instances data inside building config for location in my release and that's enough. I guess Kerbtown update save when a building is added. It need quite some improvements for sure and as Razcheck has never release it as a finished product, it's fair.

Better to let data in save alone as they should not be modified I guess.

Why not a node snap system like KSP parts ? It would be great, you defined two nodes in your road objects (front/back), and they all snap right together smoohtly :).

But not for now, you have either to get the right coordinates (simple maths: road A coord X,Y,Z, road B is L long, corridnates should be X+... or Y+... or Z+..., but it could be more like X+cos(...), Y+sin(...) is coordinates are not aligned), another way is to create big smooth road in your 3D program made with smaller standard chunk like Nothke made in his KerbinCity dev pack.

Share this post


Link to post
Share on other sites
Due to my recent travels in trying to figure out what's going on with the 4 dimensional positioning, I came across this:

https://github.com/HubsElectrical/KerbTown

I'm an amateur with code so I don't know if this is the complete code or recent etc...

Edit: Just saw, it's linked in the op too, but no idea if it contains the 0.23 fixes...

This is why there are three axis AND an altitude:

Kerbin is round. The coordinate system is not.

R2sz2G0.png

This means any objects coordinate is seen as a position in a 3D cube system. In the image above, Y is not UP for the player, it's the direction from the south to the north pole. X and Z is similarly meaningless as long/lat. at the equator, in the western hemisphere, +X may be skywards. at the south pole, -Y is skywards.

This should also tell you why moving an object along a single axis, it both moves left, AND a bit up for instance.

So that explains the three numbers, what about the altitude number?

It's simply a helper. If you have the prop in the correct position, it just moves the object closer to or further away from the planet core for you so you can stop thinking in three crazy dimensions.

Now there are ways to use actual Long/Lat instead, but that's obviously not what we are doing in this case.

Share this post


Link to post
Share on other sites
[...]

That the cardinal axes are not aligned to the surface of the planet was pretty clear to me. I was just confused because I expected positioning on the surface to be 2 dimensional with latitude and longitude. The GUI actually allows placing objects that way so I went to look at how those inputs are converted.

From that I found out that the 3d vector used for positioning likely works like this. It seems to be the normal vector of the surface which if you think about it defines a position on any strictly convex body. There are some strange magic constants in the conversion from latitude/longitude but I figured If i do my calculations in latitude/longitude and convert the same way the actual code does I should be fine.

I also found this explanation on how to calculate a latitude/longitude pair you would arrive if you traveled a set distance in a compass heading. Currently I'm playing around with those formulas, they seem to be working well except for the heading formula. That has some issues with headings > 180

Ideally it would probably be better to avoid latitude and longitude completely and stay with the n-vector to avoid these issues. But I can't figure out a way to calculate the new position that way... Or even how I would represent direction in that system...

So I will probably stay with what I already have and figure out how to fix the heading formula.

Share this post


Link to post
Share on other sites
Ideally it would probably be better to avoid latitude and longitude completely and stay with the n-vector to avoid these issues. But I can't figure out a way to calculate the new position that way... Or even how I would represent direction in that system...

So I will probably stay with what I already have and figure out how to fix the heading formula.

In fact, It's me who ask HoneyFox for lat/long coordinates as according to the formula given here by voneiden, it might be useful for people taking directly Mechjeb (or any other coordinates finder) coordinates into Kerbtown, I don't use coordinates at all myself, I always put a vessel nearby the location I want to add a buildings, then fire up kerbtown.

Perhaps not displaying coordinates at all (by default, hidden textfields maybe) would be better.

The bad thing is the lack of a textfield for orientation, slider is not precise enough.

And thanks snjo for the explanation, I have more imagined a body in a planar projection form (Mercator for example), mostly because it's not obvious which axis move a building on which way.

Share this post


Link to post
Share on other sites

I'm about to give up on this, it's just too frustrating :P

The function that converts from the Lat/Lon input is a mystery to me. If I place an object somewhere, the GUI shows the vector position and lat/lon. If I copy lat/lon and manually calculate the vector the same way as the kerbtown sourcecode (allegedly) does, I get different numbers. :confused:

If that wasn't funny enough, altitude kind of snaps to a grid or something. It's all fine if you use the buttons to move stuff up and down. But if you change the numbers directly to produce smaller movements nothing happens. Change them slightly more and the piece jumps to a new height, slightly off in the other direction. Maybe that's a limitation of the underlying KSP systems... I don't know. Clear is that it effectively prohibits using the system to place stuff that has to fit together exactly.

Combining the elements to make a large road mesh is an option, but when you make large roads you need to take the curvature of the planet into account. Otherwise you have these enormous ramps at the end like the runway does.

It might be possible to write a blender script that bends a mesh accordingly, but you would need to produce different models for use at different heights and it all gets way to complicated for it's value fast :P

After all it's just a road, and rovers slightly suck don't they :)

Share this post


Link to post
Share on other sites

:) the thing to remember with Kerbtown is to be near the location you want to put a building, I have tried moving a building from KSC to KSC2 location, after 600 kms or so, I got inside Kerbin and seen the white/blue orb. Now, I launch something, land nearby, then fire up kerbtown menu.

For the long road, I think it's ok to make 1 km length section (or less), as at any landscape altitude (< 6761 ms to be precise), tangent will make these 1000 m flat enough.

For info, the CFA runway is 600m long and straight (and I guess Kerbin City airport runway is flat too, and 2 kms or so long).

There is also the choice of pre-assembling section into the 3D program (rotating them a little bit each time) and import one single piece ready to drop.

Share this post


Link to post
Share on other sites

Ya my original plan was to figure out how to do it with small segments, then write a script that takes 2 locations, finds a path between them where the slope is always > 1 and then generates a ton of instances to copy into the part.cfg. For something like that I definitely have to be able to calculate the positions accurately from lat/lon (as that's likely how the data about the slopes is going to be structured) and also place stuff at precise heights so it fits together...

I don't think that's going to happen :P I was also wondering if it's a good idea at all, I don't know what happens if you throw a million instances at kerbtown, would be interesting to see :)

Share this post


Link to post
Share on other sites
...It might be possible to write a blender script that bends a mesh accordingly, but you would need to produce different models for use at different heights and it all gets way to complicated for it's value fast :P

After all it's just a road, and rovers slightly suck don't they :)

My approach with the road networks I wanted in Kerbin-Side

- Keep each piece fairly small to avoid mesh collider issues.

- Ramps, ramps, ramps on each piece to allow easier intersection

- Which results in many bumps where roads intersect

- Which you don't worry about because kerbals drive tanks, 4WDs and tractors at no more than 10 kph anyway :P

Share this post


Link to post
Share on other sites
...The bad thing is the lack of a textfield for orientation, slider is not precise enough.....

The first thing I fix if/when I fork KerbTown. Too right, Justin. Stupid bloody slider. Gah.

Share this post


Link to post
Share on other sites
- Which you don't worry about because kerbals drive tanks, 4WDs and tractors at no more than 10 kph anyway :P

You know what, you're right. Kerbal rovers suck, there is no point in building a road if all your cars flip over 50km/h tops.

How to fix that is easy though. To flip one side of the craft has to rise upwards. It can do that because wheels only bother to keep the craft off the surface, and not on it. The kerbal engineer thus concludes: we need to mount wheels not only upside up but also upside down. And for good measure upside left and upside right won't hurt either.

The road needs some slight adjustments but that's quick work... check it out:

Javascript is disabled. View full album

I also figured out most of my troubles with calculating the positions. The problem was: I'm apparently stupid and can't keep radians and degrees apart. Also, the direction parameter in the cfg is not 0=north to 180=south, you have to subtract the longitude... or coincidentally 105° which is KSC's longitude, need to test a bit more... Keep an eye out for that if you put in your text field. My problems with height remain for the time being but it seems you can drive over such imperfections without issues. I also used box colliders for my track, I believe they are much more stable for driving on them.

Share this post


Link to post
Share on other sites

I cant wait!, would love to see Mount Kraken and Kerbins Biggest Toilet, I mean um, Runway

Share this post


Link to post
Share on other sites

50km/h? That's 13.9m/s. If you're flipping your rover at 14m/s, your rover is too tall and/or too skinny. I've built rovers that won't flip at 40m/s. However, they don't particularly appreciate hitting a bump at those speeds (144km/h, or 90mph).

Share this post


Link to post
Share on other sites

I'm going to build my mono rail, you can't stop me with your non flipping high speed rovers :P

Share this post


Link to post
Share on other sites

In the other hand rover have never been to mimic cars, if you look hhhoooww ssslllloooooooooooowwwwwwww space rovers are driven (especially because of radio signal delay + no one can be there to flip it upside-down of course), I guess Squad want to make things similar with a similar way to use them.

To make car, we'll need new wheels and probably also a plug-in to change how torque works (far too much on stock wheels as well as add-on like Wayland's wheels) or have lower values.

@the_bT: nice work :), why not making your track section in a T shape or horizontal H shape so you can "clip" wheels downside to make your "train" stick to the "rail" at any speed (tweaking the wheels/gears you use to give them more strength, so it can go at a jet powered speed :) )

Share this post


Link to post
Share on other sites

Currently rebuilding the launch-site selector code and tidying up bugs I've found reading through this thread. I do not appreciate the implementation applied by the person who picked up the project. Although sometimes hacking at the code like that to get things working is necessary, so in retrospect I guess I can respect that just a little lol. :)

I also need to set up a new server seeing as the company that was previously hosting all this content has decided to change owners and has since gone downhill. Scams, no customer support, no access to Plesk/cPanel.. etcetera. :\

At this time I have no new features to announce.

Share this post


Link to post
Share on other sites

Glad to see you are still around. missed you and your quality work.

Share this post


Link to post
Share on other sites
Currently rebuilding the launch-site selector code and tidying up bugs I've found reading through this thread. I do not appreciate the implementation applied by the person who picked up the project. Although sometimes hacking at the code like that to get things working is necessary, so in retrospect I guess I can respect that just a little lol. :)

I also need to set up a new server seeing as the company that was previously hosting all this content has decided to change owners and has since gone downhill. Scams, no customer support, no access to Plesk/cPanel.. etcetera. :\

At this time I have no new features to announce.

Great :)

A really cool feature to add is auto-cleanup of launch site (launch clamps are so lazy !)

Share this post


Link to post
Share on other sites
Is there a KerbTown building repository thread?

Not really because nobody ever released anything for kerbtown except for the silo, Kerbin City, and Kerbin Side. There was the few runways and Wayland launch tower but that's it.

Share this post


Link to post
Share on other sites

Great to hear the author of KT has come back!

:P My dirty work can rest in peace then.

Share this post


Link to post
Share on other sites
Is there a KerbTown building repository thread?

Not really a repository but here is the thread where I gather all my work.

And to be sure to don't miss anything, you can click on the logo of my signature, it's an up-to-date summary of all I've done, buildings included.

Edited by Justin Kerbice
add a missing space

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this