gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS homebrew announcements > Car Physic Demo

#174950 - Jim - Sun Aug 08, 2010 12:21 am

Hi,

I've made a racing demo a while ago, where you drive a Ferrari F40 on the grounds of the Norisring.

It's a very dark Demo, because I haven't included a sky. The graphic part was not so important for me for this version.
I've used models that I've found on several pages. The F40 is from a NFS-Page and the track is a model that was converted for racer.nl so I don't know from which original game it is.

More important was the physic that is mainly code by Marco Monster. I tried to get it stable and to have a good feeling for driving a car. Because of this I've included the Norisring but only the important parts of the track. It's only there for testing the driving. It's a complete flat track so I hadn't to change the 2D physic engine much.

At the moment I'm working on the graphics and the collisions. So I hope to release a new version in the near future.

For more informations and links (about car physic in general) visit my page.


Download:
CarPhysics5_NDS.nds (683 KB)

Screenshot

Control:
Left | Right = Steer Left | Right
R = Accelerate
L = Brake
Select = Reset
Touch "back" | "next" = Previous | Next Screen

- No DLDI used
- Tested with M3 DS REAL on Hardware and no$gba

#174967 - keldon - Tue Aug 10, 2010 7:32 pm

Oh wow this is great; funnily enough I'm running your program in DS emulator in a Windows emulator ^_^

The steering input system needs to allow for oversteer so that the user tap left/right to control the steering angle, also the wheel needs to return to neutral much quicker.

Will be interesting to see where this goes, awesome!

#174977 - Jim - Thu Aug 12, 2010 2:12 am

Thanks for your comment.

The thing with the wheel to go to neutral will be changed.
But what do you mean with the oversteer and the control of the steering angle? At the moment I have a very simple (linear) tire model that gives you always full grip and so no over- or understeer, or do you mean something else?

#174980 - keldon - Thu Aug 12, 2010 9:36 am

Yes, oversteer and understeer; or if they haven't been implemented it should be much quicker to reach full lock otherwise it makes turning extremely difficult.

#175638 - Jim - Tue Jan 11, 2011 7:17 pm

New version with a better control, graphic and included collision with the ground. That should be every point that I have mentioned here before.

To make use of the collision detection I have changed the track to one that has more up and downs than the Norisring and that's Laguna Seca.

Here the main points of this demo:
+ stable physics
+ better control (quicker steering and return to neutral)
+ you can see the weight distribution
+ collision with the ground
+ timing that stops the best time of the session, with 3 sectors
+ 2D map of the track with the position of the car
- no collision with the walls
- no change of speed or traction on dirt
- so you don't have to stay on track
- no drifts, only light oversteer if you brake
- framerate goes down if there are many collision detections, mainly in the last corner

Download:
CarPhysics6_NDS.zip (1.02 MB)

Screenshot

For now I have decided to start this project again and rework the code, because I ran in some problems with the physics in the last time (mainly the tyres) and I tried many things out in the last year that were only fast included.
That's the current state of my project. I hope you enjoy it.

#175643 - PypeBros - Wed Jan 12, 2011 9:43 am

From the screenshot on your site, I'd suggest you also invest some effort into giving the car a shadow. That could greatly improve realism.
_________________
SEDS: Sprite Edition on DS :: modplayer

#175645 - SchmendrickSchmuck - Wed Jan 12, 2011 12:12 pm

When accelerating and braking quickly a few times, the controls for left and right get reversed, steering left makes the car (slowly) turn right, and vice versa. Also, braking is a little slow.
Looks good otherwise

#175649 - racesimfan - Wed Jan 12, 2011 6:10 pm

Great game thanks! It has huge potential! Finally a real racing game on ds with real tracks!!

#175653 - relminator - Thu Jan 13, 2011 10:03 am

Jim wrote:

1 - no collision with the walls

2 - framerate goes down if there are many collision detections, mainly in the last corner


1. I once helped a guy with a fast collsion code for his DS racing game(Kartz Animalia). I maybe able to help in that department.

2. Did you try to do a broadphase collision system?

a. Divide your track models into grids. A simple 2d grid system should work (though if you want to use octrees or quadtrees, I have some code here somewhere).
b. Limit your collisions to triangles within the box that intersects(or that contains) your car.

The beauty of that grid system is that it can also be used to limit your rendered polygons by using the DS's hardware "box-testing".
_________________
http://rel.betterwebber.com

#175670 - keldon - Thu Jan 13, 2011 10:27 pm

Oh, this had a really nice feel to it and the graphics look really nice. There were a few weird graphical glitches on hardware, which increased when you came off of the track and tried to return to it. Overall the experience was good and I am looking forward to the final release!

#175675 - Jim - Fri Jan 14, 2011 12:58 pm

Thanks for all your comments.

@PypeBros: I haven't thought about shadows, but that comes now on my list.

@SchmendrickSchmuck:
The problem with the reversed controls could be corrected in a minute but I will do this with the next release. Except there are some other bugs that make this new version unplayable.
The brake and tyre force values have been changed at the end, so it can be possible that the braking force is a bit low.

@elminator: Thanks for the hints with the collision detection, but I think I have already a good basement.
I have already divided my track in several parts, you can see this when you drive the track in the wrong direction, because I only render some parts forward in the right direction. Also the collision detection uses this system, but the track model isn't realy made for the NDS. Especially the corners have many triangles. On the other hand I have divided the track by hand and so some parts are be a bit unoptimised.

The collision with the walls is also something that I have already done. But the main problem for me is, how to handle a collision after the car is in the wall. I already have a working solution for this, but not over the complete track so I've decided to leave it out for now.