Author Topic: Want to create a racing script, but stuck.  (Read 3100 times)

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Want to create a racing script, but stuck.
« on: March 23, 2009, 11:19:32 AM »
Hi,
In my game, I just introduced cars where players can drive from city to city.  They can also add upgrades to their cars, and all of this is working pretty well now.

so the next thing I want to do is allow them to race one another.

I have a basic idea how I could see it working, but I'm stuck on how to code it.
I'm thinking I could get each players car specs,  add up all the improvements they've made, then subtract the weight of the car plus upgrades.   Then use the players driving experience somehow in the calculation.

Then throw in some random events too, like a flat tire etc.

I was wondering if anyone has ever seen a basic racing script anywhere?  I've been looking to get some idea how it's been done before, but haven't found anything.   Would just like to see how some of games have done it, and I think that might help me get a better idea how to decide how to calculate the winner etc.

Just to clarify I'm not asking for a complete script or for anyone to do the work for me.  I just want to get an idea how to start.

Thanks!

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #1 on: March 23, 2009, 12:15:48 PM »
i didn't find it
if u can't found it anywhere just go on changing the algorithms until u think it is good :) lol
bbgFramework v0.1.3
Sun Database Class v0.3

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #2 on: March 23, 2009, 02:37:31 PM »
again game logic :)
different people have different ideas on making something logical and to implement "real life" feeling instead of just "math" feeling...so that player think that he is driving and not only IF 3>2 then you win style.

I would do it like that:
engine -> max speed
transmission & chip tuning -> acceleration
spoilers and all -> better traction

so then you think of some road I dont know 3 curves and lines between there. so you can use your math/physics knowledge to calculate how fast does he gain top speed and then in curves max speed is limited (coz of traction), but if he has spoilers n shit then he can drive faster ... this system would need much more thinking and all but it would give players feeling that something means something (coz in description of parts u tell impact on driving of each part).

now to give you idea:
v = a*t
s = 1/2 * a * t^2

v = speed
a = acceleration
t = time
s = length

so lets say your a = 3m/s^2, and max speed of your car is 24m/s ...
t = v/a = 24/3 = 8s
so this car will need 8 seconds to reach this speed and in that time it will drive
s = 1/2 * 3 * 8^2 = 96m
so if you 1st section is 200m he will need to drive another 104m with constant speed 24m/s meaning 104/24 = 4.333s
so total time for 1st section is 12.333seconds
then lets say you dont use braking (althrough that can be great too so he must brake to speed in that curve which is max 15m/s)
so curve is 100m and his speed is 15m/s which comes to 6.667seconds

so alltogether that is 19seconds driving time
and other player have some good spoiler or tires or something and he can drive max 16m/s in that corner so that is 6.25seconds
all together that is 10.583s for 2nd car and he wins!

so you can make such system that outputs (print,echo) those times:
A---------B
                \
                  \
                    \
                      C

A-B is line
B-C is curve with limited speed so you output that times A = 0 and B and C so user see where is his car lacking or what can he improve
hope you get basic idea

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #3 on: March 23, 2009, 04:24:13 PM »
again game logic :)
different people have different ideas on making something logical and to implement "real life" feeling instead of just "math" feeling...so that player think that he is driving and not only IF 3>2 then you win style.

I would do it like that:
engine -> max speed
transmission & chip tuning -> acceleration
spoilers and all -> better traction

so then you think of some road I dont know 3 curves and lines between there. so you can use your math/physics knowledge to calculate how fast does he gain top speed and then in curves max speed is limited (coz of traction), but if he has spoilers n shit then he can drive faster ... this system would need much more thinking and all but it would give players feeling that something means something (coz in description of parts u tell impact on driving of each part).

now to give you idea:
v = a*t
s = 1/2 * a * t^2

v = speed
a = acceleration
t = time
s = length

so lets say your a = 3m/s^2, and max speed of your car is 24m/s ...
t = v/a = 24/3 = 8s
so this car will need 8 seconds to reach this speed and in that time it will drive
s = 1/2 * 3 * 8^2 = 96m
so if you 1st section is 200m he will need to drive another 104m with constant speed 24m/s meaning 104/24 = 4.333s
so total time for 1st section is 12.333seconds
then lets say you dont use braking (althrough that can be great too so he must brake to speed in that curve which is max 15m/s)
so curve is 100m and his speed is 15m/s which comes to 6.667seconds

