Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   Suggestion Box (http://www.alice.org/community/forumdisplay.php?f=26)
-   -   Collision Detection (http://www.alice.org/community/showthread.php?t=5998)

Mr Kidnapper 11-14-2011 07:37 PM

Well object distance is based purely on pivot point and only involves points in a 1:1 scale.
But lets insert numbers into the equation. An average model has four vertices per polygon. All, if not most, of these vertices are reused (And can be reused practically infinitesimally) so let's say each polygon (Quad) creates one vertex and reuses three other vertices. Let's also say I'm jumping the usual average margin, and our world contains 100,000 polys. That's still somewhere near 100,000 vertices. Let's say our collision check is simple; it searches for the distance of polys, derived by finding the geometric center of each vertex associated with the poly (X,Y,Z) and compares them with the direction they are considered facing, also described by XYZ. If the distance between them is negative, then they collide.
This could take, what? Four calculations per poly? Now lets assume this calculation is done twenty-four times per second, because "smooth" human framerate is considered 24 frames per second. 9,600,000 calculations. From a quick google, you may read that the uber slow Pentium D Processor does 2.3 billion calculations per second. Constantly calculating collisions for 100,000 polys doesn't sound like much. Technically it [I]is[/I], but let's ignore that.

At any rate, I have an idea for improvement. There is no game engine in the world that [I]seriously[/I] checks collision for every poly in an object, since scenes tend to reach millions of polys fairly easily. They use simple shapes between six (boxes) and ~500 polys (Helicopter) for any given object. They call these simple shapes a "Proxy" object, and they are named that, and they do the calculations on these proxy objects.

So the idea is: Add a true/false box in the Seldom Used Properties list that reads "Is Proxy." 3D Modelers will make a subobject hierarchy that includes the proxy objects, and when the box reads "True", collisions will be calculated for that object.
Why use a property box? Because going into the Alice Object Gallery that seldom exceed several hundred polys and adding twenty more for a proxy is pointless. Only someone who is [I]seriously[/I] inclined to add collision will go through the extra steps to add a proxy to reduce lag.

Edit: The serious problem with collision lies in what you're going to do with it. In game engines, a lot of power is consumed calculating physics from collision. So, you're going to have a simple IsColliding function? There's nothing wrong with this if you want to make an object absolutely stop upon impact. The problem is, physics needs more information. Magnitude and speed and whatnot. You can get this from the object itself but the object needs to be about as complex as a sphere.

Dameria 11-14-2011 08:53 PM

I think simple box collision is the best way to do it in Alice... no need to get complicated and use Battlefield 3 type collision detection where you can walk on every polygon. I mean, even the Call of Duty games still use box collision for most objects (except slopes).

Mr Kidnapper 11-14-2011 09:02 PM

Call of Duty was never known for its graphics.

Dameria 11-14-2011 09:15 PM

[QUOTE=Mr Kidnapper;43489]Call of Duty was never known for its graphics.[/QUOTE]

*Facepalm*

Collision detection has absolutely nothing to do with graphics

Mr Kidnapper 11-15-2011 10:58 AM

Oh sure it does. Collision detection is based on polys. While the polys remain unseen, it doesn't mean it doesn't have great impact on graphics or gameplay.

Dameria 11-15-2011 02:38 PM

Unseen polys are not graphics. Graphics are the art of the game; the actual functionality lies in the code. I know what your saying though, I just wanted to make clear that CoD's graphics don't have to do with its collisions. In another game like BF3 though, the graphics might have to do more with collisions, but even there its really two very different things.

drellem 06-24-2012 10:04 AM

I completely agree that collision detection should be built into Alice. However, with many objects, things could get unnecessarily laggy. I think that Alice objects should have an isCollisionOn property. This way not every single on of the twenty trees in your game don't have to check for collision every time.


All times are GMT -5. The time now is 06:21 PM.

Copyright ©2021, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.