Devlog #53 - BIG UPDATE - Refactoring Industry, introducing new Products - UI ICONS ! replacement with real icons from online store. Summary Turn Added -new system, And Bug fixes...
******BIG UPDATE**** -Added new products for futher dev, after the initial 6, UI ICONS replaced by real icons, and not using windows/mac icons anylonger. turnSummary System added, bug fixes********
UI ICONS - Instead of original windows/mac icons that were placeholers actually, i replaced them from the website flaticons. So now, each product can have destinct icon but more importantly, it would be the same on mac and windows.As well as it is way more beautiful , same goes for Sidebar icons, mail icon, and will later do money icons. But for now, the products and those most visible icons are changed.
For example : Before and after:
| Before and After |
Much better!? Also, the macbook icons were much nicer tbh, then windows ones, but this, its universal,also less generic. Thing is, I might still adjust this, but just an idea!
Technical side :
First approach : It was naming them within the code, and then wrigint the exact name/location etc. Technical side :
Second approach/solution: But then i thought ok, i think its way better if each product, since if you remember. There is only one productDatabase, that is ordered by enum values, that is universal throught the game, there is no second place, also in case I wanna change icons, I can just replace the sprite, .. yeah. sprite, so basically in productData just added the public Sprite icon; And loaded it there. SO when i call it within the code, i just write productDatabase.allProducts[index].icon;
Simple!! Yet effective.
And yes, as far as game design, original idea was 20 products, all together.. which comes down to
6 for tier 1-2 city, 4 for tier 3, 4 for tier 4, 3 for tier 5, 3 for tier 6. They all get unlocked once the city gets to that tier. Thats it. The original idea stayed..I think its a nice balance.
Why 6 for tier 1-2? because the cities start with 2 random ones basically, and then by the end of tier 2, they have another 2. so each city has 4, which is assigned differently per city. Also, tier 3, has 2 per city, but they are mixed around among cities.
(prone to change when the balancing and testing comes..)
_________________________________________________________
_____ INdustry products , basically all the products you have seen above, with new icons, but only this that each product contains balancing data.. tons of freaking data.. which i tried to balance out now,but the real balancing comes when the game is finished ( IF hahah) . And the next step in this is, adding an array wiht the necessary products, or list, not sure which way i will go, but array because the store uses the same for the product info, like, soldAmount, current price, etc..
- TURN Summary System - New System, idea is after the turn is over, the turn summary pops up and shows the changes , earnings , expenses for the last day.. I was actually considering this for a long time, but, i wasn't sure if it will be worth it, except in case when there is a speedup for few days, in that case the shown and calculated change could be more informative then each day. Which begs also the question, does the game needs a week skip? ...We will see.. Anyohw, how this works? Awesomely!
Basically, snapshots! yeah, your favourite stuff!
So we take snapshot after each day and display it. But since the snapshot has to take information like eaarnings and expenses, tax paid etc per each day, we already have those information from before! PRoblem is they are on other snapshots / lists . There is no other place the values are actually saved. For example, everything financial, except the current cahs, is calculated in the financeSystem, and then saved in snapshots, for each day, per day, and then displayed in the UI, charts etc..
In the same way, now we can get that information, but we have to go within those snapshots and then match the turn number we are looking for, match the information we need, then pull it out. Yeah, its not really simple, but its better then calculating it all again , so even though this isnt at all performance issue ,i still would like to have it otpimised as much as possible and not repeat if it doesnt need to be. So for example:
___________________________________________________________
As always there were bugs, but i didn't write them all down, and now trying to find them all i only found the ones i actually wrote down, which were in a way game breakers
it doesnt seem as important, but once you try to figure out where the money is bleeding and why, good luck! hahah
Also Ui bugs, market dont refreshing at the start bug,showing 0 prices, then global market calculating 0 because of the previous turn and average price calculation, then industries inhereting the same issue, and then , giving away free goods for the player! yay!
ISSUE? Freaking average salary was not loaded yet. because the cityUpdate that updates the salary was updated after, so when the market and prices were calculated, the price was 0 because the average saalry was 0 :D Yeah, this was very frustating!!
Thank you!!!
Simple!! Yet effective.
And yes, as far as game design, original idea was 20 products, all together.. which comes down to
6 for tier 1-2 city, 4 for tier 3, 4 for tier 4, 3 for tier 5, 3 for tier 6. They all get unlocked once the city gets to that tier. Thats it. The original idea stayed..I think its a nice balance.
Why 6 for tier 1-2? because the cities start with 2 random ones basically, and then by the end of tier 2, they have another 2. so each city has 4, which is assigned differently per city. Also, tier 3, has 2 per city, but they are mixed around among cities.
(prone to change when the balancing and testing comes..)
_________________________________________________________
IndustrySystem refactoring - This one is quite complex, similar to truckSystem but this is because of different structures needed to work together.
Why this is important? Because I am still in the proces of writing the industries that are player owned, that have input and output, recepies blueprints etc.. for now, this is all working towards that. The issue now is that the industrySystem is chaotic, even though i refactored and changed the structure many times, there is still an issue, but now its better.
So in essence, let me break it down:
With Office, Hub, Store.. its simple because, we have one type of store, and then we have a storeType/hubType. Database which is essentially a scriptable object that has different types of office. This was earlier in devlog, but we have to repeat it to better undeesatnd this. Officetype database is , small office, medium office big office..
For industries, we have the same, small industry, medium industry, big industry ( with different names of course), and there it holds the information about max workers, production capacity, warehouse size efficiency per worker ,construciton cost, upgrade time.. But at the same time, we also have another list, which is IndustryType,which is bread, coffee, vegetables etc.. Some is farm, some is bakery, some is whatnot, which has all the placeholder values for those information plus, each product has its own values, which is taken from productDatabase. So without creating a mess (which already is really hard to keep all in my mind) , in essence is this.
ProductDatabase, together with industryType wotks for base production value,base cost multiplier ( which basically says which factory costs how much per product, because its not the same bakery, and microprocessor chip factory haha) etc..at the same time, industryTier has to give data like maxWorkers, efficiency perWorker, warehouse capacity, upkeep costs, construciton cost, upgrade...
So yeah, thisis now way more organized then it was. But , when i do find a better solution, and probably i will have to, once the blueprints and input output are there, then i will do another rafctor...
So in essence, let me break it down:
With Office, Hub, Store.. its simple because, we have one type of store, and then we have a storeType/hubType. Database which is essentially a scriptable object that has different types of office. This was earlier in devlog, but we have to repeat it to better undeesatnd this. Officetype database is , small office, medium office big office..
For industries, we have the same, small industry, medium industry, big industry ( with different names of course), and there it holds the information about max workers, production capacity, warehouse size efficiency per worker ,construciton cost, upgrade time.. But at the same time, we also have another list, which is IndustryType,which is bread, coffee, vegetables etc.. Some is farm, some is bakery, some is whatnot, which has all the placeholder values for those information plus, each product has its own values, which is taken from productDatabase. So without creating a mess (which already is really hard to keep all in my mind) , in essence is this.
ProductDatabase, together with industryType wotks for base production value,base cost multiplier ( which basically says which factory costs how much per product, because its not the same bakery, and microprocessor chip factory haha) etc..at the same time, industryTier has to give data like maxWorkers, efficiency perWorker, warehouse capacity, upkeep costs, construciton cost, upgrade...
So yeah, thisis now way more organized then it was. But , when i do find a better solution, and probably i will have to, once the blueprints and input output are there, then i will do another rafctor...
_____ INdustry products , basically all the products you have seen above, with new icons, but only this that each product contains balancing data.. tons of freaking data.. which i tried to balance out now,but the real balancing comes when the game is finished ( IF hahah) . And the next step in this is, adding an array wiht the necessary products, or list, not sure which way i will go, but array because the store uses the same for the product info, like, soldAmount, current price, etc..
[Header("Product - needed resources")]
public IndustrySlotState[] industryResourceNeeded;
- TURN Summary System - New System, idea is after the turn is over, the turn summary pops up and shows the changes , earnings , expenses for the last day.. I was actually considering this for a long time, but, i wasn't sure if it will be worth it, except in case when there is a speedup for few days, in that case the shown and calculated change could be more informative then each day. Which begs also the question, does the game needs a week skip? ...We will see.. Anyohw, how this works? Awesomely!
Basically, snapshots! yeah, your favourite stuff!
So we take snapshot after each day and display it. But since the snapshot has to take information like eaarnings and expenses, tax paid etc per each day, we already have those information from before! PRoblem is they are on other snapshots / lists . There is no other place the values are actually saved. For example, everything financial, except the current cahs, is calculated in the financeSystem, and then saved in snapshots, for each day, per day, and then displayed in the UI, charts etc..
In the same way, now we can get that information, but we have to go within those snapshots and then match the turn number we are looking for, match the information we need, then pull it out. Yeah, its not really simple, but its better then calculating it all again , so even though this isnt at all performance issue ,i still would like to have it otpimised as much as possible and not repeat if it doesnt need to be. So for example:
TurnFinancialSnapshot snapshot = GetFinancialSnapshot(wm);
int populationGainedToday = GetTotalPopulation(wm);
var turnSummarySnapshot = new TurnSummarySnapshot
{
turnNumber = wm.currentTurnNumber,
totalRevenueToday = snapshot.revenue,
totalExpensesToday = snapshot.expenses,
totalDebtPaidToday = snapshot.loanExpense,
totalProfitToday = snapshot.revenue - snapshot.expenses,
populationGainToday = populationGainedToday,
};
So we get the financial snapshot, from the list of snapshots, then just create a new turnSummary snapshot in which we insert those values.
TurnFinancialSnapshot snapshot = default;
for (int s = 0; s < wm.financialHistory.Count; s++)
{
snapshot = wm.financialHistory[s];
if (snapshot.turnNumber == wm.currentTurnNumber)
{
break;
}
So here is how we get it, and this example is for financial only, population is another beast. Anyhow,
The real beauty comes when we want to get this information!!
So , lets say, you want for a day, awesome, get the turnNUmber match it to last turnNUmber, and done you have the info..
The real beauty comes when we want to get this information!!
So , lets say, you want for a day, awesome, get the turnNUmber match it to last turnNUmber, and done you have the info..
But, what if you speed up the time and you want to have after 5-10 days all the changes together?
well yes! Here it how it goes.
WE make another list! hahah, so when the method is called, to give the information wether it is 1 or 5 days, it doesnt matter. Becuase once the method is called to display, it says, ok how many days have passed? - 5? go into the list of all the turnSUmmaries per day, then get the last 5 and combine them togehter in a new list! then, take those data and add to the data then creae another new turnSummary(single struct) and then display those data. Makes sense?
well yes! Here it how it goes.
WE make another list! hahah, so when the method is called, to give the information wether it is 1 or 5 days, it doesnt matter. Becuase once the method is called to display, it says, ok how many days have passed? - 5? go into the list of all the turnSUmmaries per day, then get the last 5 and combine them togehter in a new list! then, take those data and add to the data then creae another new turnSummary(single struct) and then display those data. Makes sense?
So in essence, we say, we need 5 last days? We go to the list, filter out 5 days, by adding it to the new list, then take that new list with 5 days, create another summaryTurn struct , and go through that list of 5 chosen days, and just add to the values of the new turnSummary, and display that!
Beatiful right!?? FOr someone this is simple, but it took me a bit to actually think of this.
Beatiful right!?? FOr someone this is simple, but it took me a bit to actually think of this.
this is the end example:
//kreiranje novog Spanshot-a, koji ce da se prikaze u Ui-ju na kraju jednog ili vise turn-ova
TurnSummarySnapshot turnSummarySnapshot = new TurnSummarySnapshot();
for (int s = 0; s < newHistory.Count; s++)
{
turnSummarySnapshot.populationGainToday += newHistory[s].populationGainToday;
turnSummarySnapshot.totalRevenueToday += newHistory[s].totalRevenueToday;
turnSummarySnapshot.totalExpensesToday += newHistory[s].totalExpensesToday;
turnSummarySnapshot.totalDebtPaidToday += newHistory[s].totalDebtPaidToday;
turnSummarySnapshot.totalProfitToday += newHistory[s].totalProfitToday;
}
return turnSummarySnapshot;
Its ok! Pretty , but nothing wow, but i made sure to add the switch in case one doesnt want each turn to have to press continue..
___________________________________________________________
Another Ui optimisation, color tokens, so instaed of having each text within the code , coded direclty which is an issue if i wanna change font color, then i have to find it in code and change in 50 places..So the refactoring was done, new file, that contains all the text colors, and then the display just gets the color from here based on the type:
Another Ui optimisation, color tokens, so instaed of having each text within the code , coded direclty which is an issue if i wanna change font color, then i have to find it in code and change in 50 places..So the refactoring was done, new file, that contains all the text colors, and then the display just gets the color from here based on the type:
public static readonly Color Slate200 = new Color(226f / 255f, 232f / 255f, 240f / 255f);
public static readonly Color Slate300 = new Color(203f / 255f, 213f / 255f, 225f / 255f);
public static readonly Color Slate400 = new Color(148f / 255f, 163f / 255f, 184f / 255f);
public static readonly Color TextPrimary = Slate900;
public static readonly Color TextSecondary = Slate500;
public static readonly Color TextMuted = Slate400;
btn.style.color = UIColorTokens.TextPrimary;
___________________________________________________________
As always there were bugs, but i didn't write them all down, and now trying to find them all i only found the ones i actually wrote down, which were in a way game breakers
it doesnt seem as important, but once you try to figure out where the money is bleeding and why, good luck! hahah
Also Ui bugs, market dont refreshing at the start bug,showing 0 prices, then global market calculating 0 because of the previous turn and average price calculation, then industries inhereting the same issue, and then , giving away free goods for the player! yay!
ISSUE? Freaking average salary was not loaded yet. because the cityUpdate that updates the salary was updated after, so when the market and prices were calculated, the price was 0 because the average saalry was 0 :D Yeah, this was very frustating!!
Thank you!!!
Comments
Post a Comment