flare icon indicating copy to clipboard operation
flare copied to clipboard

Move collision info from map making to tile set defintions

Open clintbellanger opened this issue 12 years ago • 4 comments

Currently map makers have to define their own collision info (mark which tiles are blocking).

It will be much nicer if this information is in the tile set instead, automatically connected to each tile.

Tricky bits:

  • Secret passages would be harder to do. Not a big deal to me, I think secret passages should be handled with actual art instead.
  • Pits could need a special marking tile. These are grid spaces that aren't drawn, but still allow flying/missiles.
  • Oversized tiles might affect collision info on several grid spaces. This might need to be some kind of special struct inside a tile set def file.
  • The engine will still use a boolean 2D collision array. This will be built on map load based on the tiles. Will have to examine both the background and object tile on one grid space to determine the actual collision on that position.

There are several corner cases at work, so please discuss before attempting this change.

clintbellanger avatar Apr 20 '12 16:04 clintbellanger

Also see related discussion on Issue #355

clintbellanger avatar May 23 '12 11:05 clintbellanger

Look at the wood cabins as example here. They take up a 2x3 tile area, but we only bother with 4 tiles sliced into vertical pieces.

The two back-most empty tiles are "part" of the cabin and should be solid.

I'm not sure how to handle this besides still having an explicit "blocking tile" object that can be placed on maps. In this case, would it be drawn in Tiled on the object layer? Then it wouldn't even be visible in that interface, as the taller tiles in front of it are covering it.

Explicitly drawing collision info is tedious, yes, but it does work. Hm.

clintbellanger avatar Jun 21 '12 13:06 clintbellanger

Well, do we need that? Even Tiled uses current behavior, and maps will be written in Tiled too.

igorko avatar Aug 03 '12 10:08 igorko

Well, this feature isn't strictly necessary. The thought is that having collision built into tiles makes mapmaking easier and reduces map errors.

But this isn't a high priority because I don't see an elegant way to implement this, especially for oversized tiles. The new tile drawing algorithm allows us to easily have large square tiles (e.g. 4x4 tile area) instead of always slicing those larger tiles.

clintbellanger avatar Aug 03 '12 11:08 clintbellanger