Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Work in Progress / Car Physics Plugin

Author
Message
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 1st Jan 2006 23:43 Edited at: 6th Jan 2006 06:24
Hi,

I have taken a break from my game X-Ball, and I am working on a Car Physics Plugin.

I know you all have seen my other crappy code snippets , but this is much better, and easier.

It's no big competitor to things like ODE and Newton, but to be honest, I would rather use this when it comes to just moving around. It doesn't do anything with collision and falling around, but it has a big array of functions that can make your racing-game programming much easier.

Update: Look Down!!!

Have fun with these. Hopefully they should make your physics coding easier.

Xenocythe
18
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 2nd Jan 2006 00:31
Cool, thanks alot Zoto! You da man! Anyways, how was your New Years? Get on MSN
Sergey K
20
Years of Service
User Offline
Joined: 4th Jan 2004
Location:
Posted: 2nd Jan 2006 00:59
plugin.. nice
what program u working with to make the plugin?

Just. ...Leave me alone =/
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 2nd Jan 2006 01:02
Heh, DBPro, I don't have any experience with C++ or anything, but just cos it's functions doesn't mean it's not a plugin right?

Xenocythe
18
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 2nd Jan 2006 01:05
So its still like a plugin, but would be cool if you didn't have to put all that function code at the bottom of your program all the time. Maybe 'include' will be better?
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 2nd Jan 2006 01:24
Yeah, but that's up to the user.

I guess I could even make a keywords file so the functions would highlight, but I think I'll wait till I'm finished it.

Xenocythe
18
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 2nd Jan 2006 03:11
A keywords file would be much cooler, but do what you want.
Kenn
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: PHILADELPHIA, USA
Posted: 2nd Jan 2006 03:45
thanks a lot this works great so my game
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 2nd Jan 2006 21:27
Updates it.. but one bit of the update needs a little finishing, but nevermind, here's another little demo. This one has separate physics for every wheel.



Darkbasic MADPSP
18
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 2nd Jan 2006 22:08
Cooooool to complex AGHHHHHHHHH

Experienced DB http://www.greatgames3d.com (work in progress site)
Kenn
18
Years of Service
User Offline
Joined: 25th Dec 2005
Location: PHILADELPHIA, USA
Posted: 2nd Jan 2006 22:50
well I'm not going to lie I don't drive yet. But the previous turn work more realistic to me. This one with tight turns.
Seppuku Arts
Moderator
19
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 2nd Jan 2006 23:00
No screenshots, mods lock this!! Nah just messing, sounds kewl, will be nice to try it out, once I finish my Lotus Elise model.

"I want to put a bullet through my head everytime I think of you!!!"- Slayer
Hawkeye
20
Years of Service
User Offline
Joined: 19th Sep 2003
Location: SC, USA
Posted: 3rd Jan 2006 00:22
Sqrt for distance? *gasp* Use vectors, they're a lot faster...


I am but mad north north-west; when the wind is southerly I know a hawk from a handsaw - Hamlet, Hamlet
Darkbasic MADPSP
18
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 3rd Jan 2006 17:32
how do i use vectors?!?!?!?!?!?!?!?!?!

Experienced DB http://www.greatgames3d.com (work in progress site)
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 6th Jan 2006 06:16 Edited at: 6th Jan 2006 15:24
Ok, daramtically updated, I just realised how useless the Update_Physics Function is, because it only makes physics the way it wants it, and only that way, so, I basically emptyed it out into lots of functions + more!

There are now over 30 command for you to play with, I can't be bothered explaining them, and you can't be bothered reading them, so I will just copy and paste from my list.

Quote: "
Start_World_Physics()
Start_Object_Physics(Object Number)

Set_Standard_Gravity()
Set_Standard_Drag()

Weigh_Object(object number)

Set_Linear_Force(Object Number, X, Y, Z)
Set_Linear_Velocity(Object Number, X, Y, Z)

Set_Angular_Force(Object Number, x, y, z,)
Set_Angular_Velocity(Object Number, X, Y, Z)

Move_Object(Object Number, Speed)
Push_Object(Object Number, Speed)

Control_Object_Using_Forces(Object Number, Push, Turning Radius)
Control_Object_using_Velocities(Object Number, Speed, Turning)

Get_Old_Position(Object Number)
Set_Next_Angle_X(Object a, Object B, smooth)
Set_Next_Angle_Y(Object a, Object B, smooth)
Set_Next_Angle_Z(Object a, Object B, smooth)

Position_At_Object(Object A, Object B)

Get_Object_Direction(Object Number)
Get_Traction_Force(Object Number)
Get_Drag_Force(Object Number)
Get_Force(Object Number)
Get_Speed(Object Number)
Get_Acceleration(Object Number)

Set_Acceleration(Object Number)
Set_Velocity(Object Number)

Get_Angular_Acceleration(Object Number)
Get_Angular_Velocity(Object Number)

Update_Coordinates_Straight(Object Number)
Update_Coordinates_Slide(Object Number)

Update_Angles(Object Number)

Get_Lateral_Forces(Object Number)

Calculate_Offsets(Object Number, Offset X angle, Offset Y angle, Out)

