ZeroK-RTS / Zero-K

Open source RTS game running on the Spring/Recoil engine
https://zero-k.info
GNU General Public License v2.0
674 stars 204 forks source link

Long delay when building on terraformed platform #2327

Closed DeinFreund closed 7 years ago

DeinFreund commented 7 years ago

This happens whenever one terraforms a platform, for example on a water map to build a nuke/antinuke and uses the skydust terraform command. After the terraform is completed and the construction is started, ETA displays ??? for a few minutes until the actual construction starts.

There seems to be some engine feature where the land below the building is flattened. Even though it was already terraformed, this still tries to flatten the terrain before building and leads to the confusing delay.

Anarchid commented 7 years ago

Not whenever: there are some conditions (but i wasn't able to infer them). Making the platform slightly wider than the building workarounds this, so perhaps this is some kind of spring footprint smoothing fighting against edges of the platform. Possibly, check if engine recently changed anything footprint-related?

Licho1 commented 7 years ago

The engine footprint smoothing is the thing that causes it, shame we cannot control it properly (and add progress bar/cost to it)

DeinFreund commented 7 years ago

@Anarchid it's only when using skydust. Of course you can make a bigger platform manually and save a lot of time. If the engine smoothing is how the terrain is supposed to look then skydust is making wrongly shaped terraform.

Isn't there any way to ignore the engine smoothing?

Licho1 commented 7 years ago

We could circumvent it by allowing anything built anywhere in engine and adding our own terraform to flatten terrain. It is not trivial change afaik.

Anarchid commented 7 years ago

it's only when using skydust.

I also had failures with e.g. burrowed fusions. But not every time.

sprunk commented 7 years ago

I think he means the UI in general (not specifically using the UI for Stardust).

DeinFreund commented 7 years ago

It was inaccurately expressed. You can reproduce the same bug without using Skydust UI and it happens from time to time without doing any terraforming.

Be it via skydust or not, the problem is that it just looks like a plain bug: You have metal, you have energy, you have buildpower, nothing happens. Then you lose the game because 5 seconds delay is enough for a few raiders to kill pretty much anything. If the ongoing terraform was visible it would make it a lot less confusing.

Anarchid commented 7 years ago

It is possible to disable terraform for each building def via the levelGround parameter while keeping its requirement for slope tolerance with maxSlope. Dunno if this is a good idea in practice.

sprunk commented 7 years ago

I think it's a good idea but some models won't support this. IIRC antinuke is one example - it has no underside and does not extend below y = 0.

Anarchid commented 7 years ago

If that works, it it should also allow complete replacement of engine levelGround terraform with the zk-terraform. Either as automatic pre-inserted terraform command or gratis instant level on building completion.

DeinFreund commented 7 years ago

This sounds good, disable levelground and then use some gadget to flatten the terrain either progressively as the object is being built or instantaneously at the beginning. I don't think there should be a cost nor delay associated with building unless intentionally using terraform to make the building fit.

sprunk commented 7 years ago

IMO don't flatten at all if the terrain is okay. If it's too rough, use Skydust UI. If a model requires flat ground, tweak the model.

GoogleFrog commented 7 years ago

We cannot tweak enough models to fix them for non-flat ground. Many models, for example factories and chainsaw, would need more than trivial tweaking. The engine ground smoothing seems fairly buggy, the fact that it fails with skydust UI shows that it doesn't conform to the footprint properly. Another possibility is that the shraka pyramid brushed a structure and so the skydust pillar was not perfectly flat, this would be a failure in the ticket reporting.

"Skydust" is also a failure in ticket reporting because Stardust has levelGround=0 but the term would make us assume the issue can be reproduced with Stardust.

Constructions have a parameter which controls their speed at engine-terraform, both engine-restore and pre-construction flatten. I think we could just multiply their engine-terraform speed by an appropriately large factor.

Licho1 commented 7 years ago

Hmm yeah we could speed up flaten for engine

GoogleFrog commented 7 years ago

Some cases are just broken. See https://springrts.com/mantis/view.php?id=5629

sprunk commented 7 years ago

https://github.com/spring/spring/commit/5bbe2fba6486c3dff07ce28b1ce61afbae179b3d