2
\$\begingroup\$

This question is an addition to both of these questions:

While I get the idea that you can just have multiple independant "layers" of your grid for each unit type. I'm curios as to how this works out in an action game where a player controls a character that can jump (or even crouch). So let's say I want to have the following kind of things:

  • Bridges or other places that a player can walk over or under.

  • Slopes that allow a player to move up or down without jumping

  • Crates, walls or even little differences in hight that a player should be able to jump onto or down.

  • Tall walles or cliffs that a player should not be able to jump down or up but walk on top of them if he finds another way to get up/down.

  • Pseudo-free-movement. A player can walk freely on the tiles while movement is still limited by the tile grid.

So slopes and crates are identical in a way that they allow a player to traverse from one layer to another one.

I'm not sure if this can even be achieved with a simple 2D approach, so maybe I'm better off with a full 3D engine? I liked the idea of a simple 2D engine but I don't want to make it more complicated if a a 3D engine is the right call here.

I'm also having a hard time finding any descriptions or papers that deal with these things.

\$\endgroup\$
2
\$\begingroup\$

Add a logical third dimension and add logic to tiles by type. So a horizontal bridge will allow you to pass from left to right on Z = 1 and from top to bottom on Z = 0.(like flow bridges game) Now change the Z when walking up or down a hill. Allow jumping 1 unit high.

That's about it.

edit: here is an example tutorial-

http://rpgmaker.net/tutorials/163/

\$\endgroup\$
  • 1
    \$\begingroup\$ Yes, add a logical 3rd axis even when graphically rendering a 2D tileset. I'm surprised this answer got downvoted, people really don't like simple answers. \$\endgroup\$ – Stephane Hockenhull Dec 30 '14 at 21:24
  • \$\begingroup\$ @StephaneHockenhull Really? You read the question and came to the conclusion that the answer solves the proposed problem? OP wants to be able to crouch, jump, and differentiate between cliffs, slopes, and overhangs. This creates a multitude of edge cases and would require knowing many more properties than just throwing a height onto each tile. The answer is simple because it doesn't address 80% of the question. \$\endgroup\$ – ClassicThunder Dec 30 '14 at 21:38
  • \$\begingroup\$ Yes it does. Erez's answer "Add a logical third dimension and add logic to tiles by type." solves the problem. If the player needs to be crouching to enter a tile just add that logic to the tile type. \$\endgroup\$ – Stephane Hockenhull Dec 30 '14 at 21:51
  • \$\begingroup\$ @StephaneHockenhull So you're saying the words, "Add a logical third dimension and add logic to tiles by type." and not addressing how to do so is a good answer? It isn't, its a terrible answer. Also the very little bit of implementation advice it offers is wrong, it can't tell the difference between a cliff and slope. \$\endgroup\$ – ClassicThunder Dec 30 '14 at 22:00
  • 3
    \$\begingroup\$ While i quite agree with you, @StephaneHockenhull, i'd like to say again this point, that only people that understands this answer in a snap will benefit from it : while i belong to those peoples, i'd think useful, in a 'wiki' way, to go into further details. (Maybe that comment would apply to my post... ??? :-) ). Regards. \$\endgroup\$ – GameAlchemist Dec 30 '14 at 22:40
3
\$\begingroup\$

Going 3D when the game is basically a 2D game seems like an overkill.
In your place, i'd rather use a 2D engine that handles already tiles and slopes, and just use a few tricks for the parts where a '3D' effect is required.

Just a small example, a bridge :

So for the player, that would look like :

enter image description here

Now you can add some invisible trigger zones that will make this part of your map behave like a bridge you can go under.

imagine the yellow trigger means : change the character state so that it is drawn before the bridge and collides with red zones.
And the green trigger means : switch back to normal state where the character is drawn after the bridge and collides with yellow zones.

with such a scheme you'll have a bridge :

enter image description here

I made up this example quickly : i don't claim that the above scheme work fine in all situations, and if the 'z' is a key aspect of the game you'll have to dig further, but i just want to emphasize that for localized effects some small tricks can allow you to have 100% of your features with far less work than a complete re-design.

In other words : Having a physically accurate model of your world is just one way to get your game to behave as you want. If some tricks can get you faster to the point with simpler code, just remind yourself that gamers do not see your code, just how it behaves.

\$\endgroup\$
  • \$\begingroup\$ I like the idead of that approach since it's very simple but it isn't feasible for me since I'm going to make heavy use of different kinds of such objects. \$\endgroup\$ – Chris Jan 1 '15 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.