Tank demo (2008)

Share with us how are you using the powerrrr of the force

Moderator: Alain

Tank demo (2008)

Postby Sascha Willems » Tue Mar 04, 2008 3:16 pm

Some of you may remember my first take at a tracked tank back in 2006 (see the thread over here), back then it already worked basically but I never got it into a state where it would be really usable in a game (or even a simulation).

Image
Download the proof-of-concept DEMO (3,6 MBytes, needs OpenGL)
Important : PLEASE read the included readme.txt before starting the demo and/or complaining in this thread.
Also note, when using a gamepad, it's possible that you need to change the axes for controlling the tracks, you'll have to test that out.
If it won't work for your gamepad, just use the keyboard controls.


3rd video (14th March) showing the almost finished version (WMV format, ~60 MBytes, 5:40 min)
Second video showing functional turret (~11 MBytes, 1:30min)
Download the video (~3 Minutes, 35 MBytes, WMV)

But some days ago I decided to give it another shot (finally got more time to do coding) and now I got a tracked tank that's almost working perfect. As with the old demo I'm still using the contact process callback to simulate an "inverted" conveyor belt material for the tracks, something that's very easy to implement and should allow for dozens of tanks at good framerates. A lot of people try to implement tanks by using dozens of wheels to fake tracks, but that's not always working as supposed and it's very slow.

There was a rather long discussion back in that old thread, so I won't be retelling the whole story here, but the basic things you'll have to take care of are :
  • Use the contact process callback for the tracks (apply material to the tracks only)
  • In that callback, rotate the contact's tangent so that it points along the "floor" of the track (e.g. if you move on the z-axis, rotate it to 0/0/1)
  • Set tangent acceleration, this depends on how you implement it, I calculate it using the tank's velocity along the z-axis and the current accelerator value of the track (this way you can tell how fast each track should move)
  • Important :Model the tracks so that they generate even contacts. The tank from the old demo had a slope on the track's floor, whereas the new one (which I modeled for the game I'm working on currently) has a more flat track floor and therefore contact generation is more even.
  • Important :Get your center of mass right. Sounds very basic, but if you e.g. include a long gun into your compound/convex hull, it's very likely that the COM is offset to the front of the tank and this will make especially rotating very bumpy.Setting the COM is crucial, so take your time to adjust this.
  • Hint :Don't make the tracks rigid. That's what I did in the beginning (and the old demo), as this makes your tank move like it's made out of one block of metal rather than it should be. Right now I'm testing (you can see it in the debug display at the end of the video) with a hinge joint that tilts some degrees forwards and backwards. Not perfect, but very close to a real track in terms of movement. Next step could e.g. be to add a spring to that hinge to make it look more natural. But this is something that you can try out yourselves, maybe a slider with some freedom and a spring would be a nice alternative too.
    Another idea would be to make the track out of several hulls and use sliders with springs for those hulls, that should give a very nice driving experience.
  • Turret :Use a custom hinge joint, that supports rotations beyond 180° and 180°. See Julio's source for it here and simply add an angular row at the end (with the same pin direction as the hinge) that changes the turret's rotation to match the currently manual set one (CurrRotation-ManualRotatio). This gives you a turret that sticks to the tanks movement and rotation (they way it's supposed) but that can be freely rotated manually.

So as you can see there is not much magic behind creating a tracked tank, and hopefully this thread will help people out there get tanks into their games.
Last edited by Sascha Willems on Sun Mar 16, 2008 1:32 pm, edited 5 times in total.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby Julio Jerez » Tue Mar 04, 2008 3:22 pm

tarara tara, tara,
I Shout out to VSK,
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby Vsk » Tue Mar 04, 2008 3:38 pm

Julio Jerez wrote:tarara tara, tara,
I Shout out to VSK,


It is gonna be good suggestion for the complety version of my application (in case I get not fire for the demo one :?).

Next week I have to deliver the demo in a presentation :x . I am nerveous.
In case I got it I will have more time and a lot more experience doing videogames.

And of course will try to use newton ;).
I will check it.
Vsk
 
Posts: 34
Joined: Thu Oct 18, 2007 3:13 pm

Postby Julio Jerez » Tue Mar 04, 2008 4:41 pm

Vsk wrote:Next week I have to deliver the demo in a presentation :x . I am nerveous.
In case I got it I will have more time and a lot more experience doing videogames.

do you have anythong to show?

Sascha what what is this a remake of operation citadel?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby Vsk » Tue Mar 04, 2008 4:53 pm

Julio Jerez wrote:
Vsk wrote:Next week I have to deliver the demo in a presentation :x . I am nerveous.
In case I got it I will have more time and a lot more experience doing videogames.

do you have anythong to show?

Sascha what what is this a remake of operation citadel?


