Exhaust, racing/plattform/physics game

Hello everyone!

Here is a link to a trailer of my new XNA game "Exhaust".

Hope you will find it interesting.

The game is nearly finnished and we only have to do a couple of more levels and then we will publish the game.

http://www.youtube.com/watch?v=Yk8kE8SfRzs

(The quality isn´t very good but I hope you will get an understanding for what the game is all about.)

Special thanks to BorisTheBrave for helping me. (and ofcourse to all you others that helped me)
The game is never over. You can get better and better times at each level.

It is not possible to die, this is becouse we wanted the game to be a racing game and not to slow.

The game is for Xbox 360 and is going to be released really soon.
1)how you did shockers part...basically for motor there are 3 parts..leftWheel, rightWheel And Body...........is there anyother thing you added....or shocker is just because of body part movement..



2)what abt that concave shape...i am not able to make that shape


3) my 360 degree movement is not as smooth as yours...
i am using

body1.SetAngularVelocity(ang1);
where
if (Dir=="right") {
ang1+=.2

;
}
if (Dir=="left") {
ang1-=.2

;
}

///////// but this is not that smooth

Can you explain these points
Thanks
Hello Saturba,

English is not my native language so I am not entirely sure what you were asking but I will try to answear what I think you were asking 🙂

I have no idea what "shocker" or "shockers" meen in this context (I tried to look it up but it doesn´t make any sense to me) but if I am correct you are asking how I built the car (?)

The car has three bodies: The Right wheel, left wheel and the body. Each wheel are connected to the body using three joints. The distance joint to make for a nice suspension, the prismatic joint to keep the wheels in place and a revolute joint so the wheels can spin.
Now if you know Box2d you will know the prismatic joint prevents any relative rotation and this is solved by adding two other bodys for each wheel that you will connect the prismatic and the distance joint to and then connect that part to a revolute joint that is connected to the wheel.
Now again, if you know Box2d or just try what I said, you will notice that the revolute joint quickly becomes unstable when large forces is put on to it so each frame I have to place the wheels on the same position as the helperbody I was just explaining.


Now for concave shapes: All bodys with concave shapes are constucted from many convex shapes (obviesly). This is done by a tesselation algorithm. Here it is in pseode code: Basicly you just have a list with all the vertieces in clockwise order:

Code:
Array<Vector2> OriginalPolygon
/*
This is the Array of Vertices, specified in clockwise order, that specifies a polygon.
This is the original polygon that may be concave and/or have more Vertices than 8 (the maximum alowed number of vertices per shape in Box2d
*/
Array<Array<Vector2> > ReturnPolygon
/*
This is the polygon splitted into a number of convex polygons that the function will return.
*/

int Index = 0; // Start at the first Vertex
while(OriginalPolygon consists of more than 2 vertices AND // As long as the OriginalPolygon consists of more than 2 vertices there will be more polygons to add to ReturnPolygon
   Index < OriginalPolygons size) // If Index becomes larger than the OriginalPolygons size the function has failed (this means probably that you have specified the Vertices is CCW order or that The polygons lines may be overlapping each other)
{
   Array<Vector2> TempPolygon // A temporary polygon we will fill with vertices and maybe add this array to the ReturnPolygon
   int TempIndex = Index;

   /*
   Add the first three Vertices from Original Polygon
   */
   TempPolygon.AddVertex(OriginalPolygon[TempIndex ]);
   TempIndex++;
   TempPolygon.AddVertex(OriginalPolygon[TempIndex]);
   TempIndex++;
   TempPolygon.AddVertex(OriginalPolygon[TempIndex ]);
   TempIndex++;

   if(TempPolygon is Convex AND TempPolygons Vertices is specified in CW order AND TempPolygon doesn´t contain any of the OriginalPolygons vertices)
   {
      foreach more Vertex in OriginalPolygon do
      {
         if(TempPolygons size < 8) // maximum number of vertices per shape in Box2d
            break;
         else
         {
            Add Vertex to TempPolygon;
            if((TempPolygon is Convex AND TempPolygons Vertices is specified in CW order AND TempPolygon doesn´t contain any of the OriginalPolygons vertices) == FALSE)
            {
               Remove Vertex From TempPolygon;
               break;
            }
         }
      }
      Add TempPolygon to ReturnPolygon;   
     
      Keep TempPolygons first and last Vertex but remove all the rest from Original Polygon;
      Index = 0;
   }
   else
   {
      Index++; //The TempPolygon was invalid so we trie with the next vertices
   }
}


360 degree movement:

Use "ApplyTorque" instead.
in your car image..could you explain which one is body part and which one is that physical object which is not colliding..so that i can understand better...
Thanks..

i have uploaded my car image also...without shockers..
your game is looking pretty fun!
will there be a pc version?

shockers = suspension (short for shock absorbers)

you could implement the suspension more easily using a b2LineJoint, you define the axis relative to the parent body and it allows rotation of its child

Code:
b2LineJointDef ljd;
ljd.Initialize(body, wheel, wheel->GetWorldCenter(), b2Vec2(0.0f, -1.0f));
ljd.enableLimit = true;
ljd.upperLimit = maxdistance;
ljd.lowerLimit = 0.0f;
ljd.enableMotor = true; // use motor for a spring
ljd.maxMotorForce = 9.0f; // experiment with different forces to get the spring motion right
ljd.motorSpeed = 1.0f; // this will push the wheel out to the upper limit unless something is putting more force on it
b2LineJoint *suspensionJoint = (b2LineJoint*)world->CreateJoint(&ljd);
thesleepless wrote:
your game is looking pretty fun!
will there be a pc version?

shockers = suspension (short for shock absorbers)

you could implement the suspension more easily using a b2LineJoint, you define the axis relative to the parent body and it allows rotation of its child


Well, I don´t know yet if there will be a pc version.

Thank you for the "shockers" definition 🙂

Yes the line joint does seem very much easily. I don´t think it was implemented in the Box2DX when I started my project and thus I haven´t used it.
@VonXorzist:

Do u use Flash or C++ ?
If C++, which "drawing" Engine do u use, 'cause i see they is light ! 😀
And the light is applied to the car, looks very nice ! great job.
Box2DX is C#.net. I assume he/she is using DirectX for the rendering.
b2LineJoint is not there.
i have b2Joint i am using box2das3(flash) 🙁

Original thread: https://box2d.org/forum/viewtopic.php?t=1921