Devlog #020: Tile collider generator
Left you see the old system which uses a seperate collider for every tile. Right you see the result of the new WIP tile collider generator that generates a single collider for a group of tiles.
With physics issues driving me nuts, I found that colliders that end exactly on borders of other colliders can really mess things up. Having a single big collider for tile groups would solve this issue and also provide a process time boost because not every single tile needs to be checked for collision every frame.
I still needs to test the system thoroughly, but it already works for some simple shapes.
I'll try to explain the inner workings as simply as possible. The algorithm takes a few steps:
1. Organize the tiles of a tile group from top to bottom and left to right.
2. Start at the top left tile and check if (and where) there are adjacent tiles (above, below, left or right)
3. Store the top left point of the first tile as first collider point.
4. Go to the adjacent tile following a clockwise direction (In case of the top left tile this should be the adjacent right tile. If there is no right tile, go to the below tile).
5. Based on the previous tile that was handled and the adjacent tiles of the current new tile, save the correct collider point and move clockwise to the new tile.
6. Loop the previous step until the algorithm ended up at the top left tile again.
All outer collider points should be found this way, and a collider polygon can easily be constructed.
In my case a extension of the algorithm is needed to split the resulting collider in convex subshapes to be able to use the seperating axis theorum for collision detection.
I hope to share some nice crate physics gifs when this is done.
Get Rocket Shipment
Rocket Shipment
A tricky physics based rocketship delivery game with an integrated level editor
Status | In development |
Author | ChocolatePinecone |
Genre | Puzzle |
Tags | 2D, Flight, Level Editor, Minimalist, Physics, Pixel Art, Puzzle-Platformer, Retro, Singleplayer, Space |
Languages | German, English, Spanish; Castilian, Spanish; Latin America, French, Italian, Japanese, Korean, Dutch, Polish, Russian, Turkish, Chinese (Simplified), Chinese (Traditional) |
Accessibility | Configurable controls, Interactive tutorial |
More posts
- CHANGELOG v0.12.1Sep 07, 2023
- CHANGELOG v0.11.1Oct 10, 2022
- CHANGELOG v0.11.0Apr 06, 2022
- CHANGELOG v0.10.0Jan 12, 2022
- CHANGELOG v0.9.1Nov 22, 2021
- CHANGELOG v0.9.0Aug 26, 2021
- Update v0.8.0: Introducing powerupsJun 22, 2021
- Update v0.7.0: Lowering difficultyMar 23, 2021
- Update v0.6.0: Improving player experienceFeb 26, 2021
- Update v0.5.0 featuring new conveyor tilesFeb 05, 2021
Leave a comment
Log in with itch.io to leave a comment.