so alltogether that is 19seconds driving time
and other player have some good spoiler or tires or something and he can drive max 16m/s in that corner so that is 6.25seconds
all together that is 10.583s for 2nd car and he wins!

so you can make such system that outputs (print,echo) those times:
A---------B
                \
                  \
                    \
                      C

A-B is line
B-C is curve with limited speed so you output that times A = 0 and B and C so user see where is his car lacking or what can he improve
hope you get basic idea

Wow, thank you for such a great detailed reply!!
This gives me more to think about, and hopefully I can figure out how to actually implement this. 
I want it to be fun for them!

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #4 on: March 24, 2009, 07:16:22 PM »
Hi again,

I've been looking at your example, and trying to use some different numbers to get a better handle on how this could work.

So let's say I have a car max speed 35 m/s
a = 2 m/s
t = 35/2 = 17.5 seconds  (is this correct?)
s = 1/2 * 2 * 306 =  306 meters (am I right so far?)  I was also not sure where the 1/2 comes from?

So if the track is 200 meters long,  how do I calculate how long it takes him to get from the start to finish?

I'm starting to grasp this, but the darn math is kicking my butt lol.

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #5 on: March 24, 2009, 08:27:11 PM »
I think i am gonna explain u these :) (i can cuz i am one of the brightest students in India)

Newton has given us 3 equations for motion of an object
they are :

@  v=u+a*t
@  s=u*t+1/2*a*t2
@  v2-u2=2*a*s

     here u ( initial speed of car)
             v ( final speed of car when u observe)
             a ( accelaration of car)
             s ( the total distance covered until u observe)
             t ( time taken until u observe)

   If u have some of this variables u can get others easily when u substitute these in those 3 equations.
 I can give proof for equations but i think that is unneccessary now.
Quote
So let's say I have a car max speed 35 m/s
a = 2 m/s

So if the track is 200 meters long,  how do I calculate how long it takes him to get from the start to finish?

here a=2, u=0 (always u start with 0 speed in a race), s=200

so from 3rd equation u get v

               v2-0=2*2*200   =>   v=28.28 (rounded to 28 if u wish)

as this is less than max speed of car so he will still be accelarating until this moment

Now we got v but we want t, put the data into 1st equation
       
         28.28=0+2*t    =>    time taken by car = 14.14 s

PS: the answer is not exact cuz it is rounded to second decimal


-edited afterwards
« Last Edit: March 25, 2009, 10:28:20 AM by pavansss91 »
bbgFramework v0.1.3
Sun Database Class v0.3

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #6 on: March 25, 2009, 10:21:24 AM »
or you can do it this way
v = a*t => t=v/a
s = 1/2 * a * t^2
you know s,a so you can get v if you "put" 1st formula to 2nd
s = 1/2 * a * (v/a)^2 = 1/2 * v^2/a => v^2 = 2*a*s

didnt you have equations in school and how to operate with them :)
but pavansss91 explained everything.

also I would like to tell that if they learn you in India that 3 newtons laws are those you have written....they are not :)
Newton 3 laws are (Eng not my primary but you will get my point):
@ object that is not moving remains not moving & object that is moving will continue to move with same speed if you dont add any forces in process
@ F = m * a
@ Every action has opposite reaction

so if you screwed up with laws, study more and if you teacher told u so than he should be fired :)
« Last Edit: March 25, 2009, 10:25:20 AM by saljutin »

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #7 on: March 25, 2009, 10:27:17 AM »
oh  ;D
lol

i wrote laws instead of writing equations
sorry it is a just a mistake which occurs when u have many things in mind
:)
bbgFramework v0.1.3
Sun Database Class v0.3

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #8 on: March 25, 2009, 10:42:11 AM »
yeah but this has nothing to do with all 3 laws, only 1st law
coz if you have some force then object is moving with a (and mass is m)
also you get those formulas with integrating things like:
a = a = dv/dt = d^2s/dt^2
so if you integrate a*dt u get speed and if you integrate speed u get distance

but lets stop with this :) you thought 2 things and write them together so it is mistake and not lack of knowledge, but it does not matter...
what matters is that cdoyle gets help :)

also can you give us any links? for game I mean

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #9 on: March 25, 2009, 09:43:45 PM »
Thank you both for your help,  it's been a really long time since I've done any type of equations of any kind.

I'm going to try and work on this more over the weekend,  one thing I need to think about is making a little bit of randomness into it also.
Right now,  with all the 'variables' being basically fixed they would get the same time each time they raced.  So I need to think of a way to make it less static.
Also each time they drive their car,  they get driving exp. for that specific car.  Plus they also get driving hours for any car they drive.  I need to think about how this could be included into the racing.

