• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Norman Barrows

Determining steep rise ahead from heightmap

3 posts in this topic

Hi everyone, I'm working on a fps/rpg title, and having a bit of trouble coming up with a set of rules or a combo of methods or tests to determine if there is a steep rise in the height map in front of the player, NPCs, and monsters. the idea is, when checking for collisions, after calculating the unit's new position, if there is a "steep rise ahead" (like a wall or cliff) they stop. at first i was using the usual "well if its less than x feet high they can just step up, otherwise its a wall type collision". but that doesn't quite get the desired effect.

 

the desired effect is this: if its something they can easily surmount (say 3 foot high for a person), go ahead and move them. if the slope is not too steep (say 60 degree incline) go ahead and move them, otherwise, they must enter "climb mode" which allows them to scale sheer cliffs etc (imagine a VR rock climbing simulator).

 

climb mode works great, its the checking of the conditions for  "steep rise ahead" (IE a climbable surface) that's being elusive.

 

the slope check is trivial: delta y / movespeed > 1.3 rads => its too steep, must use climb mode.

 

its the "easily surmounted" part that's tricky. the base walking moverate for a person is 0.3333 d3d units per frame. doing an altitude or slope check at a range of 1 unit or something like the creature's bounding box radius alone doesn't work. while a person may be able to clamber over a three foot rise in 6 inches of forward travel, the single check alone doesn't tell you if that's the top of the rise, and therefore truly a 3 foot obstacle,or merely the bottom 3 feet of a 100 foot cliff. i guess two checks are called for perhaps? one at one foot ahead and one at 2 feet ahead. if the slope to 1 foot ahead is "steep" and the slope from one to two foot ahead is not, then the altitude at 1 foot is the top of the rise (or close enough to it for government work).

 

most games i've seen simply limit forward travel based on the slope alone, leading to things like trucks that can drive up walls (EVO 4x4 2.0), or being able to walk across the face of a sheer cliff (Oblivion).

 

 

 

 

0

Share this post


Link to post
Share on other sites

I have done something similar by casting ray vertically down one step ahead of player. You record where will the ray hit ground and what will be the inclination.

Now if the dH (difference of heights) at hitpoint is less than vertical step limit AND the inclination there is small (i.e. not steep) go ahead and move.

If the dH is bigger than vertical step you have hit steep rise.

If the dH is smaller but the inclination is high you have potential steep rise and have to test two steps ahead.

0

Share this post


Link to post
Share on other sites

you could also consider using a lower res heightmap for movement intelligence like this. first this will have the effect of smoothing details like little crevice that could be easily stepped over in reality but could give you wrong results if you check only some points.

secondly, the presence on the cpu of that texture would help its caching performance; whereas the large one only has to reside on the Gpu, thus not hurting cpu caches.

Then go ahead with hacking, trying to figure out complex flawless algorithms is ... a neverending quest. there are many heightmap collisions algorithms, based on cones, based on dichotomy etc etc.

0

Share this post


Link to post
Share on other sites

If the dH is smaller but the inclination is high you have potential steep rise and have to test two steps ahead.

 

Yes, this is the case it think i was not handling at first. with only a single test, you can't tell the difference between a 2 foot wall and a 100' cliff.

 

you could also consider using a lower res heightmap for movement intelligence like this.

 

the "heighmap" is 100% procedural, using floating point precision for both input and output. so no crevices etc, except where i code them in (or don't code them out). the world is 2500 miles by 2500 miles in size, so bitmaps for height maps isn't really practical, without a lot of during game paging of stuff off disk. The game doesn't do any loading during play at all, just loads the textures, meshes, models, and animations at program start and goes for it. the world map, dungeon levels, etc are 100% procedurally generated. dungeon levels do get loaded during runtime when you re-enter a dungeon you've been in before (IE it saves dungeon maps once it generates them as needed). since the height map is not stored in a bitmap, there are no issues about memory pool etc. 

 

 

yesterday i fired up the game to get back to work on this issue. started by testing what i'd done the night before. Low and behold, now it was working! Checked the code, sure enough, last thing i tried was testing two spots not just one step ahead. in the end i didn't even use slopes, just direct comparison of y values. So far it seems to handle all cases correctly. cross fingers, flog the heck out of it in testing, and wait and see.

 

this led to a solution to a related problem: making you bounce off cliff faces when you slip and fall in climb mode.  check y in each of 4 cardinal directions at a range of 1 foot.

if any is more than 1 foot below the y where the player hits the cliff face, its at least a 45 degree  slope down, therefore not the bottom (or a level enough surface to land on). whichever y is lowest is the steepest downward slope. move the player 1 foot  in that direction (bounce off the wall), and do NOT exit falling state.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0