Ive played games like terraria, minecraft and worms world party, all great games, but how do they do their collision detection? I mean, trying to 'test' an entity or object against 10000 blocks in a loop is bound to be slow, so how do they get around that?
Do they use a compression algorithm, so it detect which blocks it will collide with?
I'm trying to develop a tile-based game myself, however this is one of the stumbling blocks I will come across.
In a tile based game you can use the position and size of the object to calculate the tiles that the object overlap. If a tile is solid you have a collision.
To handle collision between objects you can let each tile store a list of objects located on that tile. So to check if an object collides with other objects you just do collision detection against all the objects in the lists of the tiles that the object overlap.
There are also other collision detection algorithms like sweep and prune that can be used and works also for non-tile based games.