I wasn't sure if you were asking for a link to my game or not, but here is what we have so far.
It's based on Zeggy's ezRPG.
Just to warn you, it's a mafia game.  I know most of you don't like these types of games but the members of my forum have been enjoying it so far.
http://www.caraudiocentral.net/CAC_Mafia_Life/

Thanks again for your help with this new mod, this one is going to be the toughest one I've done.


Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 589
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Re: Want to create a racing script, but stuck.
« Reply #10 on: March 26, 2009, 12:01:47 AM »
Back long time ago I was working on a racing game, I canned it because I needed a Flash applet to really make the game and I really don't know Flash all that well and action script was really primitive.

Anyways one of the ideas I had that might work for you, and I'm not sure how to add this to the forumla's above either, but add engine degradation. During every race the efficiency of your engine goes down a bit because racing is hard on an engine. Now give the player's 2 options to perform on there car

1. Tune Up - This would increase the efficiency by a small percentage but never a 100%. Charge small amount of money
2. Complete Rebuild - This would increase the efficiency back to 100%. Charge a HUGE amount of money

By adding something like this you can very the engine performance slightly so you don't get stuck with a best car vs best car.

Another option is (from what I read in your posts) is the driver. Give them a percentage chance of missing a gear when they shift, you could simply do the calculations above and if they miss a gear add X amount of seconds to there time. Now that I think about it you could do the same with the engine efficiency above as well, just add time ;)

I didn't check out your site but if your really going full mafia then putting car racing, although neat, doesn't really fit the theme. I've never seen a documentary where the mafia had anything to do with cars unless they were boosting them. If you are using a mafia style engine and adding modern day gangs to it then by all means add racing. This is, of course, my humble opinion so take it with a grain of salt and a shot of tequila.

Creating online addictions, one game at a time:

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #11 on: March 26, 2009, 06:14:36 AM »
For randomness I would tell you something like that:
you can make it simple mt_rand(min,max), where basic value is value you get from formulas and then you add seconds because of:
-driving skills
-parts durability
-random events (like birds hitting car and because driver steps on brake he looses x seconds, or he drives over cat :) and all)
...

or you could make that transmission impact more complex ... like lets say max speed of your car is 40m/s divide that by 5 and get interval he uses 1 gear, so then when you accelerate at the end of that "stage" you check deltaV (Vend-Vstart) and you get some number and then divide it by that interval.

primer:
Vmax = 40m/s => interval is 8m/s (if he has 5 gear transmission)
on 1 section he gets from 15m/s to 35m/s meaning dV = 35-15 = 20 m/s
times transmitted 20/8 = 2.5x -> decide is that is 2 or 3, lets say 3
use: for i=1 to 3 -> mt_rand(min, max driving skills impact because of transmision)
and add this time to ideal section time

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #12 on: March 30, 2009, 08:49:47 PM »
Hi Again,

I worked on this some over the weekend,  I didn't know that there were 2 replies since the last time I've been here.  NOt sure why I don't get the email notifications.

Anyways,  I've been messing on getting the track times and have a very early script.   I haven't figured in the driving hours, or driving exp yet, or adding any random events.

So far I have it basically just 1 car type of thing.  I mostly was trying to get some form of a time down, and I'm getting closer.
So the next thing I need to do is make it so multiple players can join.  I think what I'll do is allow the race creator set how many other can join the race (A limit of 5 or something).

So I know how to do that, but something I'm not sure how to do..   
How do I code the winner?  How do I code to determine the one with the lowest time wins?

