Discussion Vertical Pathing System

TheLegend

New Member
Reaction score
10
I've come across an idea to make a vertical pathing system but i lack the proper ideas for it

WHAT I'M AIMING FOR

a system short but effective that will create a vertical pathing network that will enable units to walk under bridges as well as over them, walk on other objects and units. It may sound complicated but it would make wc3 maps a lot more realistic. Making player units being able to jump on crates and from crates onto houses, walking under a bridge, trough a cave in the mountain, moving around houses and climbing onto the next floor of the house and so on
DOWNLOAD LINK AT THE BOTTOM OF THE POST

HOW I THINK THIS CAN BE DONE

by storing units height, object height and terrain height and adjust the flight z of an unit to make it look like its on or under another object. I know this will be hard to make so please feel free to use this post to exchange ideas and progress and when we finish the project we could get enormous credit and rep for it. Ill update how far i get with this project and please feel free to experiment on your own.

UNIT HEIGHTS​

Footman - height 92
Peasant - height 91
Knight - height 130
Bridge - height 256, fly height 50 (for cliff lvl 2)

NOTE: If you can calculate the height yourself and post in this Discussion for various units and if I have made a mistake correct me, i calculated by
making a lvl 1 cliff (i know the height is 128) using CTRL + right click hold + drag to adjust the camera so that the angle is 0 and change the scaling
of the unit so that the height is the same as the cliffs

WHAT COULD BE USEFUL​
- a system to get a object's height (complete)
- a system that would index possible z's of locations (not needed, the OZSYS works better than expected)
- Bridge height adjust system (complete)
- a new jump system with the new object height (im making it right now)
- someone to calculate existing units heights (new request)
- better models of bridges, houses and stuff

SYSTEMS SO FAR

The Object Z System or OZSYS, used for detecting the occupied height of units (designed for a jump system), will be needed later. This requires
the users "help" to operate, the user has to create units for every object he wants to index and set the Point Value of that unit (Object Editor)
to the units height
JASS:
//////////////////////////////////////////////////////////////////////////////////////////
//TheLegend's Object height system                                                      //
//////////////////////////////////////////////////////////////////////////////////////////
//IMPORTANT INFO
//--------------------------------------------------------------------------------------//
//Before importing the system you have to replace every object with units that have that//
//objects model and add them into the init function at the bottom. This system is used  //
//to get the minimum z on which a unit can stand at the location. This will enable the  //
//user to create more advanced jump systems where the units will be able to jump onto   //
//other units, walk under as well as over bridges, jump onto and over crates, houses,   //
//rocks and so on. This library will provide the user with these functions:             //
/*      function GetMinimumZ(location,boolean,real,boolean)                             */
//      -gets the minimum height if a new unit enters that location, the boolean will   //
//       determine will the terrain be included. Range is how far from the unit to scan //
//       and the last bool is if the systen will include the fly height                 //
/*      function GetUnitsZ(unit)                                                        */
//      -gets the units vertical Z value (on which height it is)                        //
//--------------------------------------------------------------------------------------//
//IMPLEMENTATION
//--------------------------------------------------------------------------------------//
//You will need vJass or NewGen World editor to implement this. If you have it then just//
//create a trigger, convert it to custom text and replece everything there with this.   //
//Before you run the system make sure all dodads, objects are replaced with units, you  //
//will have to create units with their models since units are the only tracable things  //
//in the world editor.And the system uses Units Point values to operate. You have to    //
//define the unit heights ( Point value) but here is a hint how to orientate, the cliff //
//lvl 1 is 128 high                                                                     //
//////////////////////////////////////////////////////////////////////////////////////////
library OZSYS
    globals
        private constant boolean enablesystem = true
        private group tempunitgroup = CreateGroup()
        private real tempreal
    endglobals
    public function GetUnitsZ takes unit u returns real
        local location l
        set tempreal = 0
        set l = GetUnitLoc(u)
        set tempreal = GetUnitFlyHeight(u) + GetLocationZ(l)
        set l = null
        return tempreal
    endfunction
    public function GetMinimumZ takes location l, boolean terrain,real range,boolean fly returns real
        local integer flyon = 0
        set tempreal = 0
        set tempunitgroup = GetUnitsInRangeOfLocMatching(range, l,null)
        if fly then
            set flyon = 1
        endif
        loop
            exitwhen FirstOfGroup(tempunitgroup) == null
            if tempreal < GetUnitPointValue(FirstOfGroup(tempunitgroup)) + flyon*GetUnitFlyHeight(FirstOfGroup(tempunitgroup)) then
                set tempreal = GetUnitPointValue(FirstOfGroup(tempunitgroup)) + flyon*GetUnitFlyHeight(FirstOfGroup(tempunitgroup))
            endif
            call GroupRemoveUnit(tempunitgroup,FirstOfGroup(tempunitgroup))
        endloop
        if terrain then
            set tempreal = tempreal + GetLocationZ(l)
        endif
        return tempreal
    endfunction
