• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

A bridge that can be sailed under

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I'm making an arcade like game. In it, I want a bridge that land units traverse, but the player's boat can sail beneath. I have a way to do it, but I'm hung up on some issues involving the height of terrain in water.

My general plan: make the bridge non-functional (just a doodad). The boat can therefore sail normally under it. Meanwhile, land units that approach the bridge from the right have collision removed, storm crow added and removed, and then have their height adjusted so that they "fly" at the height of the bridge. This will make it look like they're walking across it.

So what flying height do I use for the unit? I've been getting the Z-height of the terrain at the point of the unit (every .03) and adjusting its flying height accordingly. I discovered the height of the bridge, and then set the height of the walking unit to that height minus the terrain height he is currently at.

Problem: It works fine when the unit is in the middle of the bridge, but when the unit is over land it starts flying. I think the problem is that the "GetLocationZ" function works weirdly on water; or that the unit is responding to nearby cliffs (like how fliers start ramping up when near a cliff).

I've attached the testing map here. If you play test it, just find the peasant to the right of where the camera starts, and walk him onto the bridge.
 

Attachments

  • Siege of Cymril.w3x
    194.1 KB · Views: 53
For me unit was only flying only a short moment after I left bridge, but then worked properly. ^^

And this short moment is only because the bridge-region is stretched too much in east/west direction. I would do it as small as possible.

The feature with falling of bridge + death animation looks very cool, man! ;)

Short tip, after the "wait 1 second" don't use "LeavingUnit" anymore. It may not work if during the 1 second some other units are leaving, too.

Using "TriggeringUnit" would make it mui. TriggeringUnit and DyingUnit can be treaten like locals.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Thanks for the tip about "triggering unit."

The problem is right at the beginning when the unit enters the region but before he gets over the water. I have a fix that detects whether the unit is over water or not, and then adjusts the height a bit. But it's still jittery and not perfect.
 
Just a question, as things like that are extremely complicated to make without any satisfying results (there's a lot of graphical issues when doing something like this, like the shadow being cast on the water instead of the bridge and collision being deactivated for all units on the bridge):
Do you need to have units travel across the bridge while ships are under the bridge or are both events seperated from each other?

If the latter, than you can use a small trick: place a doodad bridge on top of your destructable, walkable bridge, so that both models are within each other. Then you can hide your destructable bridge to make it non-functional, but the doodad bridge would still be there so there is no visual change.
 
Level 14
Joined
Aug 30, 2004
Messages
909
I'm afraid I would need the boat to sail while there were people above him. I had thought of the problem of collision, and I didn't see a good way around that if I was going to have big battles on the bridge.

I think you're right that it might not be worth the effort. It's not essential for the map, so I think I might limit it to just friendly units crossing, rather than battles or anything. It might look a bit rough right when they first enter the bridge, but I'll see what I can do to hide that with doodads.

Thanks everyone.
 
With your flying approach, you will also run into another problem: you can not click on the bridge to make your unit walk ontop of it. The click will go "through" the doodad and onto the ground.

I made a two-layer terrain system in the past that I can give you, if you are still interested in a bridge system:
http://www.thehelper.net/threads/multi-floor-system.131026/#post-1144357

However, there's no way to fix the clicking and collision issues, so it will only be useful if you want to play your map with arrow key controls.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Thanks Zwiebelchen, I'll take a look at that. I was aware of the clicking issue during testing, but the land units are all computer controlled. It's a one player map where the player sails around in a ship.

Thanks again, + rep.
 
Thanks Zwiebelchen, I'll take a look at that. I was aware of the clicking issue during testing, but the land units are all computer controlled. It's a one player map where the player sails around in a ship.

Thanks again, + rep.
In that case, you probably don't need the collision either. So I think you can just go with my system and it should work fine.
 
Would it be possible to do this with a unit indexer and unit is moving and a small physics system? I already know it is possible, but I need to know if it can support 400 units or at least over 100.

The main idea is to make all units flying then exploit flying height with GetZ however there is another problem which is can you fix flying units from messing up with cliff/terrain height? I am sure you can. Hope someone can get back to me on this.
 
It'll just be MUI, no need for MPI and thanks. Don't expect it anytime soon though... =(
What? Do you even know what you are talking about? MUI always includes MPI.

If you restrict a system like this to only two layers (floor and bridge layer), you can abuse air-only and ground-only pathing blockers to at least maintain terrain collision of the units.

As soon as you want more than two layers, there is naturally no more collision at all, as then all units need to be flying units.


The number of units it can support greatly depends on how dynamic the height map of the layers is. If you only need them perfectly flat, the number of units is basicly irrelevant.

Flying units have issues with cliffs. This is not easily fixable and I'd rather recommend not using cliffs at all.


Again, if you want player controlled units at anything else but the ground layer, you can not use the mouse to control the units anymore, so only an arrow key movement system makes sense, as the mouse will always "click on the ground".
 
The same issue goes with terrain raise tool does it not?
Nope, raise tool does not have issues here; only cliffs matter.

MUI and MPI are two different things, both indexing methods. One extremely limiting while the other really unlimited.
MUI = Multi unit instancable
MPI = Multi player instancable

A MUI system is always MPI. But an MPI system is not always MUI.



EDIT:
Technically, there is a way to "simulate" clicks on the bridge layer.
You need to catch all clicks made "behind" the bridge (by projecting the camera view onto the bridge), then create the green click-response arrows for the right-click as an SFX manually on the bridge.
However, for transparent bridges, you'd see two click response arrows then.

A system like that requires a lot of vector algebra and maths (the term raytracing is used for this scenario in graphics programming). I'd say it's extremely complicated to make for a GUIer.
 
Status
Not open for further replies.
Top