Here is what I have so far,  not pretty code yet.  Mostly brainstorming things still.
Code: [Select]
$getcar = $db->execute("SELECT c.car_name, c.max_speed, c.acceleration, c.max_corner_speed, co.driving_skills, co.car_id FROM Cars c
                        INNER JOIN cars_owned co ON co.car_id=c.car_id
                        WHERE co.id=?", array(13));

$getcar1 = $getcar->fetchrow();
//track sections
$section1=200;
$section2=100;
$section3=400;


if($getcar->recordcount() == 0)
{
    echo "no results";
}
else
{

    $getaddons = $db->execute("SELECT u.acceleration_increase, u.corner_speed_increase, u.top_speed_increase FROM car_upgrades u
                           LEFT JOIN cars_upgradesinstalled cui ON cui.addon_id=u.id
                           WHERE cui.car_id=?", array(13));
    if($getaddons->recordcount() == 0)
    {
        echo "no getaddon results";
    }
    else
    {
        while ($getaddons1 = $getaddons->fetchrow())
        {
            $supbonus += $getaddons1['corner_speed_increase']/100;
            $speedbonus += $getaddons1['top_speed_increase']/100;
            $accbonus += $getaddons1['acceleration_increase']/100;

        }
        //add bonus equipment
        $acceleration = $getcar1['acceleration']+($getcar1['acceleration']*$accbonus);
        $speed = $getcar1['max_speed']+($getcar1['max_speed']*$speedbonus);
        $suspension = $getcar1['max_corner_speed']+($getcar1['max_corner_speed']*$accbonus);


        //get final speed of car for section 1
        $v1 = sqrt(2*$acceleration*$section1);
        echo "<br>v1\n" . $v1;

        //time for section 1
        $time = $v1/$acceleration;
        echo "<br>time1\n" . ($time);

        //get speed of car for section 2  this is a curve section.
        $time2 = $section2/$suspension;
        echo "<br>Time2\n" . $time2;

        //get final speed and time for section 3
        $v3 = sqrt(2*$acceleration*$section3);
        echo "<br>v1\n" . $v3;
        $time3 = $v3/$acceleration;
        echo "<br>time1\n" . ($time3);

        $totaltime = $time + $time2 + $time3;
        $totalpercent = $totaltime * .5;
        $totaltimemax = $totaltime + $totalpercent;
       
       function random_float ($totaltime,$totaltimemax) {
            return ($totaltime+lcg_value()*(abs($totaltimemax-$totaltime)));
        }
        echo "randomfloat" . round(random_float($totaltime,$totaltimemax), 2);

« Last Edit: March 30, 2009, 08:51:28 PM by cdoyle »

Offline pavansss91

  • Level 18
  • *
  • Posts: 185
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #13 on: March 30, 2009, 11:18:59 PM »
write the script such that it calculates times for i car owners(i are racing)

now sort those times into another array and thus u can have results in winning order by displaying the other array
bbgFramework v0.1.3
Sun Database Class v0.3

Offline divac14

  • Level 2
  • *
  • Posts: 3
  • Reputation: +0/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #14 on: March 30, 2009, 11:22:41 PM »
it would be a good idea to have more than one lap. An easy way to do this would be to make most of your code a function and then just loop that function however many laps you want the race to be.
Also, if you decide to add in more things to make it more random like slowing down the final time because they didn't switch gears properly, you should also add in things that make the time faster.
For example, say right now with "Car A" you always finish the race in 40.07 seconds. This would be the fastest time he could finish the race without "randomness". So if the racer had a nitro upgrade and it is used randomly each race (like 2% of the time) then his time would be a little faster. But if he blew a tire or switched gears late his time would be slower. This would give the racer a way to finish the race faster than his car should finish the race if everything goes perfect.

Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 589
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Re: Want to create a racing script, but stuck.
« Reply #15 on: March 30, 2009, 11:59:08 PM »
You could sort it into an array but then you would need to pull some sort of pre-canned sorting algorithm for sorting multi-dimensional arrays. Not very hard to do and there are some great functions on the net for this.

Or you can go with another option.

Player creates race with and says 5 player's can join. You will need to store this in a table which would have something like

raceid
playerid
time
rank

When the script for the race runs it'll calculate time and update it for the player, you could then pull that from the database with time in descending order giving you your ranking, then loop though and update the rank. It does creates a couple more queries and updates but it is another option.

Creating online addictions, one game at a time:

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #16 on: April 03, 2009, 06:42:59 PM »
You could sort it into an array but then you would need to pull some sort of pre-canned sorting algorithm for sorting multi-dimensional arrays. Not very hard to do and there are some great functions on the net for this.

Or you can go with another option.

Player creates race with and says 5 player's can join. You will need to store this in a table which would have something like

raceid
playerid
time
rank

When the script for the race runs it'll calculate time and update it for the player, you could then pull that from the database with time in descending order giving you your ranking, then loop though and update the rank. It does creates a couple more queries and updates but it is another option.



I like this and I think it could work.
Would this be the way you would do it?

I'm looking at the array option, but not sure how to implement it.

Here is what I'm hoping to do,  since there will be multiple entries into a race.   I'll need to run the actual racing part of the script via a cron.  Since the players will need to wait until the max number of contestants have joined.

So it runs the script,  and gets the times for each racer.

What I would like to do is send a log message to each player and let them know how the race went.   I'm getting stuck here,
I'm thinking the log message would look something like this.

playername1  12.32seconds,  2.34seconds,  15.23seconds  total: 29.89 seconds
playername2  13.25seconds, 2.30 seconds, 15.56seconds  total: 31.11 seconds

I'm not sure how to 'store' each players information, while it runs through the loop.   Do I put them in a array somehow?   Not sure how to sort them either.


Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #17 on: April 03, 2009, 07:29:51 PM »
why cron? just check how many players signed and when last signed up first calculate his time & write it to table, then sort that table by time desc and you have winner :) using that you can also send message to every contestant...
while (6 players from sql->array) {
$i+=1;
//send message to player where $i is his final position :)
}

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #18 on: April 03, 2009, 07:44:17 PM »
why cron? just check how many players signed and when last signed up first calculate his time & write it to table, then sort that table by time desc and you have winner :) using that you can also send message to every contestant...
while (6 players from sql->array) {
$i+=1;
//send message to player where $i is his final position :)
}

ya, that would be easier then a cron, not sure why I didn't see it that way.  that makes sense.

This part tho, I'm a little confused by. 
Since the section times won't be stored in the db,  how do I put those variables for each player into the log message.
$totaltime1  << the time for section 1
$totaltime2  << the time for section 2
$totaltime3  << the time for section 3
I would need to store the times for each player, so it would display within the log.  To give the players an idea how close they were to their opponents.

while (6 players from sql->array) {
$i+=1;
//send message to player where $i is his final position :)
}


« Last Edit: April 03, 2009, 07:46:25 PM by cdoyle »

Offline Scion

  • Level 27
  • **
  • Posts: 402
  • Reputation: +11/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #19 on: April 04, 2009, 04:41:43 AM »
thats easy...store em in the DB then....

put it this way if you want to display them multiple times....to multiple players, or to the same player several times, then you are going to have to store them somewhere...so why not in a table called splits.

table: splits
split_id
split_race_id
split_section_id
split_car_id
split_time

edit: just slipped the race id in... :)  no one noticed it was missing right ;)


