I have this collision detection concept I want to discuss

Started by
10 comments, last by LorenzoGatti 9 years, 8 months ago

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
Function 1 (floorpad, landpad)
{
	//Check the collision. Return true if collision happens
}

//Uses function 1 to determine collision between character and wall object
Function 2 (floorpad, landpad, character, wallobject)
{
	//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
function 3 (floorpad, landpad, character, wallobject)
{
		

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;
	}
}
}

?

?

concept_zpsf6faa9f0.png

Advertisement

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.

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.

071d.gif


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.


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.

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.


The problem is that your posts use terms and diagrams that ONLY YOU are familiar with. We can't tell what you mean by "floorpad", "landpad" or what your diagrams are supposed to represent. These are terms that you came up with, so don't expect any of us to automatically know what you mean by them.

If you don't use words that people understand, or define them in terms of what people understand, we won't know what you're talking about.

- What is a floorpad?
- What is a landpad?
- What do you mean by "wall object"?
- Is your map grid-based?
- Are your wall objects aligned to anything?
- Is your character movement aligned to tiles?

Just because your graphics are rotated 45 degrees doesn't mean your collision and movement logic has to be. Maybe you could separate the behind the scenes logic from the isometric display, and then collision would become axis-aligned bounding boxes with varying heights. Why not even use a 3D collision library behind the scenes of your 2D isometric graphics? The logic and appearance don't have to be so tightly intertwined.

Also, just because your use may be unique, you might actually find that the code behind it is common-place and well-known. It may be that the most common code snippet of all time is what you need, but sometimes it's hard to realize that you have to use the code in an uncommon way.

Sometimes I write code and don't realize that while the actual text of my code is unique, the logic it is doing could've been solved by well known algorithms that I've never heard the names of.

To put it another way, sometimes the desire to believe you have invented something useful can blind you to a simpler solution.

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.


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:

http://en.wikipedia.org/wiki/Little_Big_Adventure

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

http://en.wikipedia.org/wiki/Snake_Rattle_'n'_Roll

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.

This topic is closed to new replies.

Advertisement