Sign in to follow this  
Zorerk

Collision or Tile?

Recommended Posts

Dunno if this should be put in the DirectX/XNA forums or in the beginners forum. But i have a feeling it fits better in the beginner forum. If not your welcome to move my post. ^^ At the moment i have just started on a small project that will revolve around making a total remake of the old Super Mario World game but for the Xbox through using XNA. (Dunno if Nintendo have some kind of copyright to how the gameplay is) Either way. My problem lies at the moment with a decision between 2 ways to implement the same thing. The battle is between a total collison based movement system or using a square/tilebased system. A friend of mine recomended the tile based system as he seems to think its easier to implement. But what do you all say here on Gamedev? It would be nice to hear about the good and bad about each side as it might help me with the chosing the system. If i'm unclear in what i mean then im sorry and will to clarify later as i get off from work.

Share this post


Link to post
Share on other sites
tile based collisions will be easier to implement then object-object based collision. You only have to worry about one collision type, rectangle-rectangle colllisions.

Share this post


Link to post
Share on other sites
You aren't going to be able to avoid using full-on object collision detection. Just because two objects are in the same tile doesn't mean they're touching, after all. You'd have the player getting hit well before he's actually touching the enemy.

That said, you can use tiles as a way to reduce the number of objects you have to worry about (so you don't end up checking to see if the player hit an enemy way at the other end of the course, for example). I prefer to use quadtrees for this myself, but you can use tiles.

For actual collision detection, I'd recommend starting with simple axis-aligned bounding boxes. It's very easy to implement; not very detailed but it does get the job done.

Share this post


Link to post
Share on other sites
Like the previous poster said, you will probably have to implement them both. In my current platformer, the map (basically just all of the static tiles) are implemented as a 2 dimensional array, but ? blocks, enemies, and coins (essentially any oject that interacts with the environment or the player) use bounding box collision.

On an unrelated note, In my opinion, implementing slopes (30,45 60) is more difficult to do in a pure tilebased system, but it can be done. It's just if you haven't done it before, then it will probably be a lot of trial and error before you are happy with it.

EDIT: and related to the remaking a mario game, you can make a platformer that plays similiar, but you can't use any of its Sounds, Music, Graphics, Characters, ect. (especially in a game that you will be selling)

[Edited by - j0mich01 on July 21, 2009 12:04:52 PM]

Share this post


Link to post
Share on other sites
To do collisions with slopes you can do pixel perfect collisions. I was also thinking of a way where it uses pure math but haven't tried that yet.

The pure math way first checks if the bounding boxes intersect. Next it checks if the players or whatever bounding box also intersects the slope of the "slope" object. By slope I mean like slope of a line in a graph from algebra.

Share this post


Link to post
Share on other sites
Quote:
If you're going to deal with sloped terrain tiles, I'd recommend checking out the Separating Axis Theorem, which lets you detect collisions between any two convex polygons.

Thank you for the link. Have given it a quick view for now but will bookmark it later. Hopefully i'll understand most of it.

Quote:
You aren't going to be able to avoid using full-on object collision detection. Just because two objects are in the same tile doesn't mean they're touching, after all. You'd have the player getting hit well before he's actually touching the enemy.

Have given it a thought also that i wont be able to get away from the collision detection. But i dont know if there would be needed more code or it maybe it could been more buggy depending on that that i skip the tiles and instead use a premade picture that works as the map.
In its sense i would be able to shape my whole map just as i want it with tools like Gimp or Photoshop. But is there maybe a major risk then that i would stumble across that the player can get stuck in ground or that the player maybe fall through it?
That does give the tiles probably a major advantage where i can hardcode where im allowed to walk and such. But wouldnt that give me alot of more work to do? (Even though i could always make my own map editor that do all the coding for me.)

Quote:
and related to the remaking a mario game, you can make a platformer that plays similiar, but you can't use any of its Sounds, Music, Graphics, Characters, ect. (especially in a game that you will be selling)

Well im aware of those restrictions. But for now im using sprite sheets from various websites on just mario. That'll change later as i will create some of my own(Have been doing some pixel art in my younger days even those where just modifications on Megaman and Mario).
Though the question is what about the very gameplay. Am i allowed to use a worldmap that uses the same idea as old classic game or do i have to modify so there is maybe additional stuff you can do on the map?

[Edited by - Zorerk on July 25, 2009 10:18:20 AM]

Share this post


Link to post
Share on other sites
Feels a little like my post was forgotten as i had more questions after have gotten a few answers. Dunno what your rules are on bump posts are but i guess this one counts as one. Anyone who can answer the new questions?

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