-
-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ground-based stations not placed on flat land #7
Comments
The problem comes from the spaceports being placed at the desired latitude/longitude at the height of the terrain at that point. On a steep slope you end up with station embedded in the side of the hill. I think collision detection is disabled once the player is in the docking animation (ie when the pad is lowering), but it most certainly is not during the descent. If the pad is inside the mountain, the ship will crash. A nasty hack solution would be to disable collision detection during the final descent, but that's rather game-breaking. A better solution would be to only place the entire station on flat ground, and walk outwards from the desired location until some is found. It does mean checking the entire base of the station though, not just a single point. A further extension to this would be to have the station placement code instruct the terrain engine to force some flat terrain at that point - excavation works, if you will. I have no idea how to make all these things happen sanely but as the terrains get more complicated it will need to be addressed in some fashion. |
To further your idea rob, it may be possible to check the slope value of a specific point, in this case the center of the spaceport, which means you only need that small section to appear flat. |
A couple of screenshots to demonstrate the problem. The first is a station partially embedded in the terrain. This doesn't stop docking from happening (though its weird to pass through the terrain inside the dock with collisions disabled. This shows the other side of the problem - stations can stick out of the terrain, making it possible to fly under them. |
I've had a look at this and it might be a little tricky to do. |
The interface sounds right. I imagine its trickier around the edges as you don't want it to make a vertical cliff, but rather a gradual incline or something, so it needs to be hooked up to the terrain gen in some way. Or maybe you do want a cliff for a suitably cliffy terrain. Hmm. It also occurs to me that you wouldn't necessarily want to level out a height-mapped body much/at all, and also completely flat might not always be the right thing - some amount of gentle slope might be acceptable. Ping @s20dan. He's probably the only one that can tell you where the right places to hook are. |
Hey I've been thinking about it somewhat, The best way might actually be to directly change the Noise settings (FracDef) based on proximity to a city. One way is to create a value that is always 1.0 unless near to a city, then it scales down to 0 the closer you get. You can multiply the lucanarity and frequency settings for all the main noise with that. A function like the craters or volcanoes could do it too, but it would probbaly need this proximity valuie (0-1) to multiply the frequency with, otherwise your whole planet would be flat :) Is starport information already present when we run GetTerrainHeight(vector3d) ? If it is then its no big deal to scale terrain by starport proximity. |
Yes, starports are position when the system is created. If I'm understanding correctly, this approach will still give some variation in the terrain at lower scaling values but it'll be more like "rolling hills" than "epic mountain ranges". I expect that would look quite natural, making this an excellent approach. I assume then that we'd give GetTerrainHeight a second argument for the scaling factor? Is there any risk that we'd still hard edges for canyons etc? ie can we guarantee that the land under the station/city will be "flat" with this approach? |
Yeah you got it.. We would just scale the high frequency noise with this value, leaving the larger 'rolling hills' noise un-changed, so the area would appear flatter around the starport but not totally flat, it might be enough for it to work. But you picked up on a valid point, it will remove canyons from the immediate vicinity in most cases. I say most cases, because there are several methods currently in-use for creating different styles of canyons and some would be un-affected unless we specifically wanted them to be. I assume then that we'd give GetTerrainHeight a second argument for the scaling factor? I don't think so, provided we can get the value 'distance from starport' then we can just multiply the numbers. EG: Just add: m_maxHeightInMeters * m_starportDistance, Or further down: n += n * 1.25 * ridged_octavenoise(m_fracdef[6], Change: Clamp(h * 0.00002 * m_starportDistance, 0.3, 0.7) That will give flat land under the starport, but could give other unwanted features like too many cliffs, but I think its worth a try. |
So it seems we want to pass the distance through Planet::GetTerrainHeight to GeoSpherStyle::GetHeight. It can't be a member since its different for every point. By the looks of it you want the distance to be 0.0-1.0 since its being used as a scaling factor? In that case I guess we want to define a maximum flattening area that can safely cover the starport and surrounding city. CityOnPlanet has the max radius as 5000m (via a define) so I guess we can say distance == 0 -> scaling == 0.0, distance >= 5000 -> scaling 1.0. Does that sound right> I think to do this right we have to loop over all the surface starports on the planet and pass through the minimum of the distances from the wanted position to each starport. I can't see a better way since we don't really know where the starports are from just the height point. I don't think it has to be expensive. |
That sounds great. Thats basically: It should work rather well, we can combine it with some forced flattening too if we really need to, but Im not sure the best way to work out the distance from multiple starports for a specific point. |
I think this:
Clamp to the acceptable distance first, then divide down to get it to 0.0-1.0. I'll go and learn some maths to see of there's a way to quickly find a useful midpoint of multiple vectors. Otherwise its just looping. |
Some stuff from Ae_ that I don't have brain to digest right now:
|
i can only congratulate to this decision, usually i just worked around that issue (basements), but yes it's better to have a flattened terrain, even if i will miss the strange places then.... "chasch nüd beides ha, z'füferli und's weggli" (you can't have everything) |
#924 will solve this |
@fluffyfreak should this be reopened, or split (is it even possible in github?) to a new issue? |
Checked out Thebe Gas Refinery. Looks fine on Low and Medium fractal detail here, 1.3km underground on Very Low. Possibly within the range of "working as intended". |
it still breaks the game for some players. it can only be considered "working as intended", when very low fractal detail is dropped. but even then, there is still no guarantee, that this issue is solved for every ground station. |
It doesn't break anything functional, just aesthetic. You can still fly to those stations. That terrain on Thebe also looks way more interesting from the inside than the outside. I stared at it for a while. Thebe uses TerrainHeightAsteroid, which is literally four lines of code and so pretty easy to fix, although I'm never sure what the intention was with those height fractals. In this case you could simply remove the m_fracmult multiplier from TerrainHeightAsteroid.cpp, as it's a very cheap terrain function by Pioneer's standards. |
Well, you can't dock and finish mission. |
No this needs a new Issue if it needs tracking at all, I should just work out how to patch the problem for now |
Original subject: Bentley Starport (Canqu [-2,-4]) is in wrong position.
Bentley Starport (Canqu [-2,-4]) is in wrong position. There is no possible to land in bay 2 due to collision with the planet surface. Alpha 9.01.
Logged by Mysibrat on SpaceSimCentral
The text was updated successfully, but these errors were encountered: