Kainga
  • Home
  • Devlog
  • FAQ
  • Contact
  • Newsletter
  • Presskit

​

Ladders and Elevation

6/1/2018

1 Comment

 
I knew from the start I would have elevation be a big part of this game. I knew slopes would be tricky so I decided early on that there would be sharp elevation increases and decreases.
Picture
But how would units traverse these cliffs and get to higher ground if necessary? I started out with the simple solution, that you could build stairs. But the result was both inelegant and didn't fit the theme. The next natural choice was ladders. I created a simple ladder model and got to work on the functionality. 

I wanted ladder climbing to not be a task. The easiest way to create ladder functionality is, with a unit selected, you click on a ladder, he goes and climbs it. But I didn't want that. The functionality I'm looking for is, with a unit selected, you click on a higher elevation, he finds a ladder on his own, climbs it, and carries on.
This is what I came up with:
Picture
Basically what's going on is: there's a check to see if the desired destination (the yellow vector) is not reachable from the unit's current location. If it is, go ahead and walk to the destination. Otherwise, do the "Get Ladder" function. In that function, it searches to see if there are any ladders that are reachable from  the destination, if so, get the nearest one, and move to it. Once at the ladder, the "Climb Ladder" function gets called and the unit floats to the top (or bottom) of the ladder, a delay is placed for the time that it takes the unit to climb the ladder (1.3 seconds) then the unit carries on to the desired destination. 

I hope that makes sense. Otherwise, don't worry about it! It works great. I even have it working for houses with ladders at their entrance. ​
Picture
It works well enough for me now, but there are a few downsides I've found. First, this only works for one level of elevation change. If there are two ladders in a row to get to a destination, it won't work, yet... Second, the "Climb Ladder" function is called inside each individual unit, so more than one unit can climb up and down the ladder at the same time. I feel like I'm clogging the units up with functionality. Third, the entire function has to run any time a unit is told to move anywhere, which may be a problem down the line. And yes, I know the characters "run" up and down the ladder, but I kinda like it, and I'm keeping it that way.
​
Hopefully I can use this same system to get units to traverse small bodies of water using available boats. All in all, I'm pretty happy with how it turned out!
Picture
1 Comment
Cpt.Trips
6/7/2018 04:53:45 pm

For ladders you should look into Nav Links.

Reply



Leave a Reply.

    Erik Rempen

    I create, design and develop video games I'm interested in playing.

    Archives:​
    Missions
    Production Buildings
    Making Wakes
    The Beastmaster
    Basic Units
    Basic Resources
    The Fire System
    Presentation
    Re-Imagined
    ​Creating Water
    ​
    Cliffside Stairs
    Watchtowers
    ​
    Melee and Ranged Units
    Unit Organization
    Farming
    ​Carrying Ladders
    ​Weather and "Seasons"
    Technology
    ​Ladders and Elevation
    landmasses
    Structure Design
    Animating 2D units in a 3D world
    ​Setting the Theme
    Setting the Focus
Proudly powered by Weebly
  • Home
  • Devlog
  • FAQ
  • Contact
  • Newsletter
  • Presskit