Hi, Im working on a small economy-based project and feeling kinda lost.
So the general idea is basically Buying and Selling things between players, and there is an algorithm in place for determining the price for said item based on the amount of buyers and sellers.
For instance, player1 wants to buy 6 units of ItemA, player2 happens to sell 10 units of ItemA.
Since there is an excess amount of ItemA units, the value of ItemA should decrease by a certain percentage.
So far i've managed to give each Item a Global Variable, a value. But im stuck on executing the calculations correctly when all the players have input their Buy/Sell values.
Is there an efficent way of doing this that I'm missing?
Ill try to elaborate a little more:
ItemA= initial value 3, per unit
Player 1: Wants to buy 6 units of ItemA
Player 2: Sells 10 units of ItemA
4 units of ItemA excess, value of ItemA should decrease by 20%. So I need to subtract 20% from the ItemA value, which is 3.
Then I need the algorithm to work proactively, if the excess of ItemA exceeds a certain amount of units, the value decrease percentage should increase.
Any kind of help would be appreciated!
Thanks