# I have this collision detection concept I want to discuss

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

## Recommended Posts

My game is an isometric game with an isometric view. coming up with the logic for collIsion detection hasn't been easy but I have a concept. I wanna discuss how reasonsable the concept is before I attempt it and waste time. I've stumbled on the execution of step 3.

What I planned to have are special functions that handle the relation between the floorpad and wall objects for each  level. The function would be call levelone_collision() and would call the other function to do it job. Here is a rough sketch of my concept as well as some philosophy code I thought of.

//Checks collision detection between floorpad and landpad
{
//Check the collision. Return true if collision happens
}

//Uses function 1 to determine collision between character and wall object
{
//a variable declared in this function
bool interaction;

//call the first function
if (Function 1 (floorpad, landpad) = true)
{
//if interaction = false the function return false
interaction = true;
}

if (interaction = true)
{
//check collision between character and wall object
}

else
{
return false;
}

}

//This function detriment the collision of a single level
{

for (int a = 0; a < 5: a++)
{
//call function 2
if (function 2 (floorpad[1], landpad, character, wallobject[a]) == true)
{
//When this function return true the correct force is applied to push the character back
return true;
}
}

for (int b = 6; b < 10; b++)
{
if (function 2 (floorpad[2], landpad, character, wallobject[b]) == true )
{
return true;
}
}
}



?

?

##### Share on other sites

I'm struggling to follow, but seems like you want to spatially partition your wall objects using a grid, then broadphase using the floor grid to get a list of local wall objects to then test against. This is a perfectly good approach. That N game that was popular for a while did something similar:

http://www.metanetsoftware.com/technique/tutorialB.html

Depending on your level layout, there may be better approaches for spatial partitioning. Also bear in mind the added complexity of spatial partitioning may actually outweigh just brute-force AABB checking the player against each wall. I've abandoned whole spatial systems in small levels because it turned out to be unnecessary.

##### Share on other sites

No, this is not the goal of my concept. If my concept was misread this badly I need to seriously reword everything. My game is isometric. Most isometric games do not allow characters to jump. What I want to do is allow my characters to jump, and climb up objects within the game. I was trying to come up with a logic to allow this work. This picture below is a good example of how the character would travel through a level. This is isometric.

I feel like whatever I say no one will understand. There is literally nothing else like this that has been attempted or if it has it isn't very well know.

##### Share on other sites

I feel like whatever I say no one will understand. There is literally nothing else like this that has been attempted or if it has it isn't very well know.

Well, sorry, I have no idea what you mean and if you can't find a way to express it better, its hard to discuss it. Maybe others more familiar with the isometric domain can make better sense of this.

I would say though that given that the isometric part really only applies to rendering (and translating mouse input back to world positions) and you need a 3D representation of your world to allow the behaviour you are asking for, I'm not really sure what difference it being an isometric view makes to the mechanics of collision detection.

The collision detection wouldn't be a problem if I didn't have this z variable. The z variable is the characters height in comparison to the landpad which has which has 2 variable named x and y. Anyways I don't think anyone would help now, the general rule for programming places like this is if it  isn't clear and to the point by the first post it's ignored so I guess I'll just go solo now until I really made sure the concept is perfect.

##### Share on other sites

Yeah your landpad, floorpad, etc are very confusing to follow.

Are your levels largely static? A lot of iso games will create another texture map of the level defining the walkable paths - whether this is a feasible solution depends on if you are rendering a 3d world from a certain view (and if this view is changeable) or if you are using static textures for your levels, or if you are doing a tile based game.

Isometric tile based (that use 2d sprites etc) benefit from a grid system - you can then predefine different height levels for the grid. IE allow 16 different elevations which would create a grid that is the level's width by height by 16 tall. You then put all of your game objects in one of the grid spaces, and you draw them in an order that gives isometric appearance (usually start at bottom layer at upper right corner and finish on top layer at lower left corner). In this type of grid system you can give each of your objects a height - so that a tree that is 10 layers tall, for example, will not be overdrawn unless some object is at level 11 or higher.

For collision detection, you check each one of your game's dynamic objects against the tiles that it might occupy on completing the move - if something else occupies those tiles then the check fails. Usually you don't have too many dynamic objects (characters, enemies) and so this check is not very expensive.

In any case, isometric with elevation has definitely been done before - just google and you can find lots of different implementations.

##### Share on other sites

I feel like whatever I say no one will understand. There is literally nothing else like this that has been attempted or if it has it isn't very well know.

This is the first game that comes to mind:

I am sure there are some old Nintendo games that are isometric with jumping... I remember something with snakes...

I also agree with Servant of the Lord: drawing your game isometrically doesn't mean that the internal logic would be any different from anything else in 3D. Your problem, whatever it is, has been solved before, at least dozens of times.

##### Share on other sites

I am sure there are some old Nintendo games that are isometric with jumping...

Solstice for NES had fairly complex isometric jumping puzzles.

##### Share on other sites

Regarding collision detection for jumping in 3D environments with isometric graphics, it's true that the data structures and algorithms need to be able to represent a 3D environment, but it can be highly simplified. Typically, you might have a 3D grid of blocks that is completely analogous to a 2D grid of tiles; very sophisticated environments might add sloped block faces (like e.g. in Marble Madness).

The environment can be even simpler in some cases: for example if there are no overhanging platforms you can store one floor height at each x,y position with implicit blocks (a stack beginning at the minimum possible height).

On the other hand, some representation are constrained but as difficult to process as general 3D geometry and more complicated. For example, sparse lists of axis-aligned horizontal or vertical walls, even if the walls are rectangular, require general geometric search (what walls intersect a certain volume, what is the closest wall to an object, etc.) rather than simply looking up a few relevant grid cells..

Whatever you mean by floor pads and land pads, I assume they are horizontal or vertical faces of the map blocks or horizontal or vertical faces of the collision shape of the character, or portions of such faces. Can you give explicit definitions?

With grid-based movement all collision detection algorithms are similar to 2D ones, usually simply projected onto the axis-aligned plane that contains the movement velocity. (Example: the 3D movement in Q*bert is equivalent to climbing a 2D staircase, with a choice of intersecting x-aligned or y-aligned staircases at each step)