endlibrary


The Bridge system or simply BRSYS will (if you did everything the OZSYS required of you, that is create a unit for the bridge) make the units walk on or under the bridges. IT WORKS STUNNING MATES, JUST STUNNING
JASS:
//////////////////////////////////////////////////////////////////////////////////
//Bridge by TheLegend                                                           //
//////////////////////////////////////////////////////////////////////////////////
//INFO
//------------------------------------------------------------------------------//
//This system needs OZSYS to operate, if it is not included within the map you  //
//found this then the map is a rip. The system will attempt to give units the   //
//ability to walk under as well as over bridges, restrict fighting of units on  //
//different "levels" of the bridge. NOTE that this is not a cinematic effect but//
//an addon to warcraft to make it better and more realistic, open new ways of   //
//map games and so on                                                           //
//////////////////////////////////////////////////////////////////////////////////
library BRSYS initializer init uses OZSYS
    globals
        public group bridges = CreateGroup()
        private integer indextotal = 1
    endglobals
    private struct unitindexer
        integer id
        unit u
        location savedloc
    endstruct
    globals
        private unitindexer array D
    endglobals
    private function destroyD takes unitindexer data returns nothing
        local integer dataid = data.id
        call data.destroy()
        set indextotal = indextotal - 1
        loop
            set dataid = dataid + 1
            set D[dataid - 1] = D[dataid]
            exitwhen D[dataid].u == null
        endloop
    endfunction
    private function boolexpr1 takes nothing returns boolean
        return IsUnitInGroup(GetFilterUnit(),bridges) == false
    endfunction
    private function modandsort takes nothing returns nothing
        local unitindexer temp = unitindexer.create()
        local unit u
        if GetTriggerUnit() == null then
            set u = GetEnumUnit()
        else
            set u = GetTriggerUnit()
        endif
        call UnitAddAbility(u, 'Amrf')
        call UnitRemoveAbility(u, 'Amrf')
        if GetUnitTypeId(u) == 'h001' then
            call GroupAddUnit(bridges,u)
        else
            set temp.id = indextotal
            set temp.u = u
            set D[indextotal] = temp
            set indextotal = indextotal + 1
        endif
    endfunction
    private function identify takes unit u returns integer
        local integer unitid = 1
            loop
                exitwhen D[unitid].u == u
                set unitid = unitid + 1
            endloop
        return unitid
    endfunction
    private function setunits takes nothing returns nothing
        local location l = GetUnitLoc(GetEnumUnit())
        local location l1
        local group g = GetUnitsInRangeOfLocMatching(350, l,Not(Filter(function boolexpr1)))
        local integer id = identify(GetEnumUnit())
        local real height
        local real x = GetUnitX(GetEnumUnit()) - 64 * Cos(GetUnitFacing(GetEnumUnit())*bj_DEGTORAD)
        local real y = GetUnitY(GetEnumUnit()) - 64 * Sin(GetUnitFacing(GetEnumUnit())*bj_DEGTORAD)
        set l = Location(x,y)
        if FirstOfGroup(g) != null then
            if D[id].savedloc == null then
                set D[id].savedloc = l
            endif
            set l = GetUnitLoc(GetEnumUnit())
            set l1 = GetUnitLoc(FirstOfGroup(g))
            call SetUnitPathing( GetEnumUnit(), false )
            set height = GetLocationZ(D[id].savedloc) - OZSYS_GetMinimumZ(l1,true,256,false)
            if height <= 64 and height >= - 64 and GetLocationZ(l) != GetLocationZ(D[id].savedloc)then
                set height = OZSYS_GetMinimumZ(l1,true,16,false) - GetLocationZ(l)
                call SetUnitFlyHeight(GetEnumUnit(),height,0)
            else
                call SetUnitFlyHeight(GetEnumUnit(),0,0)
            endif
        else
            call SetUnitFlyHeight(GetEnumUnit(),0,0)
            call SetUnitPathing( GetEnumUnit(), true )
            set D[id].savedloc = null
        endif
        call RemoveLocation(l)
        call RemoveLocation(l1)
        set height = 0
        set id = 0
        set x = 0
        set y = 0
    endfunction
    private function bridgecheck takes nothing returns nothing
        local group g = GetUnitsInRectMatching(GetWorldBounds(),Filter(function boolexpr1))
        call ForGroup(g, function setunits)
        call GroupClear(g)
    endfunction
    private function leftmap takes nothing returns nothing
        call destroyD(D[identify(GetTriggerUnit())])
        call GroupRemoveUnit(bridges,GetTriggerUnit())
    endfunction
    private function init takes nothing returns nothing
        local group allunits = GetUnitsInRectMatching(GetWorldBounds(),null)
        local trigger t = CreateTrigger()
        call ForGroup(allunits, function modandsort)
        call TriggerRegisterTimerEvent(t, 0.1, true)
        call TriggerAddAction(t,function bridgecheck)
        set t = CreateTrigger()
        call TriggerRegisterEnterRectSimple(t, GetWorldBounds())
        call TriggerAddAction(t,function bridgecheck)    
        call GroupClear(allunits)
        set t = CreateTrigger()
        call TriggerRegisterLeaveRectSimple(t, GetWorldBounds())
        call TriggerAddAction(t,function leftmap)
        set t = null
    endfunction
