A big optimisation (and change) to customer purchasing behavior

I just made a code change today that should cause a big speed-up for late-stage large games 9with lots of cars in the showroom) and also slightly changes customer behaviour so I thought it would be worth me taking the time to explain what’s changed:

In the old version (1.52 and earlier), the code looks like this:

periodically (once a second) a bunch of customers (depending on marketing budgets) arrive at the showroom. For each customer, they analyse every car in the showroom, and give that car a score based on how well it suits their body-style desires, their budget and so-on. They build up a list of the five highest scoring cars out of all of the cars in the showroom, and then for each one, there is a chance that they will buy it, or if not, leave feedback for the showroom on why they did not buy it, which is then assigned as feedback for that car (and also counts as a ‘view’ of that car.

In the new version (1.53) the code looks like this:

As above, customers arrive at the showroom, but now instead of analyzing every car in the showroom blindly, the cars are sorted into lists of cars for each design. The customer goes along the designs, checking out the first car in each list. They then continue looping around the lists, looking at the next car in each list as they do so, until they have looked at 100 cars. Those 100 cars are then scored, the top 5 picked for giving feedback and a purchase chance.

Why the change?

Evaluating a car takes processor time, and with 100 cars in the showroom, and 100 customers, its fine, but if you have 3000 cars in the showroom, and 100 customers, then each second we do 300,000 car evaluations, which starts to add-up.
Also its totally unrealistic. Nobody really looks at 3,000 cars in a showroom, or even online, they will likely check 100 at most, and be more interested in browsing the product range (designs) than the almost identical individual cars.

99% of players will not notice the difference, but the 1% with huge custom factories and massively overstocked showrooms will and it also allows me to support even bigger factories and even more customers, which is definitely what players say they want :D. Plus all optimisation is good!

This will be in the next build of the game.

1 Like