Public Group

# Moving objects in tile-based world

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

## 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 on other sites
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 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

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

##### 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).

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632988
• Total Posts
3009736
• ### Who's Online (See full list)

There are no registered users currently online

×