endlibrary


AND NOW THE TEST MAP​

made a test map with some units necessary for the system (a knight, bridge, crate (for later)), youll need NewGen to open
http://www.epicwar.com/maps/199037/
 

lep

Active Member
Reaction score
8
It's not really hard. And i must know, since i already did it ;) But go ahead and build it since it's a nice project. Just look at the bridges as rects or regions an check on entering if the unit is high enough. Also, try to allow bridges above other bridges.

But i guess that leaving bridge on the "side" must be handled different from map to map. The easiest way is probably to just prohibit it. Just keep in mind, that this may not be an option.
 

TheLegend

New Member
Reaction score
10
this isnt just about bridges you know :) it should be a system that will make a 3d pathing map for every thing in the game so when you use a jump system you could land on a crate, unit, rock, tree, house etc
 

lep

Active Member
Reaction score
8
Oh welp, that makes it way, way more complex.
And normal wc3 pathfinding wouldn't work, but i think that's also an issue for bridges.
 

Bribe

vJass errors are legion
Reaction score
67
I'm pretty sure it is impossible to walk under a bridge, as the bridge is considered ground and wc3 rejects any fly height below 0.
 

TheLegend

New Member
Reaction score
10
but if you remove its pathing or just take its model and replace a units with it then it will be possible... trust me ;)

EDIT

how about a object height detection system or way to detect that ??? i could make all dodads the same height and use that constant but i think itll be better to preserve the random scaling

EDIT

I HAVE IT :D i only have to replace all dodads , objects with units and add them to unit groups (example: units with height 100 go to group 1) and when another unit comes to a specific point it checks if there is another unit there and in which group it is to set the height (im a genius), now the only problem is that im too lazy to do this... :D, when im in the mood ill make a test map
 

TheLegend

New Member
Reaction score
10
so far so good, im able to index units and set their heights fast, but i need models of crates that are "normal" not the open ones or the angled ones
 