Update_Object_Position(Object Number)
Update_Object_Position_With_push_Forces(Object Number, a, b, c)
Update_Object_Position_with_offsets(Object Number, a, b, c)
Fully_Update_Object_Position(Object Number)

Update_Object_Angles(Object Number)
Standard_Update(Object Number)
"


And now the code for them all:


I'll attach the keywords file, very usefull (That goes in Editor>Keywords, and will make the function go blue). I wont make help files just yet though.

Have fun with it.. again...



[edit]

And again, that last demo, pretty much the same, just so you can make sure that the functions work.



Attachments

Login to view attachments
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 6th Jan 2006 12:18
Looks nice Zotos. It looks like you're really getting the hang of those physics.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 6th Jan 2006 16:02
Thanko,

and you know what a great thing about it is that you can't do on newton or ode, if all else fails you can take the arrays for youself and do whatever you want with them.

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 6th Jan 2006 17:39
The functions are just pouring in. Here's another update:

The list:
Quote: "
Set_Traction_Constant(Object Number, Traction Constant)
Set_Angular_Traction_Constant(Object Number, Angular Traction Constant)
Set_Body_Mass(Object Number, Mass)

Weight_Object(object number)

Set_Linear_Force(Object Number, X, Y, Z)
Set_Linear_Velocity(Object Number, X, Y, Z)

Set_Angular_Force(Object Number, x, y, z,)
Set_Angular_Velocity(Object Number, X, Y, Z)

Move_Object(Object Number, Speed)
Push_Object(Object Number, Speed)

Control_Object_Using_Forces(Object Number, Push, Turning Radius)
Control_Object_using_Velocities(Object Number, Speed, Turning)

Get_Movement_Angle==(Object Number)

Get_Old_Position(Object Number)
Set_Next_Angle_X(Object a, Object B, smooth)
Set_Next_Angle_Y(Object a, Object B, smooth)
Set_Next_Angle_Z(Object a, Object B, smooth)

Position_At_Object(Object A, Object B)

Get_Object_Direction(Object Number)
Get_Traction_Force(Object Number)
Get_Drag_Force(Object Number)
Get_Force(Object Number)
Get_Speed(Object Number)
Get_Acceleration(Object Number)

Set_Acceleration(Object Number)
Set_Velocity(Object Number)

Get_Angular_Acceleration(Object Number)
Get_Angular_Velocity(Object Number)

Update_Coordinates_Straight(Object Number)
Update_Coordinates_Slide(Object Number)

Update_Angles(Object Number)

Get_Lateral_Forces(Object Number)

Calculate_Offsets(Object Number, Offset X angle, Offset Y angle, Out)
Calculate_Offsets_AB(Object Number A, Object Number B, Offset X, Offset Y, Out)

Place_On_Matrix(Object Number, Matrix Number, Height)

Update_Object_Position(Object Number)
Update_Object_Position_With_push_Forces(Object Number, a, b, c)
Update_Object_Position_with_offsets(Object Number, a, b, c)
Fully_Update_Object_Position(Object Number)

Update_Object_Rotation(Object Number)
Standard_Update(Object Number)

Update_Speed(Object Number)
Get_Movement_Time(Object Number)
Get_Movement_Distance(Object Number)

Get_Kinetic_Energy(Object Number)
Get_Work_Done(Object Number)
Get_Excerted_power(Object Number)
"


(There are 54 functions there)

And the Functions:



And the usual little car demo with better stuff.



Darkbasic MADPSP
18
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 6th Jan 2006 17:44
this rulez i think heres a pic of my new racing game thanks to zotoaster helping me with the speedo and powerslide

Experienced DB http://www.greatgames3d.com (work in progress site)

Attachments

Login to view attachments
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 6th Jan 2006 17:49
Heh, why dont you try out my functions then to even make your movement better, all you really need is to include the functions, then:

before the loop:
Start_World_Physics()
Set_Standard_Gravity()
Set_Standard_Drag()

Start_Object_Physics(Object Number)
Set_Move_Constant(Object Number,250000)
Set_Traction_Constant(Object Number,0.98)
Set_Angular_Traction_Constant(Object Number,0.98)
Set_Body_Mass(Object Number,10.0)
Weigh_Object(Object Number)


Then in the main loop:
Control_Object_Using_Forces(Object Number, Push, Turn)


That should give you some descent controls

Darkbasic MADPSP
18
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 6th Jan 2006 18:06
cool thanks

Experienced DB http://www.greatgames3d.com (work in progress site)
s0l1dsnak3123
18
Years of Service
User Offline
Joined: 29th Jun 2005
Location: Scotland
Posted: 11th Jan 2006 17:39
coooooooooool
The Nerd
19
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 11th Jan 2006 18:23
Quote: "but just cos it's functions doesn't mean it's not a plugin right?"


It's not a plugin

A plugin is a computer program that can interact with other programs to add a specefic function etc...

Just... Call it functions!

These functions seems very good! i haven't checked them out yet thought Will do when I have time

-The Nerd

Free Particle Engine for DarkBasic Pro:
http://forum.thegamecreators.com/?m=forum_view&t=60141&b=5

Login to post a reply

Server time is: 2024-04-19 18:55:07
Your offset time is: 2024-04-19 18:55:07