Devlog #49-50 - Asset System-NEW system, *Game Design* -construction costs update - LoanSystem- fix-redesign-upgrade,Bug fixes-storeSystem,AutoAdvance Day, Market system, Truck System cost redesign, refactored, Ui bug fixes
****AssetSystem-created and fully implemented,Upgraded LoanSystem, fixed bugs,storeSystem, MarketSystem(classified game design hah).TruckSystem balanced fuel consumption, extra costs-crosscity, fixed major bug with assigning product, Balancing products prices and other stuff in excel****
AssetSystem Design: Using more less the same structure that we used before. So we assign the variable values to each of the assets ,buildings, money etc. then we go through them all each turn and calculate their total value.That was theoriginal idea, and it did work, so in the accounting tab it shows total assets. perfect!
But, I thought ok, what if i wanna know exactly which assets i have, like, what percentage of assets is cash, or goods that i have in warehouses or stores? or industry assets? So then instead of having a single list of values which would be in the main WorldManager, i made a struct that is contained in the list with needed values. For example:
And other assets and later will be added. So in essence, we go through all the subdivisions products in each store and in each cityy/warehouse, each truck, then we simply assign the values to each of these categories.
if we are going through store , we say for example: AssetState.TotalstoreAssets += store.assetValue;
Then we create a snapshot of those values so we can later make very detailed asset report, like, which percentage of all assets is ,cash, products etc as we already cleared.
This is called at the end of the tick, that after all is calcualted and sold/purchased, it can give us a clear and accurate data. Otherwise, if it would be earlier in the tick, then the values would never be accurate.
Here it is Accounting tab with assets now.
__________________________________________________________________________
LoanSystemFix- This one took surprisingly long to fix... Anyhow, the issue, first was introducing the maxLoanAmount, because earlier it was perfectly working, but the player could spam loans, and even if i would say ok max Loans is 3 , it would not fix anything, first, becuase it seems like a bad game design, seems artificial. So then i thought ok, I want to limit it to the size of the company, (and that is why this redesign was waiting for the assetSystem to be done) , so now we can say ok, you can take the loan in the maximum amount of for example 2x the total assets of the company. This way, it limits and makes it more realistic and stops the max spam of the Loans.
So first was restructuring,
Problem 1: The previous loans list as we had it up, activeLoans.Count was a list in WorldManager, which has no other values other then list of structs for each loan. But same way we solved assetSystem, basically , we moved the list onto new state, (struct), which is bankState, which contains information as how many loans, what is the maximum Loan amount, etc... and it also contains the list of the active loans. Easy right? haha naah.
Then after changing this, the testing begun. And the hours passed by...hours..
Basically, main isuse was , how does one calculates assets with cash, because, for exmaple:
1. Player takes a Loan, assets are 100k , loan =200k (for example)
2.Next turn playes has 200k cash, he goes to take another loan, and now he can take 600k :D
see the problem? Because the totalAssets are calculating the cash as assets too..
So what I have tried : Idea 1 : Deducting the current debt from the assets so the assets are TotalAssets - Debt, i should result the right asset amount and limit it. But didnt work,because if in the same turn player takes the loan, the debt does a double calculation basically, and he cant take any more loans, because its deducted 2 times, or more.. It was pointless to try to fix this, wasted lot of time.
Idea 2: I make another total Loan variable within the bankState that contains all the loans so the player cannot take more loans (basicall this calculates all the loans plyaer took, ) which is great concept, but agani, same issue, the debt being reducted from the assets still makes the same issue, its not accurate. So then, I was trying more ideas, like, maybe i should change the whole logic of how the assets are calculated, in which the cash is not a part of assets, but rather totalAssets /cash Assets :D
Naah, took some time off, and then it hit me, create another variable, within the assetState, which is called 'totalRealAssets', then limit it with mathf.Max, so it can only be either 0 , or in + . And then, use that variable to calculate the max amount of loan that player can take. And , the best part, that is calculated eachtime the method is called, so if a player wants to take 2 loans, the method is called, then adjusted, updated,and shows the remaining amount of money.
Works!
the last thing was fixing the issues like from the idea 2, totalLoan should deduct the loan if repayed early, because if not, after repaying the loan play cant take much more loan because that variable still thinks the loan is taken. If that makes sense. bug..
So in essence,
1. take a loan
2. add that amount ot the bankState totalLoans taken
3. recauclate total loan and assets
4. if (repay the loan per day ) | remove daily money from the bankstate totalLoansTAken
if (repay whole loan) remove whole cash from it.
Another important thing , the calculation for max loan is both of these variables. so we calculate totalRealassets (which is assets - debt) - totalLoansTaken. So then we have it accurate.
_______________________________________________________________________________
TruckSystem - cost system redesign: !! SPOILER ALERT!! -if you wanna play the game dont read this stuff.
The problem was, the fuel cost was too realistic because it was based upon the distance of the industryo to the city. but, my mistake was that i calculated only one direction, not takin in acount, hub > industry > store >hub , or traffic etc..but since its all UI, then we have to make it more fun. Same way as previously said in the devLog about truckSystem, is how we calcualte crossCity and how we calculate within the same city. Basically the change included rebalancing the costs to be more realistic and impactful, so the player would think what pays out the best, so long distance and long term SEMI is way cheaper then the pickup, and pickup is good for local goods, because of fuel consumtpion and capacity.
Another thing that was added and its realistic! Is loading cost, so while the truck is being loaded it runs, and spends fuel, so like 10$ loading cost for pickup, 20,30 for others. This way the transport cost and fuel cost plays more important role in everything, rather then just being a small insignificant number.
Major BUG that took so much of my life(but still love it), was that the truck wasn't properly assigned the destination, source location. Actually, the ProductType was not assigned from those industries. So the truck would have totally wrong data and capacity that calculated the cost. Because the cost is not only how much goods it can have but also how many goods are in the truck which affects the fuel consumption. This way, the truck was halfway full, and the expenses were at the max. Issue? Loading the wrong ProductType and enum Type NONE, which had some other random values..no one knows why..👀😁
________________________________________________________________________
Day auto Advance - This is a new concept, that is stil being refined, but basically, one turn = 1 day, calculates and displays the result, but what if a player wants to wait it out, or let it run for a while, one would have to press the nextDay constnatly, this way, you press 'space' nextDay, press 'shift+space', and you get auto next day untill you stop it. Then after each turn the turn summary pops up (still in development) but in this case it should show all the result for previous turns.
______________________________________________________________________
FPS limit to 60fps. My macbook was melting running at 350fps, for what? a static Ui..so yeah, limited, but i will allow in the settings later changes, if anyone wants and thinks its needed.
________________________________________________________________________
MarketSystem had a medium overhaul, related to the cost of the goods, when i was balancing, so each product is balanced now by me, and before they used the universal algorhythm, but it was good for cheap products, for more expensive not.. but unfortunatelly i cant share this, because this is the core, and if anyone reads this it would totally spoil the game :D
Aah yes! Very importnat change in the design : The value of each upgrade and construction in each city, depends on the amount of population, average salary etc. So in the poorer cities is cheaper to build office/and other things, in more expensive its more expensive. Its all dependable.(This is not yet finished, only testing it with stores) thats why i wrote storeSystem upgrade. This will be implemeneted for everything. So if a player wants to open office and shop in a more expensive city, well...its gonna cost hahah
Thank you!!!
Comments
Post a Comment