Diddy + Tiled TileMap collision

Monkey Forums/Monkey Programming/Diddy + Tiled TileMap collision

Mikau Schekzen(Posted 2012) [#1]
Howdy!

I see that Diddy has nice functionality to load and render maps made in Tiled, but I don't see a single method dealing with the collisions of the map. Am I not seeing something, or that not implemented (yet)?

In the second case, what would be my best course of action to implement TileMap collisions?


Yes, as you can probably tell, I'm just starting with Monkey(have quite some experience with Game Maker, but that doesn't help me at all with collisions).


-Mikau


slenkar(Posted 2012) [#2]
You have to say what type of game you are making to get more help


i saw this in the other forum section for a platform game:
http://monkeycoder.co.nz/Community/posts.php?topic=3036

If you are making an overhead game it should be easy, when the player tries to move right

x=x+1

and they are going to hit an unpassable square just do the opposite
x=x-1
and it will look like they are staying still.

Sliding collisions are difficult, where the player slides on an unpassable square.


Samah(Posted 2012) [#3]
The Tiled loader/renderer is meant to faithfully render maps made in Tiled, and nothing else. Since Tiled maps do not contain "collision" information, neither does the Diddy tile engine.

What you can do is create a layer in your map in Tiled called "collision" or similar, then just draw in the cells you want to be blocked (just a simple coloured tile should do). You'll have to manually put the collision code in yourself though.

I started work on a DAME loader which would handle sprites, collisions and paths. If you're lucky I might finish it... pretty busy at the moment though.


Mikau Schekzen(Posted 2012) [#4]
Hee hee, thanks for the answers. I've already read most of what you two just told me, however.

In Game Maker, functions for collision detection was given to me, and since Monkey does not come with any collision detection functionality(as far as I could see), that is my biggest problem: getting collision detection in the first place :P

Samah, I already thought about what you just said in that I would have a seperate layer with the collision mask, just like how it worked in the Jazz Jackrabbit 2 level editor. However, I wouldn't know what library I should use for that. And making a collision library myself would be a bit too advanced. That's a project for later, perhaps, especially since there are already quite some libraries out there for it.

I also read that you were working on functionality for DAME this afternoon, and I must say, that looks like an interesting editor. I hope you can get it done, but it's best I don't rely on it, I suppose.


Anyway, sorry about the drag, but could someone recommend an efficient way to deal with collisions vs. tiles? Wouldn't want the game to become too slow, even though this is just a practice project. Also, in case the type of game I'm working on should matter, it's a platform game.


AdamRedwoods(Posted 2012) [#5]
surprised diddy.tile doesn't have collisions.
Here's something simple I made for Diddy's tile collision:

http://monkeycoder.co.nz/Community/posts.php?topic=3093


Mikau Schekzen(Posted 2012) [#6]
Heheh, many thanks, that seemed to work. Unfortunately, slopes are still counted as square blocks for the sake of collision detection, but I really shouldn't complain.

Any ideas on how I can/should fix that, though?


AdamRedwoods(Posted 2012) [#7]
I think slopes require the polygon type of collision layer, so it'd no longer be tile based.


matt(Posted 2012) [#8]
What type of slopes do you have Mikau?

You're going to need to mark them as slopes, or be able to tell they are slopes using your map data.

The answer on this page is the neatest way of doing it.
http://gamedev.stackexchange.com/questions/17922/how-to-make-a-platformer-character-go-down-a-315-degree-slope