Jump to content

  • Log In with Google      Sign In   
  • Create Account


I have this collision detection concept I want to discuss

  • You cannot reply to this topic
11 replies to this topic

#1 LAURENT*   Members   -  Reputation: 210

Like
0Likes
Like

Posted 14 August 2014 - 07:44 PM

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



Sponsor:

#2 Aardvajk   Crossbones+   -  Reputation: 5950

Like
0Likes
Like

Posted 15 August 2014 - 01:16 AM

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.



#3 LAURENT*   Members   -  Reputation: 210

Like
0Likes
Like

Posted 15 August 2014 - 08:05 PM

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



#4 Aardvajk   Crossbones+   -  Reputation: 5950

Like
6Likes
Like

Posted 16 August 2014 - 02:18 AM


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.



#5 LAURENT*   Members   -  Reputation: 210

Like
0Likes
Like

Posted 16 August 2014 - 12:35 PM

 


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. 



#6 Nypyren   Crossbones+   -  Reputation: 4180

Like
6Likes
Like

Posted 16 August 2014 - 02:48 PM

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?

Edited by Nypyren, 16 August 2014 - 02:56 PM.


#7 Servant of the Lord   Crossbones+   -  Reputation: 18498

Like
8Likes
Like

Posted 16 August 2014 - 05:36 PM

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.


Edited by Servant of the Lord, 16 August 2014 - 05:36 PM.

It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]


#8 Aardvajk   Crossbones+   -  Reputation: 5950

Like
7Likes
Like

Posted 17 August 2014 - 12:29 AM

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



#9 EarthBanana   Members   -  Reputation: 876

Like
0Likes
Like

Posted 18 August 2014 - 11:50 AM

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.



#10 Pink Horror   Members   -  Reputation: 1148

Like
0Likes
Like

Posted 25 August 2014 - 01:41 PM


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.



#11 Nypyren   Crossbones+   -  Reputation: 4180

Like
0Likes
Like

Posted 25 August 2014 - 04:04 PM

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


Solstice for NES had fairly complex isometric jumping puzzles.

#12 LorenzoGatti   Crossbones+   -  Reputation: 2663

Like
0Likes
Like

Posted 26 August 2014 - 02:05 AM

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)


Produci, consuma, crepa





PARTNERS