Where in the presentation or here?
I *must* have something for the presenation, even more must be "perfect" for a demo.
Here I can not show anything, besides it * in graphics. There is nothing importante to see :(.

The second senntence I don't understand it at all :? What do you mean.
Vsk
 
Posts: 34
Joined: Thu Oct 18, 2007 3:13 pm

Postby Julio Jerez » Tue Mar 04, 2008 5:07 pm

I do not mean here, I mean for the presentation?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby Vsk » Tue Mar 04, 2008 5:21 pm

Julio Jerez wrote:I do not mean here, I mean for the presentation?


Yes, it has a litlte bit of everyting, graphic part, physics, IA, sound.. etc.
Anyway I am realy late, and I will see what hapennd :(.

3d engine+3d physics+ 3d sounds + IA + logic all together and separeted was almost new for me some months ago.

Lucky my country * even more than I in average :P.
Vsk
 
Posts: 34
Joined: Thu Oct 18, 2007 3:13 pm

Postby Julio Jerez » Tue Mar 04, 2008 5:29 pm

well Good luck.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby Vsk » Tue Mar 04, 2008 5:44 pm

Julio Jerez wrote:well Good luck.


Thanks, althoug I worked very hard... I will need it.
Vsk
 
Posts: 34
Joined: Thu Oct 18, 2007 3:13 pm

Re: Tank demo (2008)

Postby Julio Jerez » Tue Mar 04, 2008 7:08 pm

Sascha Willems wrote:Don't make the tracks rigid. That's what I did in the beginning (and the old demo), as this makes your tank move like it's made out of one block of metal rather than it should be. Right now I'm testing (you can see it in the debug display at the end of the video) with a hinge joint that tilts some degrees forwards and backwards. Not perfect, but very close to a real track in terms of movement. Next step could e.g. be to add a spring to that hinge to make it look more natural. But this is something that you can try out yourselves, maybe a slider with some freedom and a spring would be a nice alternative too.


Master Sascha, I see you are using the hinge idea to connect the thracks. I did not see at first in the video, I new there was something different in the video that makes it look better, so I see by teh end :D :D .
I think I have an idea that could be a refinement of the hinge idea.
Basically the ideal is to make a sliding contact joint instead of a hinge.
Slidning contact is like the corkscrew joint but it slides perpendiculat to the axis of rotation while the corkcrew slides along the axis of rotation.

That joint provides two degrees of fredoms to the threads one lingitudinal and one of rotation, as oppose to the hinge that only allow one rotational.
Then the suspension can be simulated using new spring/damper force function new version that allow for adding forces from the joint call back.
I will post the code for the joint, because is a good sample for the usage of the function.

Also if you detach the thread visual geometry a let them move with the body of the thread, ....
man I don not even want to continues is the commercial engine?
Tan tan tan tanmn
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby Cochrane » Wed Mar 05, 2008 4:01 pm

This is great news. For an older project of mine I used the same technic after reading the original thread, and I could never get it to work as good as I wanted.
Cochrane
 
Posts: 3
Joined: Mon Sep 05, 2005 10:41 am

Postby Julio Jerez » Thu Mar 06, 2008 4:07 pm

Cochrane wrote:This is great news. For an older project of mine I used the same technic after reading the original thread, and I could never get it to work as good as I wanted.

In that case we need to perfect the tecnique, we cannot let something this good to go away, can we?
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Postby Sascha Willems » Fri Mar 07, 2008 6:53 pm

I have uploaded a second video (~11 MBytes, 1:30min) showing the tank with a functional turret. Thanks to a hint from Julio (read this!), it now works perfectly and I'm using a hinge joint based on Newton's custom joint interface. The only real addition is an angular row in the constraint submission that will rotate the turret by a delta of current rotation minus manual rotation.

So that turret works like the one from a real tank. You can rotate it freely, and if it's rotated to a certain degree and the tank itself moves and rotates it'll always stay in that relative rotation position. It's very simple to do (just that additional angular row), reacts instant, sticks to it's rotation and therefore is much better than other ways like using omega or torque do to the rotation.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Postby Leadwerks » Fri Mar 07, 2008 7:21 pm

I notice the tank seems to spin very easily, as if it doesn't have much mass. It also wobble frontwards and back a lot.

I have a model of a JagD Panther I'd like to do a demo with in my engine. This is pretty sweet.
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Postby Sascha Willems » Fri Mar 07, 2008 7:46 pm

Leadwerks wrote:I notice the tank seems to spin very easily, as if it doesn't have much mass. It also wobble frontwards and back a lot.

I have a model of a JagD Panther I'd like to do a demo with in my engine. This is pretty sweet.


Well, it's a non-finished demo of a proof-of-concept ;)

I'm still working on it and tweaking it. I don't think that the fast spinning is a mass problem, cause that would then also happen when starting to accelerate, I thin I'll have to take the track's speed into account when accelerating the contacts along their tangents. Wobbling is also because I'm still working out the best way to have the tracks feel dynamic and not as if the whole tank was a monolithic block of metal, and now it's just using a simple hinge. And a bit of wobbling is realistic, just look at a tank hopping around a terrain, although I'm still experimenting on what's the best solution for having a trank track that feels dynamic and realistic.
User avatar
Sascha Willems
Moderator
Moderator
 
Posts: 346
Joined: Fri Aug 27, 2004 10:18 am
Location: Germany

Next

Return to User Gallery

Who is online

Users browsing this forum: No registered users and 4 guests