« Last Edit: April 04, 2009, 11:59:08 AM by Scion »

Offline saljutin

  • Level 22
  • *
  • Posts: 266
  • Reputation: +6/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #20 on: April 04, 2009, 08:37:54 AM »
you could store those times in some result table
lets say

position player section1time s2time s3time total
...

and then you have some result.php?race=101
where 101 is ID of that race so at the end of that race you send message to players with something like that:

Hello,
you finished 1st.
View results <a href=result.php?race=101>here</a>

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #21 on: April 04, 2009, 09:41:42 AM »
OK, that's what I thought you meant but just wanted to make sure.

I'm getting closer!

Offline Caesium

  • Level 4
  • *
  • Posts: 14
  • Reputation: +0/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #22 on: April 19, 2009, 07:04:19 PM »
I would highly suggest you picking up a book called "AI Game Programming Wisdom".  Chapter 9 in that book is all about writing AI algorithms for a racing game.

http://introgamedev.com/resource_aiwisdom.html
« Last Edit: April 19, 2009, 07:07:58 PM by Caesium »

Offline cdoyle

  • Level 11
  • *
  • Posts: 67
  • Reputation: +1/-0
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #23 on: December 09, 2009, 05:35:49 PM »
Hi again,

It's been a long time since I posted here,  but been redoing my script some.
I noticed that I never really took into account the top speed of the car when I first began doing this.

So trying to rewrite it, so the cars can't go faster then their top speed.

but getting hung up on something,  I must just not be calculating it right.

Say we use these numbers

a=3.5
s=2500
v=?

So in trying to find V
v2-0=2*3.5*2500   =>   V=132
132=0+3.5*t    =>    so V/A 132/3.5 would give us 37.7 seconds  (am I right so far?)

but!!
since the top speed of the car is 110.
would V = 110?

so I thought I would just change my second calculation
110=0+3.5*t    =>    so V/A  110/3.5 would give us 31.1  seconds...  No wait,  that's not right.  It should be taking him longer to complete the section, not less.

So where am I messing up on my calculation?



Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Want to create a racing script, but stuck.
« Reply #24 on: December 09, 2009, 05:49:37 PM »
I have no clue what these symbols and numbers are about but this can be done this way:

newspeed=min(currentspeed+acceleration*time,maxspeed)

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal