User Tools

Site Tools


gamemanual:gm_racing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gamemanual:gm_racing [2022/06/07 14:31] – [Racing Points] admingamemanual:gm_racing [2022/06/08 02:30] (current) – [Variables] admin
Line 1: Line 1:
 +======= Racing Game Mechanics =======
  
 +
 +The Game Mechanics section of the manual details the internal formula used in the game's calculations.  This section of the manual uses pseudo-code and may not be 100% the same as the code in the game. 
 +
 +The Game Mechanics part of the manual is mainly designed to be a reference for the frequently asked question, "Why do I get this rating when I do X, Y, Z?!" Usually, this answer involves many different variables, which this section of the manual demonstrates. 
 +
 +**The game mechanics section of the manual shows [[https://idioms.thefreedictionary.com/seeing+how+the+sausage+gets+made|how the sausage gets made]]. So you really may want to avoid this portion of the manual if you enjoy the game.** 
 +
 +
 +====== Variables ======
 +
 +^ Name ^ Description ^ ^ Name ^ Description ^
 +| **EngineeringEmployees** | The number of engineers you have | | **MaxEngineeringEmployees** | The number of engineers you need |
 +| **Morale** | Engineering employee morale | | **RacingSeries_EndTurn** | Last turn of a series season |
 +| **RacingSeries_StartTurn** | The first turn of a series season | | **RacingSeries_races** | Number of races in a season |
 +| **RacingSeries_FundingMod** | Modifier variable for how expensive this series is to run | | **NumberOfTeamsInSeries** | Number of teams racing in the series |
 +| **orgRacesMonth** | Races per month | | **RacingTeam_Funding** | Race Team's budget |
 +| **RacingTeam_Driver_Quality** | Race team's driver quality slider | | **RacingTeam_Team_Quality** | Race team's team quality slider |
 +| **RacingTeam_TeamGrowthFocus** | Race team's team growth focus slider | | **RacingTeam_TeamSizeFocus** | Race team's team size focus slider |
 +| **RacingTeam_winFocus** | Racing Team's Win Focus slider | | **RacingTeam_victories** | Racing Team's wins for the month in this series. |
 +| **RacingTeam_Car_Spec_AccellerationSix** | Vehicle's 0-60mph acceleration in seconds | | **RacingTeam_Car_Spec_Weight** | Vehicle's weight in KG |
 +| **RacingTeam_Car_Spec_HP** | Vehicle's Horsepower | | **RacingTeam_Car_Rating_Drivability** | Vehicle's drivability rating  |
 +| **RacingTeam_Car_Rating_Performance** | Vehicle's performance rating | | **RacingTeam_Car_Spec_TopSpeed** | Vehicle's top speed in MPH |
 +| **RacingTeam_Car_Rating_Fuel** | Vehicle's fuel economy rating | | **RacingTeam_Engine_HP** | Engine's Horse Power |
 +| **RacingTeam_Engine_Weight** | Engine's weight in KG | | **RacingTeam_Engine_Dependability** | Engine's Dependability rating |
 +| **RacingTeam_Engine_FuelConsumption** | Engine's fuel consumption in MPG | | **ex_1d02p_year99** | 1.02%%^%%(year-1899) |
 +| **ex_1d03p_year99** | 1.03%%^%%(year-1899) | | **ex_1d06p_year99** | 1.06%%^%%(year-1899) |
 +
 +
 +
 +====== Racing Contracts ======
 +
 +See: [[gamemanual:gm_contracts#generate_racing_contracts|Contracts: Racing Contracts]].
 +
 +
 +
 +====== Racing Results ======
 +
 +===== Racing Score =====
 +
 +<code cpp>
 +
 +EngineeringEmployeeMod = 0.5+0.5*((EngineeringEmployees/MaxEngineeringEmployees) * (Morale/100))
 +
 +For Each Series:
 +{
 +
 +        lengthOfSeries = RacingSeries_EndTurn - RacingSeries_StartTurn
 +
 +        if(Turn = RacingSeries_EndTurn)
 +        {
 +            RacesPerMonth = RacingSeries_races%lengthOfSeries
 +        }
 +        else
 +        {
 +
 +            if(lengthOfSeries != 0)
 +                RacesPerMonth = RacingSeries_races / lengthOfSeries
 +            else
 +                RacesPerMonth = 1
 +            
 +        }
 +
 +
 +        minBudget =  (5000*ex_1d03p_year99)+(15000*RacingSeries_FundingMod*ex_1d06p_year99)
 +        maxBudget = (25000*ex_1d03p_year99)+(75000*RacingSeries_FundingMod*ex_1d06p_year99) + minBudget
 +
 +
 +    For Each Team in Series:
 +    {
 +
 +
 +        Team_Funding = ((RacingTeam_Funding)/(maxBudget))*2
 +
 +        RacingTeam_RaceValue = (20+Random Number Between ( 0 AND 5)) *
 +            (Team_Funding-((RacingTeam_Driver_Quality*2 + RacingTeam_Team_Quality +
 +            RacingTeam_TeamGrowthFocus + RacingTeam_TeamSizeFocus*1.5)/5.75)) * EngineeringEmployeeMod
 +
 +
 +        if(RacingTeam_Car_Spec_AccellerationSix == -1 || RacingTeam_Car_Spec_AccellerationSix > 26)
 +            RacingTeam_Car_Spec_AccellerationSix = 26
 +
 +        if Supplying Vehicles
 +        {
 +            if(RacingTeam_Car_Spec_Weight != 0)
 +                hpWeightRatio = (RacingTeam_Car_Spec_HP)/(RacingTeam_Car_Spec_Weight)
 +            else
 +                hpWeightRatio = 0
 +
 +            if(hpWeightRatio > 2)
 +                hpWeightRatio = 2
 +
 +            hpBonus = (RacingTeam_Car_Spec_HP^1.15) /(10.0 * ex_1d02p_year99) 
 +
 +            RacingTeam_RaceValue = RacingTeam_RaceValue + (hpBonus*3.5) +
 +                (hpWeightRatio*10  + ((25-RacingTeam_Car_Spec_AccellerationSix)/25.0)*30 +
 +                ((RacingTeam_Car_Rating_Drivability) / 100.0)*36 +
 +                12*((RacingTeam_Car_Rating_Performance) / 100.0) +
 +                30*((RacingTeam_Car_Spec_TopSpeed)/250.0) +
 +                (3 * (RacingTeam_Car_Rating_Fuel/100.0)) )
 +
 +        }
 +        else if Supplying Engines
 +        {
 +            hpWeightRatio = ((RacingTeam_Engine_HP) / (RacingTeam_Engine_Weight))
 +
 +
 +            if(hpWeightRatio > 10)
 +                hpWeightRatio = 10
 +
 +            hpBonus = (RacingTeam_Engine_HP)  / (8.0 * ex_1d02p_year99)
 +
 +            RacingTeam_RaceValue = RacingTeam_RaceValue + hpBonus*3.5 + ( hpWeightRatio*5  +
 +                ((RacingTeam_Engine_Dependability) / 100.0)*(3 * ex_1d02p_year99) +
 +                ((RacingTeam_Engine_FuelConsumption/30.0)*2))
 +
 +        }
 +        else Supplying Funding
 +        {
 +            RacingTeam_RaceValue = RacingTeam_RaceValue + Random Number Between ( 0 AND 10) +
 +                4.5  * (RacingTeam_TeamGrowthFocus - RacingTeam_TeamSizeFocus) + 15 *
 +                (Team_Funding*2-RacingTeam_Driver_Quality + RacingTeam_Team_Quality)
 +
 +        }
 +
 +        RacingTeam_RaceValue = RacingTeam_RaceValue + ((10+Random Number Between ( 0 AND 10)) *
 +            ((RacingTeam_Driver_Quality*3.5 + RacingTeam_Team_Quality +
 +            RacingTeam_TeamGrowthFocus + RacingTeam_TeamSizeFocus*1.5)/5.0) *
 +            (Team_Funding/1.75))*EngineeringEmployeeMod
 +
 +        RacingTeam_RaceValue = RacingTeam_RaceValue +(40 * RacingTeam_teamXP) +
 +            (3 * RacingTeam_teamSize) + (10*RacingTeam_winFocus)*EngineeringEmployeeMod
 +
 +
 +        Total_RaceSeries_RacingValues = Total_RaceSeries_RacingValues + RacingTeam_RaceValue
 +    }
 +}
 +
 +
 +</code>
 +===== Race Winners =====
 +
 +<code cpp>
 +firstVal = 0
 +secondVal = 0
 +thirdVal = 0
 +forthVal = 0
 +fifthVal = 0
 +
 +For Each Team in Series
 +{
 +    For Each Team In Series 
 +    {
 +        if(firstVal < RacingTeam_RaceValue)
 +        {
 +            victorID = RacingTeam_CompanyID
 +            firstVal = RacingTeam_RaceValue
 +        }
 +        else if(secondVal < RacingTeam_RaceValue)
 +        {
 +            secondID= RacingTeam_CompanyID
 +            secondVal = RacingTeam_RaceValue
 +        }
 +        else if(thirdVal < RacingTeam_RaceValue)
 +        {
 +            thirdID= RacingTeam_CompanyID
 +            thirdVal = RacingTeam_RaceValue
 +        }
 +        else if(forthVal < RacingTeam_RaceValue)
 +        {
 +            forthID= RacingTeam_CompanyID
 +            forthVal = RacingTeam_RaceValue
 +        }
 +        else if(fifthVal < RacingTeam_RaceValue)
 +        {
 +            fifthID= RacingTeam_CompanyID
 +            fifthVal = RacingTeam_RaceValue
 +        }
 +
 +     }
 +     
 +     firstWins = ((firstVal/winsVal) * RacesPerMonth)
 +        RacesPerMonth = RacesPerMonth - firstWins
 +    secondWins = ((secondVal/winsVal) * RacesPerMonth)
 +        RacesPerMonth = RacesPerMonth - secondWins
 +    thirdWins = ((thirdVal/winsVal) * RacesPerMonth)
 +        RacesPerMonth = RacesPerMonth - thirdWins
 +    forthWins = ((forthVal/winsVal) * RacesPerMonth)
 +        RacesPerMonth = RacesPerMonth - forthWins
 +    fifthWins = ((fifthVal/winsVal) * RacesPerMonth)
 +        RacesPerMonth = RacesPerMonth - fifthWins
 +
 +    if(RacesPerMonth > 0)
 +    {
 +        firstWins = firstWins + (RacesPerMonth/2)
 +            RacesPerMonth = RacesPerMonth - (RacesPerMonth/2)
 +        secondWins = secondWins + (RacesPerMonth/2)
 +            RacesPerMonth = RacesPerMonth - (RacesPerMonth/2)
 +        firstWins = firstWins + RacesPerMonth
 +
 +        RacesPerMonth = 0
 +    }
 +     
 +}
 +
 +</code>
 +===== Racing Points =====
 +
 +<code cpp>
 +
 +For Each Team In Series:
 +
 +RacingTeam_Points = (RacingTeam_victories * 6 *
 +    (NumberOfTeamsInSeries)) + (orgRacesMonth - RacingTeam_victories) * 
 +    ((NumberOfTeamsInSeries * 10) * (RacingTeam_RaceValue/Total_RaceSeries_RacingValues))
 +    
 +</code>
 +
 +
 +===== Team XP =====
 +
 +<code cpp>
 +TeamXP = TeamXP + (((0.75 - RacingTeam_Driver_Quality) + (0.75-RacingTeam_Team_Quality)+
 +    (RacingTeam_TeamGrowthFocus-0.5)+(0.5-RacingTeam_TeamSizeFocus)+
 +    (1-RacingTeam_winFocus))/300.0)
 +</code>