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.

Dark Physics & Dark A.I. & Dark Dynamix / Force and MPH reading.

Author
Message
x_THOR_x
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 10th Jan 2008 05:38
I need some help with getting my screen text to show the MPH on the screen. I can get the FPS and the Force and all that but when I try to convert the force speed to mph it wont work. Should I use something else besides the force reading? I am really stuck on this.
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 11th Jan 2008 18:28
mph = mile per hour?
dont you think it may have somethin to do with calculating how much your vehicle travelled in defined time and scale the distance value to your world scales?
Yeh i think thats it.
x_THOR_x
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 11th Jan 2008 18:49
I thought about that but Im not sure how to do it.
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 13th Jan 2008 11:28
lets say
1mile = 100

moved on 1hour / 1mile
then u get the "mph"

Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 13th Jan 2008 18:17
Remember the default unit for Dark Physics is in meters. This is not arbitrary and is based on gravity equaling 9.8 meters per second squared.
Therefore without an adjustment in scale if an object travels at a constant speed 10 units in 1 second it has traveled 10 meters per second.

in 1 hour the object will travel 10 x 60(seconds) x 60(minutes) or
36000 meters

1 meter = 0.000621371192 miles

or 22.3693629 miles per hour

Hope this helps

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
x_THOR_x
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 15th Jan 2008 07:13
Thanks guys, I understand now. Was never really good with thaat type of stuff.
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 12th Feb 2008 12:52
One of the MPH/KPH "gauges" I made used that kind of math but the readout was extremely jumpy. So what I did was use an array to store my calculated MPH over time. I'd have the LAST 10 or 20 MPH readings, I then would average them.

This gave me a smoother MPH gauge. Yes, it would take a second to show current speed, and sudden stops... you'd see the needle "fall to zero" but... if you ask me - it got me pretty close to how an analog speed gauge works in a car

x_THOR_x
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 15th Feb 2008 06:46
Can you show me an example jason, I cant get a grasp on exactly how its done.

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 15th Feb 2008 13:46
I'm about to go to work - so I'll be brief...(Just respond again if you need more)

First you need your "Scale" Figured out. How far is a DBP/GDK Unit supposed to be? I've changed my coding to a suggestion in the Forums - I think IanM or VanB said DarkPhysics' default gravity works decent if 1 dBUnit = 1 Meter.

Then I went to a web site like: http://www.worldwidemetric.com/metcal.htm

To figure out how I wanted to represent my desired "Measure" using this 1 meter = 1dbpro unit rule.

Now In my loop - Each Loop - I would Store MY Position (Or
Camera Position if I was flying around a scene). I have a vector set up for distance measuring.

Psuedo



Ok - That is how I get the DISTANCE for Each Frame (There are various distance routines in the forums I'll get you a couple later if you haven't found one - but do try )

Ok.... Now I just exaplained ONE ITERATION. Now about this Array junk.

In Short, you need to append this "New Distance" value we just got onto the END of this array. This array should have... say 20 elements or something - but whatever count you use - that is the value you use for your averaging calculation.

So.... This Array's First Position, is the OLDEST DISTANCE Value, while the Last entry is the NEWEST. Each Iteration, you toss the oldest DISTANCE VALUE AWAY, and the New One replaces it.

There are a number of ways to do this kind of array manipulation, Read about DBPro QUEUE Array and the Concept of RoundRobin and FIFO buffer's. (Pretty Easy... think of a line at the BANK while waiting to cash a check... FIFO = "First In - First Out"

Now - We have an array of 20 items... each a distance traveled in a one of the most recent loop iterations:

(pseudo code)


I got to go - All you missing is TIME ELAPSED * DISTANCE TRAVELED....

I got to go to work - that's the Array principle.

I have working Code I can post later - just respond again with what you couldn't do your self - and I'll know to come back and say something
Gotta GO LATE LATE

x_THOR_x
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 16th Feb 2008 06:28
I understand the array but I am having a hard time with the rest. This is the project I use when I try to add new stuff. Once I get it to work I add it to my main project. I dont know if you would like to see what exactly I am working with.

Attachments

Login to view attachments
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 16th Feb 2008 17:31
Here ya go Bro. It's based on CAR movement - not MPH measure from a "Transmission" or Wheel.



I'm off to take my son snowboarding - so I won't be around until tonight most likely.

Good Luck. Back up your work before overwriting what ya have with mine - just to be safe. I commented code - and tossed in a bunch of keyboard scancodes for using the keystate command.

Jason

x_THOR_x
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location:
Posted: 17th Feb 2008 00:53 Edited at: 17th Feb 2008 00:54
Jason, I cant thank you enough. That is exactly what I have been trying to do but just couldnt get a hold of it. Thank you for all the help, I will see to it that you get full credit for your code when/if I finally release my game.

Thanks again man. and have fun snowboarding!!!

jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 17th Feb 2008 13:24
You're Welcome and we did have fun snowboarding... I haven't done much... um physical stuff like that in awhile... I had a blast - but I'm feeling it today. I have a slight limp going

Login to post a reply

Server time is: 2024-05-20 01:28:51
Your offset time is: 2024-05-20 01:28:51