Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserted a new formula for calculating item_cost, fixing issue #117 #118

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

jwalt333
Copy link

I've created a new formula to calculate the cost of items, the new formula is:

base_cost^(1 + ((amount + 1) * 0.0075)^2) * (amount + 1)

The old formula slowly decreased the amount added to the new cost when more and more items of the same type were bought, so that the price gap between the 4,999th and 5,000th item was 0.04% as opposed to the increase between the 1st and 2nd item, which is generally more than 150%. Long story short, currently, if people were to buy enough of one item, they would eventually reach a point where there would be no change in price.

With the new formula, the price jump for the first few items is about 100%, 50%, 33%, 25%, and so on for about the first 30 items (reaching a min of about 3.7%) this is due to the last ' ... * (amount + 1)' which causes the large price jump in a way similar to the original formula, after the first 30 items, the main part of the new formula kicks in and we start to see a slow exponential increase, this means that users will never reach the point of "I can buy everything, yays".

So yeah, bitches.

I've added more multipliers (2, 4, 8, 16) that increase the cost of an item depending on the amount (10, 100, 1000, 10000) owned.

I've added the same multipliers to the resale function to maintain the games balance.

This addition should help balance the game economy during late game-play, the multipliers chosen are fairly arbitrary.
Previous commit contained logic errors for determining the last item cost.
Left 2 brackets that should have been deleted in my last commit, just deleted them.
New formula gradually increases the price increment, where as the previous formula decreased the increment. Users will be able to buy more early on, but will find it increasingly difficult to buy new items as they progress.
@DaGeek247
Copy link

How does this affect current game play? I have five thousand sleazy lawyers, can i sell them all now and gain more money then I payed for them, or do i sell them, get back the original price method, and buy them again with the new price method?

@jwalt333
Copy link
Author

Ummm, @DaGeek247, if you read my update, I'm not too sure how it would affect you as the new formula will make it nearly impossible to buy that many lawyers. Selling and re-buying wouldn't be in your interest as you'd make massive losses, but selling alone would be of short term benefit.

@DaGeek247
Copy link

So I could sell them for short term benefit, but trying to do it twice would incur major losses. Got it.

The largest possible number in Javascript is about 1.797e+308, this is the constant Number.MAX_VALUE, anything beyond this is simply identified as infinite. The inserted code checks if get_item_last_cost equals infinity, and if it does, it changes the cst value to Number.MAX_VALUE.

This will hopefully help avoid a lot of butthurt from the new formula being introduced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants