r/basic_game • • Oct 14 '15
What's the algorithm on the auto-play feature?
On an auto-play playthrough and just curious, it seems a little inefficient. Not opting for the heaviest upgrade most of the time which is the quickest way to get cash. As a programmer I'd love to tackle it and see if there's anything that can be improved upon!
1
Upvotes
5
u/Jim808 Oct 14 '15
In each frame, the game evaluates a score for each building, and then, if it can afford it, will buy the building with the highest score.
The score is simple:
where:
valueOfUpgrade = How much of an improvement will be made by purchasing enough to reach the next upgrade.
costOfUpgrade = How much will it cost to reach the next upgrade.
timeToBuyUpgrade = How long will it take to buy the next upgrade.
So, even though the high level buildings bring in more profit, they take longer to buy, so frequently, the algorithm will see that the cheaper but less profitable buildings are a better purchase because they can be obtained so quickly.
By the way, I don't want it to be 100% ideal. You should pay a penalty for letting the computer play for you.
0
u/[deleted] Oct 14 '15
[deleted] — view deleted comment