Devlog #43 - New Game Initialize Update , BankingSystem Update, **TAXES **. Insolvency timer, Dashboard UI
*****New game Initialize - BankingSystem Bug Fix with interest - FInally implemented taxes(althought they were writte long time ago) - added insolvency timer *****
NewGame Initialize : Problem : When starting a new game no markets, states, office, and anything would load immediatly because its all turn based, so the turn has to be "turned' haha in order to things to settle office to calculate th eworkload etc markets to give the value.
Why was this important, because , when I start the new game, and i have to next turn in order to see whats the market like, what are the prices etc. And thus, when going next turn the money is removed for upkeep purporses( player starts with few subidivisons at the begining) ;
- Solution : another Method that runs on initialize, and that doesnt trigger the turnCount or any of the charging methods, it just runs specific set of methods that update markets, office workload etc, wthout triggering any of other methods. Ths is the moment that i am very happy for being opsessive with the clean code, so then each method does its thing and because of that this was fairly easy to impelment!
public static void InitializeNewGame()
______________________________________________________________________________
BankingSystem bug, : this one was actually fun because then the loan was taken the interest was insane, and the eror rwas exactly in the code i previously posted in one of the devLogs..
that 100. was the key, otherwise, the interest that is later multiplied by the amount, ( so logically the interest is lets say 5-10%). but we multiply a loan of lets say 1000$ . 1000 * 10% doesnt work, it would work if the 1000/ 100 * 5 then , take original 1000 and add the first 50 calculated. But the easier way is to shorten tha tprocess and divide imediatly by 100 , and then we get for example
5( 5%) / 100 , then multiply that with the amount of the loan.
so we say, loan = amount + amount * interestRate ( maxRate,minRate, t)/100
another bug was that the previous inverseLerp was calculating maxRate, minRate ,
(maxRate, minRate, turns);)turns, which would basically always show the minimum value for the interestRate. For example, max rate 10, min rate 4, it would always return 4, then combined with the next part ( without /100 ) the result would be , loan + loan *4 , which is 1000 + 4000 = 5000 :D 400% of interest hahahah
that was the bug, but fun one........or not...
______________________________________________________________________________
So the system is simple, calculate everything apply the tax and over. Yeah, but it wasnt that easy. Lets go back to the actual calculatin method, that is inside the FinanceSystem, which takes all events ( if you remember), and puts into revenue, or expenses.
then it calculates the amount and applies the tax for it. Simple!
Not quite.. the issue was that the tax also had to be included in the moneyEvent, and then in snapshot. So remember snapshot? now we have also tax, so we can show on the chart taxPaid on chart in the stats. yeah, i love stats hah
anyhow, then we had to introduce another MoneyEvent.taxPaid, and then calculate it only after the Tax tick.
So the order would be TaxTick, before FInanceTick. So TaxTick takes all the revenue and calculates tax and then adds to the existing if you remebember removeMoney( amount, MoneyType.tax) , then the FinanceSystem takes that into accunt and does the same calculation again for all the MOneyEvents inside the one turn, and shows it into ledger , but also takes the tax separately, so it can write it in the snapshot. See? Its tricky but nothing too hard.
But now its awesome!!!
______________________________________________________________________________
BankingSystem Loans! BUG - Loans would be taxes as well hahahahhhahaha, and also they would count as a revenue, in the account tab and system and everywhere..alos as an expense!
Yeah, couldnt be more obvious, so , if we calculate loan as an income, then we tax it, and you lose immediatly for example 10% from the loan. So the issue , now we must NOT calculate tax or actually remove it from the equation where we calculate all the revenue.. like this:
Why did we also remove the repayment? easy, if you repay the loan, and it counts as expense, then the taxes are essentially avoided, regardless of the amount of taxes you have to pay. basically, you could abuse the system of loans in order to pay less taxes :D but now what we did, we removed the loan income and repay from the calculation at all. because it wont change nothing, except the current cash, and it wont affect the arevenue, expenses nothing. Nice right???
______________________________________________________________________________
______________________________________________________________________________
Dashboard UI, althought not finished, it serves its purpose for now. ( i really want to add and i will eventally images for each city, each office, each buulding,differnet kind of vector buildings , it will be way nicer)
Its not perfect, but its the first version:
Which will have overall all cities, and what the company own, assets etc.. That will be all polished more in the balancing phase of the game, also the my favourite idea for the future maddening ( but fun) implementation will be eventSystem, that will say and warn players about certain changes or reward with achivements in inbox. But that will come way way later....
thank you!!!

Comments
Post a Comment