• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0

[Video Tutorial] Solving the "crack" collision problem (getting stuck between two tiles)

1 post in this topic

Hello gamedev, I made a video tutorial on how to solve a common problem encountered in 2D collision detection and resolution.
The issue often happens when your physical bodies live in tile-based environments. Sometimes the order in which the collisions are resolved is incorrect, and the physical body gets stuck between two tiles.
I've discovered two interesting ways to prevent (and fix) the issue, and I've created a tutorial video:

Video description:

Foreword: this is my first time doing a video tutorial. Please excuse me for any mistake, or if the explanation wasn't clear. I've also had some technical difficulties - my microphone is broken, and my webcam has a very poor quality. I recorded the tutorial (both audio and video) using my iPhone 4S. Unfortunately the quality of the markers I'm using is also poor - they're old and I couldn't find anything better, but I will buy some better markers tomorrow.
You can see an EXPERIMENTAL implementation of the merging method here:https://github.com/SuperV1234/SSVSCollision[3]
Additional information: I've already written an article about collisions. It's outdated, but some concepts can be easier to understand in the article. I talk about spatial hashing and "overlap area" sorting, albeit in a different (and less elegant) way. If you need more info on what I'm talking about in the video, the article would be a good place to start.
When I have time, I'll update the article and put it in my website. (http://http://vittorioromeo.info/[6] )
Please let me know if you need anything explained in the comments - and if you have suggestion on how I could record audio/video in a better way.
Thanks for watching.


Share this post

Link to post
Share on other sites

Well, the solution dosen't really work 99% of the time, because generally, physics engines don't like you to mess with how collisions are handled. Finding the area under the two tiles is easy. but, on messing with the collisions, weird things start to happen.


for example, consider a heavy box that is almost equally placed in between two tiles, but is still closer to one tile. Then, on ignoring the collision with the 2nd tile, the box will start to sink down the tile (as the collision will have been ignored). This will end up in the box sinking and finally dropping down completely. This is one example of the numerous weird artifacts you'll begin to see by messing with collisions.


Other weird things you're likely to see is tunneling, strange collisions, and objects getting stuck in strange ways(even though our original goal was to prevent objects from getting stuck ;) ). You have to be *very careful* when deciding to filter collisions and you'll almost always find some configuration that breaks your filtering rules. 


the second method is quite impossible to use unless you have a custom physics engine (or) you decide to hack the physics engine yourself.to combine / merge two tiles together during run-time, you'll need to remove the original tile  and then re-create two  new tiles and then put the new tile in the correct position.To do this every frame. incurs quite a performance cost.So, basically,  the technique is hard to implement as well as quite slow *UNLESS* you have your own physics engine, which most people have neither the time nor the inclination to build.



what I do is to pre-process the tiles.It's trivial to find the largest continuous, horizontal row of tiles and create that as a separate mega tile.ditto for the vertical tiles. I do this as soon as the level is loaded and BEFORE the tiles are sent to the physics engine. once I finish processing the tiles, I then send the large tile chunks to the physics engine. This eliminates the problem almost entirely. It's a simple solution to a weird and complex problem smile.png


Well, these are just my 2 cents smile.png

Edited by bollµ

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  
Followers 0