Chewbalka

New Member
Reaction score
14
Would this be a cinematic effect?
Sounds like where the unit appears to be the location in which it could be attacked is probably diffearent. Such as if your going under a bridge you could get attacked by a unit on the top of the bridge.
 

TheLegend

New Member
Reaction score
10
after the system is finished it aint hard to make a unit stop attacking if the total height (terrain + flight) of the two units is different (about 50 offset would be allowed). It isnt planed as a mere cinematic eff but an addon to warcraft to make it more interesting, enabling more features
 

TheLegend

New Member
Reaction score
10
EDIT
i had some problems with posting there so ill post here, the comments are info and how to implement
JASS:
library OZSYS
    globals
        private constant boolean enablesystem = true
        private group tempunitgroup = CreateGroup()
        private real tempreal = 0
    endglobals
    private function groupheightcalc takes nothing returns nothing
        if tempreal < GetUnitPointValue(GetEnumUnit()) + GetUnitFlyHeight(GetEnumUnit()) then
            set tempreal = GetUnitPointValue(GetEnumUnit()) + GetUnitFlyHeight(GetEnumUnit())
        endif
    endfunction
    public function GetUnitsZ takes unit u returns real
        local location l
        set tempreal = 0
        set l = GetUnitLoc(u)
        set tempreal = GetUnitFlyHeight(u) + GetLocationZ(l)
        set l = null
        return tempreal
    endfunction
    public function GetMinimumZ takes location l, boolean terrain returns real
        local real height
        set tempreal = 0
        set tempunitgroup = GetUnitsInRangeOfLocAll(16, l)
        call ForGroup(tempunitgroup, function groupheightcalc)
        call GroupClear(tempunitgroup)
        if terrain then
            set tempreal = tempreal + GetLocationZ(l)
        endif
        return tempreal
    endfunction
endlibrary

please comment and tell me how to improve this one, ill be working on a bridge snippet and a new jump system
 

TheLegend

New Member
Reaction score
10
EDIT:
I solved that little problem, now there is another problem, well its not that bad at all...
I've created units with models of bridges, with their pathing map and things like that and the system sets the FlyHeight right, but when you approach from the side of the bridge (trying to go under it) the unit is blocked by the pathing map but if you try to jump down form the bridge, you can jump down normally. Anyone know what could cause this crazy abnormality
 

TheLegend

New Member
Reaction score
10
solved it and made some updates, tnx for nothing... ill update the main Thread in a moment with the Bridge system and the OZSYS improved system
THERE STILL is a small problem and that is that youll have to click really close to the bridges edge to get onto it cause the unit still sees the pathing map and will refuse to just go under it, you have to force it under/onto but once there you can normally move
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
bump... so no one wants to participate in this huh...
Systems like this already exist. Check out my multi floor / two floor system that is in the graveyard.
It's very intuitive and 'works' but it simply fucks up the graphics of your map so nobody with brains will use it.
http://www.thehelper.net/forums/showthread.php/145900-Multi-Floor-System?highlight=floor+system

I don't want to decourage you, but things like that will not work the way you want them. I can tell you by experience.
There are some things you can not overcome and those are wc3 graphic limitations:

fact: you need to use flying units in order to make it work
problem: flying units have turned off collision, so all your units on a different layer than the ground layer will have no collision

fact: flying units have its shadow on the ground, not on your different layer
problem: no solution to this known, except using a model for the shadow, which will look weird, though

fact: You can not rightclick spots on the upper layer if there is no walkable destructable there
problem: no solution to this. If you don't use walkable destructables, you can not fix this. If you do, then units can't walk below them. Even if you use walkable destructables, the shadow will still be on the ground.

fact: You can not block pathing on the upper layer without using air pathing blockers.
problem: Air pathing blockers are bugged up by the wc3 engine. Ground units are affected by them and will sometimes randomly change their move direction for some weird reason.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    Sticking with the desserts for now the latest recipe is Fried Apple Pies - https://www.thehelper.net/threads/recipe-fried-apple-pies.194297/
  • The Helper The Helper:
    Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top