basecost mathematics

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
Twyster
Engineer
Engineer
Posts: 92
Joined: 22 Feb 2013 00:46

basecost mathematics

Post by Twyster »

Well, I've run into another problem. At least this one is simple.

From here: http://newgrf-specs.tt-wiki.net/wiki/NM ... base_costs
Each cost in-game is determined by a fixed factor multiplied by a base cost. Setting base cost to 0 leaves this cost unchanged. Incrementing it by one doubles the cost, so e.g. a setting of 3 results in a cost that is 8x higher. Setting a negative value reduces the cost in the same manner, e.g. a value of -4 results in 1/16th of the cost. The minimum and maximum values are -8 (1/256th) and 16 (65536x), respectively.
From here: http://newgrf-specs.tt-wiki.net/wiki/NM ... grflocal-1

Code: Select all

Identifier            | Category         | Default value	
PR_BUILD_VEHICLE_ROAD | PR_BUILD_VEHICLE | 14000
I'm confused. Where does 14000 come into it? It can't be the base cost because a truck with "cost_factor: 10" is 410 pounds (the default currency). The math literally doesn't add up. What am I missing?

Thanks in advance!
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: basecost mathematics

Post by Eddi »

the formula is:

(base value) * 2^(base cost) / 2^16 * (difficulty factor) * (price factor)

14000 * 2^8 / 2^16 * 0.75 [low] * 10 = 410

difficulty factors for medium and high are 1 and 1.125, respectively.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 18 guests