Jump to content
  • Advertisement
Sign in to follow this  
suliman

Moving objects in tile-based world

This topic is 3470 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Im planning a rpg in a tilebased world. Ive done some pathfinding in tiles where each unit is always standing in exactely one tile. But in this game you can move "fluidly", like nudging (remember the map on old zelda games for example, or moing in "a link to the past") so you are between tiles. My problem is, how to restrict units and other objects to get into a tile that is non-walkable? I cannot do collision-check with each object against all surrounding tiles right? That would be slow. Is there a better method? Thanks a lot Erik

Share this post


Link to post
Share on other sites
Advertisement
If non-walkable regions are always the entire size of a tile, then performing simple collision checking should work. The key is to use techniques that can quickly rule out whether or not collision checking is needed between certain objects given the current state.

I don't have time to elaborate right now, but one technique I've played with before are quad-trees, which can quickly identify if collision checking between objects is necessary. Try a search for those. There are other methods too, and I'm sure someone will post something. :-)

Hope this helps. Good luck.

EDIT: Actually, the regions don't have to be rectangular or anything. It just simplifies things when you actually determine that a collision check is necessary.

Share this post


Link to post
Share on other sites
the tiles can be rectanglurar that no problem. I can check odd-objects (for example round) with some special routine (they are few).

But in very old games like A link to the past for super nintendo
http://wiimedia.ign.com/wii/image/article/782/782613/virtual-console-au-buyers-guide-part-4-20070423084933753.jpg

they manage quite fine. You guys think they do collision checks with all closeby tiles in such games?

Share this post


Link to post
Share on other sites
Don't underestimate todays computers. If an object is moving you can check all the tiles it is going to cover, which amounts to maybe 5 or 6. That's nothing. The computers back then could handle that already.

You can cut the number of checks down if you only check the tiles you are about the enter exactly when you are entering them. Once you are in between tile borders you can always move (since you did check the tiles below already).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!