-
Posts
48 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Monder87
-
And here is the Production Panel. he Production Panel will have the duty to : 1) Show the Product in Production, this will appear in 0AD style as a icon on top of the panel with a green layer showing the percent of progress 2) Show the Product produced and stoked by the entity with icon, name, quantity and urgency. These will be the product ready to be sell. Also from here , if you are in Manual modality you can select the product to produce by clicking on the prod icon ( first image ) 3) Show the raw material the entity can stock to produce its products, like before need to be show icon, name, quantity and urgency. ( second Image ) 4) let the User decide if want to handle the entity economic activity Manually or with Ai and maybe in the future other settings. ( third image) please let me know if you feel is intuitive or what to improve.
-
I also start visualizing the GUI ( Graphic User Interface ) to handle all Economy Activity, i start with the Consumer Panel: The Consumer Panel will have the duty to 1) show the Entity Happiness, 2) let the User decide if want to handle the entity economic activity Manually or with Ai, 3) track the products the entity carry showing icon, name, quantity, urgency and daily consume. — Consumer Panel — 1) Happiness Rating 2) Command Buttons a) Ai Consuming Manager b) Manual Consuming Manager 3)Product Stoked a) Icon b) Name c)Quantity d) Urgency Color e) Daily Consume Below you can see a prototype done in Photoshop, please let me know if you feel is intuitive or what to improve.
-
Hi everyone, i tried to put all the things we say in all Diagrams posted before in one single Economy Model Representation, so i give everyone a simpler and unified view of the Model, is just miss the products produced by each entity, so where you read produce, there will be in the future the list of products produced. Please let me know your feedback Ps. The second file is a PDF to see the model in High Resolution Economy System (2).pdf
-
If the Diagram above describe the Taxation to define how the wealth i divided in the Economy System , the Entity Power Diagram define instead the division of power. We describe Power as a Selection Capability of Slaves when we give order. I try to clarify: In 0 A.d we are used to select as a Player whatever entity we want and just pass an order to them. In this Economy Simulation instead if we select one Slave or one Farmer ( it doesn't affect Military Unit that i will leave the way they are or any other Economic Entity outside Slaves and Farmers) our selection capability is filter by ownership. Let s see the picture below and i will make some example: 1) The first on the left is the King who has the power to select all Slaves and ordering them to build 1 Civ Center or to go gather unlimited resources. He cannot order anything else if not this. So far look quite similar in the way we used to, but there is actually one important difference. Instead to make the selection like we are normally used to with the mouse dragging a square and selecting all entities inside, now we need to select first the Economic Entity in charge ( king, sacerdote, landowner Noble et..) and after keep doing with the square selection or the doubleClick. Doing like this we make sure that a slave can just follow certain order of certain Economic Entity, based on the power subdivision. For example in this example every slave will be able to build for the king the Civ Center, but not other order. 2) Now take 5 th entity : Nobles Landowner. They can order just to the slave they own to build 1 Villa or 1 Grain Farm. This is important because the slaves they will just follow the orders of their owner, and other nobles entity will be not able to use them, they will need to buy new slaves from the civ center to expand their wealth. In this way we can create a division of ownership and roles so we push the player to create all different economic entities and for each type more than just one, like in this example we need more than a noble and more than a farm if he want to achieve better economi performance. Hope this was clear, sorry if wasn t , i will try simplify all once all economic system take shape.
-
To give reason for nobles and hight rank official to exist ,be expensive to build and richer and more powerful than any other entities excluded the king, i create a Taxation System, where not just the king but also hight official in different degree take away a part of the money hardly earned by the other entities. Not nobles or official can tax all the population unless the king and the sacerdote. Of course the King tax heavier. The Sacerdote instead ask a offer for God. For example a Landowner Noble can tax 50% of all transactions of the farmer he own, a judge instead can fine anyone on the city up to 20% of his asset, a General iinstead can tax just merchant for the safety in trading route. This is a hypothetical Taxation Diagram, still using the same entities structure i used in the last two diagrams. The Tax ability are defined in clusters so to understand who can tax who.
-
Regarding instead how to let the entities be created, before i was suggesting a family Component to make entity procreate each other, but actually is much simpler and straight forward to use dedicated Building to create them, that is actually the 0A.D way. Of corse not for free, but using Money Resource. Following the above diagram this could be a Entity Creation Diagram where Cost is the cost for unit and the Building is all building where that basic entity can be created. Once created each entity has to pass all upgrades if want to evolve to higher level and earn more money.
-
ok this can be an updated version of Entity Upgrade Diagram where the social mobility is extremely rigid. Who born nobles can just upgrade in nobles function, same like farmers, artist, the only two classes can overlap are Merchant and Dealers. Slaves just don t upgrade!
-
I want add a small idea to the discussion: achievable programmatically and that can overcome the rigid social mobility problem: i can code a Family Component, which give our Economic Entities the ability to procreate Entity of the same kind once condition are met, for example a King can just procreate Prince or princess, like farmer can just procreate farmer, insinde them kind they can upgrade in some level based on wealth achieved. In this way we have a rigid society but also upgradable Economic Entities and that can increase in number if the civ develope
-
Yes sure , once the mod will be complete, we need to finish it first, Now looks little complex because not defined yet, in a second time we will semplify all and make it very intuitive, still complex enogh to make the game gain dramatically in Strategy. Will be a lot of fun ! @Sundiata and @Thorfinn the Shallow Minded All yours are valuable suggestions. I think we can redesign the Entity Upgrade Diagram and make it more historical realistic . You have good historical notions, can you propose a model can fit all acient civs in the game? ( of course different titles for different civs) We can start with a general model with the assumption that social mobility is quite limited and after we apply the general model to all specific civs. Also about products we can define the agrarian goods as principal economic industry, i think more the civ evolve more also other industries emerge in some degree, i wil make a study about it, open to suggestion, will follow a product diagram after that.
-
Will follow other diagrams to define more other concepts of the economy, this will represent the first design of the Economy
-
Entity Upgrade Diagram This instead is the Upgrading Tree of the Entities, from Slave to City Major and the necessary condition to meet for the upgrade. Slave for example are the first step of our economy, before become citizen they need gather 2000 of resources. Citizen instead after they earn 5000 Money the can finally decide to upgrade in 1 of the 4 possible Economic Entity: Remain Citizen but higher class, become a trader, a street vendor or a street artist etc...
-
Here some more structured data for some basic component of the economy: Trades Type Diagram The Economy will consist in 3 different levels of Trades: 1) City Trade Slave provide basic Resources for Free to the State, the State sell these to the Vendors or Dealers which use to create Product that they sell to all the Citizens. If the Products needed are not available the citizens can try to go to the Market, where they can found products from different cities. 2) InterCity Trade The Traders move city to city bringing the products needed, they buy and sell straight to the market buildings. 3) InterCiv Trade This is handled by a special envoy in the Capital, prior agreement with the other player Strategy Tip Every City should focus on developing a Standard Generic City Trade and at the same time specialize itself in one main Industry. In fact if the business and technologies of one city are in the same industry there are very good bonus and can be develope faster Because different City Specialize, is very important keep an eye on the Intercity Trade so to don t disrupt the Supply Chain
-
Yah thanks @stanislas69, sorry for the messy, but just because i am still discovering all gaming resources , the repository is still very raw....i will clean it more and more i define the project
-
Ok i just create a new dedicated project in here, where you can follow all development, also a dedicated link to the Github Repo
-
==/// ECONOMY SYSTEM MODEL UPDATE \\\== Here is the Model of the Economy System so far, i will update this small section of the first message time to time ////////////////== END UPDATE SECTION == \\\\\\\\\\\\\ Hi everyone!! This is my second Topic in this forum and also the extension of a discussion started here that naturally evolved in a Mod Project. So here we are. First of all i have to tell that i am not native english, i am Italian, so please be patient with me for my grammar. All started from the idea to create a economy structure of the game more complex, i feel all the cities i build with so much effort during the game are just like ghost city, with not real live in it if not for the traders go up and down.... i wanted to have something overall more strategic, not focus on the military where the game is already quite strong, but on the civilian side. To give life to this cities i think is necessary develop their economy dimension, so for example add buildings like Shops , Academies, Products, Markets (Extending that one already in the game) etc.. and Entities like Dealers, Traders, Professors, Artists, Nobles, Citizens, Slaves etc. Starting from this very draft Idea i start developing is something more structured as follow below: (All the Code of the Mod is freely available in this dedicated GitHub for who is interested to partecipate on the development don t hesitate to contact me.) Goal Create a Economy System for 0Ad to give more Realism and add Strategy to the Game. 3 Main Concepts of the Economy System : 1 Economy Entities Dividing the Military Unit from the Civilian , we focus just in the latter for our Economy. Civilian Entity can Upgrade from Slave to Noble paying fee to special structure ( like Academy) or collecting a certain amount of experience ( calculated in money earned ). There are two kind of entity in our model: Passive: Earn Money from the resource gathering job Active: Earn Money producing and selling products We can say that Passive Entity are just Consumer, and Active are both Consumer and Producer. All the Economy Entities consume product and resources, can stock products , have own money saved in them personal wallet and most important they can spend or earn. In more details: Slave work for free and consume just some food the only owner is the State which account for the food and benefits of the resources gathered Citizen the can earn and spend; they consume food and also other commodities like textile or wine, they can buy food from the State or from Food vendors, and the other commodities from the shops or in the market, the own the money earned but also the State own them: all resources gathered go to State which pay them producing money from free Shops, Market, Circus are instead Structures which spend money to buy resources from State and resell them to Citizens offering different products from clothes exotic food entreatment etc..also they need to pay a tax for each transaction to State Nobles instead they can own Slave and earn a percent for all the Lifecycles of them economy once they upgrade in the different economy entity described above. They Spend money for very expensive commodities and they influence the civ evolution like giving some very good benefits to win the game( not sure yet which one ) In more details: State: Ownership: Own Spend : Money / Technology, Weapon, Diplomacy, Super Unit, Corruption etc.. Earn : Money/ VAT Tax, Monthly Tax, Resources, Villas, Castles Consume: None Produce: Money, Slaves, Market Building Dedicated Building: Civ Center Slave: Ownership: State, Nobles Spend : NO Money Earn : NO Money Consume: 1 Food[fish,fruit,grain,meat]/Day Dedicated Building: No Produce: Labor Citizen: Ownership: State, Own Spend : Money / Products and Resources Earn : Money/ Resource Gathered Consume: 2 Food [fish, fruit, grain, meat]/Day 2 Food [wine, sausage, bread, steak]/Day 1 Clothes/Week ( will be produced by some Shop or 1 Entertainment/Month Produce: Labor Dedicated Building: No Food Dealer: Ownership: Own Spend : Money / Resources, Products Earn : Money / Bread , Sausage Consume: 4 Food [fish, fruit, grain, meat]/Day 4 Food [wine, sausage, bread, steak]/Day 2 Clothes/Week 2 Entertainment/Month 1 Jewelry Produce: Sausages,Breads,Wines, Steak Dedicated Building: 1 Level : Street Vendor, 2 Level: Locand, Bakery, Butcher Clothes Dealer: Ownership: Own Spend : Money / Resources, Products Earn : Money / Clothes Consume: 4 Food [fish, fruit, grain, meat]/Day 4 Food [wine, sausage, bread, steak]/Day 2 Clothes/Week 2 Entertainment/Month 1 Jewelry Produce: Clothes Dedicated Building: 1 Level : Street Vendor, 2 Level: Clothes Shop Jewelry Dealer: Ownership: Own Spend : Money / Resources, Products Earn : Money / Jewelry Consume: 6 Food [fish, fruit, grain, meat]/Day 6 Food [wine, sausage, bread, steak]/Day 4 Clothes/Week 3 Entertainment/Month 2 Jewelry Produce: Jewelry Dedicated Building: 1 Level : Street Vendor, 2 Level: Jewelry Shop Trader: Ownership: Own Spend : Money / Resources, Products Earn : Money / Resources, Products Traded Consume: 6 Food [fish, fruit, grain, meat]/Day 6 Food [wine, sausage, bread, steak]/Day 4 Clothes/Week 3 Entertainment/Month 2 Jewelry Produce: Resources, Products Dedicated Building: 1 Level : Street Merchant, Artist: Ownership: Own Spend : Money / Resources, Products Earn : Money / Entreatment Consume: 6 Food [fish, fruit, grain, meat]/Day 6 Food [wine, sausage, bread, steak]/Day 4 Clothes/Week 3 Entertainment/Month 2 Jewelry Produce: Entreatment Dedicated Building: 1 Level : Street Vendor, 2 Level: Entreatment Building(Arena) Noble: Ownership: Own Spend : Money / Resources, Products, Slaves Earn : Money / Tax from his former Slaves Consume: 20 Food [fish, fruit, grain, meat]/Day 20 Food [wine, sausage, bread, steak]/Day 10 Clothes/Week 10 Entertainment/Month 10 Jewelry Produce: Technology Dedicated Building: 1 Level : Villa, 2 Level: Castle 2) Money Of course all is about money, so the first thing i did is to create the Money Resource. The Player represent the State in my Economy System, perceive a Tax for every transaction done in its kingdom, ( ex. 20%) plus it can collect money selling resources to the producers and adding other fee after a certain amount of time. More glorious is his economy more money he can make. 3) Products So far i created 8 products that can be sold: - Food: bread, wine, steak, sausage - Clothes - Entertainment - Jewelry - Slave Each Product has a price that change based on the Supply and Demand, they are being calculated by a PriceManager Component, which will calculate the demand and offer every tot amount of time, to give realism of the Economy Model. What i Achieved so far ... As you can see on the image i took the template of Female Support i add to the template EntityFinance, EntityConsumer and EntityProducer. With EntityFinance Component they can earn money every resources gathered, they automatically pay the tax to the State, they can store all money in a Balance which has a maximum capacity , depending if are just citizen or nobles. or dealer etc.. With EntityConsumer Component i track the need of the entity, every time she work one algorithm calculate different variables to define is actual need. these variables are : - Product Daily Consuming, - Product Daily Availability, - Product Already in Stock - Product Prices Compared with his Own Balance. The need is so calculated as a value between 0 and 2 , if the value of need of a product is major of 1 , the product is inserted inside a list of FirstChoiceProduct, which define the entity needed product in every given the moment Of course this component track all the product consumed and stocked by the entity With EntityProducer Component instead define the capabilities to produce products to resell later. all Products produced are in a catalogue that other entity can see , so far i developed just to let the entity purchase what she wants, still need to be developed to producing product etc.. To make the entity moving to buy product if needed i implemented a new order in unitAI Component, i called it "Shopping", which let the entity once she working checking if she has need, if there are producer with available product around and in case if go to them, buy the product, stock them and go back to work . Also For the Visual Part and GUI, i added the 8 product category for Entity Consumer in the left panel so to have a track of what the entity has in stock(you can see the tooltip) and the balance of money of the entity is showed on top of the head of the 3d woman and also in the central panel, where there is a more specific description with tot amount ant max capacity. Money resources are instead tracked in the top together with all other resources. Also i added one new animation once the entity approach the seller, is just a start but at least she do something like paying cash.( Is the third picture, i used another woman as a producer cause i don t have now 3d model of vendor to use) All the Code of the Mod is freely available in this dedicated GitHub for who is interested to partecipate on the development don t hesitate to contact me. Please give me Ideas and Feedback
-
@stanislas69 where should i upload the Mod? Github? Or you have a dedicated place?
-
Hi everyone!! Some Update on the job done so far!! First an update on the Project: Goal: create a Economy System for 0Ad to give more realism and add strategy to the game. Brief Description : Money Of course all is about money, so the first thing i did is to create the money resource. The Player that i call State in my Economy System, perceive a fee for every transaction done in its kingdom, (20%) plus it can collect money selling resources to the producers and adding other fee after a certain amount of time. More glorious is his economy more money he can make. Economy Entities Dividing the Military Unit from the Civilian , we focus just in the latter for our Economy. Civilian Entity can upgrade from Slave to Noble, (see post above to know more), there are two kind of entity in our model: Passive: Earn Money from the resource gathering job Active: Earn Money producing and selling products We can say that Passive Entity are just Consumer, and Active are both Consumer and Producer. All the Economy Entities consume product and resources, can stock products , have own money that they can spend or earn. They can Upgrade paying fee to special structure. Components : EntityFinance, EntityConsumer, EntityProducer Products So far i created 8 products that can be sold: - Food: bread, wine, steak, sausage - Clothes - Entertainment - Jewelry - Slave Each Product has a price that change based on the Supply and Demand, they are being calculated by the ProductManager Component and broadcasted to all other components once changed after a certain amount of time What i Achieved so far As you can see on the image i took the template of Female Support i add to the template EntityFinance, EntityConsumer and EntityProducer. With EntityFinance Component they can earn money every resources gathered, they automatically pay the tax to the State, they can store all money in a Balance which has a maximum capacity , depending if are just citizen or nobles. or dealer etc.. With EntityConsumer Component i track the need of the entity, every time she work one algorithm calculate different variables to define is actual need. these variables are : - Product Daily Consuming, - Product Daily Availability, - Product Already in Stock - Product Prices Compared with his Own Balance. The need is so calculated as a value between 0 and 2 , if the value of need of a product is major of 1 , the product is inserted inside a list of FirstChoiceProduct, which define the entity needed product in every given the moment Of course this component track all the product consumed and stocked by the entity With EntityProducer Component instead define the capabilities to produce products to resell later. all Products produced are in a catalogue that other entity can see , so far i developed just to let the entity purchase what she wants, still need to be developed to producing product etc.. To make the entity moving to buy product if needed i implemented a new order in unitAI Component, i called it "Shopping", which let the entity once she working checking if she has need, if there are producer with available product around and in case if go to them, buy the product, stock them and go back to work . Also For the Visual Part and GUI, i added the 8 product category for Entity Consumer in the left panel so to have a track of what the entity has in stock(you can see the tooltip) and the balance of money of the entity is showed on top of the head of the 3d woman and also in the central panel, where there is a more specific description with tot amount ant max capacity. Money resources are instead tracked in the top together with all other resources. Also i added one new animation once the entity approach the seller, is just a start but at least she do something like paying cash.( Is the third picture, i used another woman as a producer cause i don t have now 3d model of vendor to use) As always i would be very happy to share all the code, just now is really a lots.!!...i don t think here would look nice and also are becoming really a lot of implementation , so you just tell me where would be best share and i ll post. And Please give me Ideas and Feedback
-
Hi everyone!! i m updating on the progress: Thanks @stanislas69 and @(-_-) for the valuable tips: i fix the typo error and i moved all the stuff out of guiinterface.js so to don t create problems. What i achieved is this: See Image Uploaded: A full working prototype of a female citizen who can work and earn money for the job done, the wealth is showed in the progress bar on top of her health bar Every time she work and gather some resources: metal, wood, stone or food, she earn some amount of money. depending of her <EntityFinance> template: i use <EarningRate> to specify the rate of earning and <WalletCapacities> to specify the max amount of money she can store Of course she can spend as well, i will now try to update the GUI of money resource for the unit and after i will develop a economy model where unit can earn and spend , this is my draft idea so far: Splitting the civilian from the military we can focus just on civilian as a main actors of our economy. We can split the Economy Entities in: Slave, Citizen, Food Vendor, Artist, Dealers(Shops), Trader(Market , implementing that already exists), Nobles and the State Every actor has a degree of importance in the Economy Model and from slave can evolve in all different entities: Slave work for free and consume just some food the only owner is the State which account for the food and benefits of the resources gathered Citizen the can earn and spend; they consume food and also other commodities like textile or wine, they can buy food from the State or from Food vendors, and the other commodities from the shops or in the market, the own the money earned but also the State own them: all resources gathered go to State which pay them producing money from free Shops, Market, Circus are instead Structures which spend money to buy resources from State and resell them to Citizens offering different products from clothes exotic food entreatment etc..also they need to pay a tax for each transaction to State Nobles instead they can own Slave and earn a percent for all the Lifecycles of them economy once they upgrade in the different economy entity described above. They Spend money for very expensive commodities and they influence the civ evolution like giving some very good benefits to win the game( not sure yet which one ) All the Prices of the different commodities and resources are set by a PriceManager Component, which will calculate the demand and offer every tot amount of time, to give realism of the Economy Model Also The State has the Capacity to apply Tax to all the transaction and also a Tax to all entities once passed a certain amount of Time This is a draft for the first two State: Ownership: Own Spend : Money / Technology, Weapon, Diplomacy, Super Unit, Corruption etc.. Earn : Money/ VAT Tax, Monthly Tax, Resources, Villas, Castles Consume: None Produce: Money, Slaves, Market Building Dedicated Building: Civ Center Slave: Ownership: State, Nobles Spend : NO Money Earn : NO Money Consume: 1 Food[fish,fruit,grain,meat]/Day Dedicated Building: No Produce: Labor Citizen: Ownership: State, Own Spend : Money / Products and Resources Earn : Money/ Resource Gathered Consume: 2 Food [fish, fruit, grain, meat]/Day 2 Food [wine, sausage, bread, steak]/Day 1 Clothes/Week ( will be produced by some Shop or 1 Entertainment/Month Produce: Labor Dedicated Building: No Food Dealer: Ownership: Own Spend : Money / Resources, Products Earn : Money / Bread , Sausage Consume: 4 Food [fish, fruit, grain, meat]/Day 4 Food [wine, sausage, bread, steak]/Day 2 Clothes/Week 2 Entertainment/Month 1 Jewelry Produce: Sausages,Breads,Wines, Steak Dedicated Building: 1 Level : Street Vendor, 2 Level: Locand, Bakery, Butcher Clothes Dealer: Ownership: Own Spend : Money / Resources, Products Earn : Money / Clothes Consume: 4 Food [fish, fruit, grain, meat]/Day 4 Food [wine, sausage, bread, steak]/Day 2 Clothes/Week 2 Entertainment/Month 1 Jewelry Produce: Clothes Dedicated Building: 1 Level : Street Vendor, 2 Level: Clothes Shop Jewelry Dealer: Ownership: Own Spend : Money / Resources, Products Earn : Money / Jewelry Consume: 6 Food [fish, fruit, grain, meat]/Day 6 Food [wine, sausage, bread, steak]/Day 4 Clothes/Week 3 Entertainment/Month 2 Jewelry Produce: Jewelry Dedicated Building: 1 Level : Street Vendor, 2 Level: Jewelry Shop Trader: Ownership: Own Spend : Money / Resources, Products Earn : Money / Resources, Products Traded Consume: 6 Food [fish, fruit, grain, meat]/Day 6 Food [wine, sausage, bread, steak]/Day 4 Clothes/Week 3 Entertainment/Month 2 Jewelry Produce: Resources, Products Dedicated Building: 1 Level : Street Merchant, Artist: Ownership: Own Spend : Money / Resources, Products Earn : Money / Entreatment Consume: 6 Food [fish, fruit, grain, meat]/Day 6 Food [wine, sausage, bread, steak]/Day 4 Clothes/Week 3 Entertainment/Month 2 Jewelry Produce: Entreatment Dedicated Building: 1 Level : Street Vendor, 2 Level: Entreatment Building(Arena) Noble: Ownership: Own Spend : Money / Resources, Products, Slaves Earn : Money / Tax from his former Slaves Consume: 20 Food [fish, fruit, grain, meat]/Day 20 Food [wine, sausage, bread, steak]/Day 10 Clothes/Week 10 Entertainment/Month 10 Jewelry Produce: Technology Dedicated Building: 1 Level : Villa, 2 Level: Castle Please share your ideas and give me some feedback, always once i implemented further i will share all code to the community
-
I just write down a component to handle the Enitity Finance but even following the suggestion of @stanislas69 to create the interface, i occurred in a error that the template cannot be validated. So i still miss to understand how component work. This my component: EntityFinance.js function EntityFinance() {} EntityFinance.prototype.Schema = "<a:help>Lets the unit earn money for the job done!.</a:help>" + "<a:example>" + "<WalletCapacities>1000</WalletCapacities>" + "</a:example>" + "<a:example>" + "<EarningRate>1.0</EarningRate>" + "</a:example>" + "<element name='WalletCapacities' a:help='Max Money the Entity can earn '>" + "<ref name='positiveDecimal'/>" + "</element>" + "<element name='EarningRate' a:help='Earning Rate of the Entity'>" + "<ref name='positiveDecimal'/>" + "</element>"; EntityFinance.prototype.Init = function() { this.balance = 1; // the Actual Amount of money the entity has this.RecalculateEarningRate(); // Recalculate the Earning Rate this.RecalculateWalletCapacities(); // Recalculate the Wallet Capacity }; EntityFinance.prototype.GetFinancialStatus = function() { let fin = { balance: this.balance, walletCapacity: this.walletCapacity, earnRate: this.earningRate }; return fin; }; EntityFinance.prototype.GetWalletCapacity = function() { if (!this.template.WalletCapacities) return 0; return this.template.WalletCapacities; }; EntityFinance.prototype.RecalculateWalletCapacities = function() { this.walletCapacity = this.GetWalletCapacity; // once added financing tool in tech, right now yet }; EntityFinance.prototype.RecalculateEarningRate = function() { // if Player get some change in earning rate is being update to the entity let cmpPlayer = QueryOwnerInterface(this.entity, IID_Player); let multiplier = cmpPlayer ? cmpPlayer.GetEarningRateMultiplier() : 1; this.earningRate = this.template.EarningRate * multiplier; // once added financing tool in tech, right now yet /*this.earningRate = ApplyValueModificationsToEntity( "EntityFinance/EarningRate", +this.template.EarningRate, this.entity );*/ }; EntityFinance.prototype.Earn = function(amount) { // once the entity spend a certain amount of money this.balance += amount; Engine.PostMessage(this.entity, MT_EntityFinanceChanged, { to: this.GetFinancialStatus() }); }; EntityFinance.prototype.Spend = function(amount) { // once the entity spend a certain amount of money this.balance -= amount; Engine.PostMessage(this.entity, MT_EntityFinanceChanged, { to: this.GetFinancialStatus() }); }; Engine.RegisterComponentType( IID_EntityFinancey, "EntityFinance", EntityFinance ); I also added the Interface in simulation/components/interface : EntityFinance.js Engine.RegisterInterface("EntityFinance"); Engine.RegisterMessageType("EntityFinanceChanged"); and i try to modify the default_support_female_citizen.xml adding this code: <EntityFinance> <WalletCapacities> 1000 </WalletCapacities> <EarningRate>1.0</EarningRate> </EntityFinance> but once i test it the console log say that the template is not validated and that there is a extra EntityFinance element as a error. What i miss? thanks for the help
-
Hi everyone, i give you some update on the job done so far: I created successfully money resources and i created a mechanism to increment this value proportionally to the GDP of the civ, the GDP is calculated as a sum of each resource amount times the resource price, i calculated the price of each resource using the Actual Population as a criteria, the concept behind is the market law of demand and offer, so if the metal (for example) collected exceed by far the actual population its price go down, if instead the metal is minor , its price go higher these are the Spec for who is interested: I don t post how create money resource cause there are already a tutorial for it. i achieved the mechanism of economic gain doing this: Session.js --> add this code to onTick() .... var framCounter = 0 function onTick() { framCounter += 1; if (framCounter % 32 == 0) { // We start the money Supply calling a method of GuiInterface Engine.GuiInterfaceCall("GetStartedMoneySupply"); } ....} GuiInterface.js --> add this method GuiInterface.prototype.GetStartedMoneySupply = function() { //let cmpMoneySupplyer = Engine.QueryInterface(SYSTEM_ENTITY, IID_MoneySupply); //cmpMoneySupplyer.AddResources(); let numPlayers = Engine.QueryInterface( SYSTEM_ENTITY, IID_PlayerManager ).GetNumPlayers(); for (let i = 0; i < numPlayers; ++i) { let cmpPlayer = QueryPlayerIDInterface(i); let totres = cmpPlayer.GetResourceCounts(); let totMetal = totres["metal"]; totMetal == 0 ? (totMetal = 0.01) : totMetal; let totStone = totres["stone"]; totStone == 0 ? (totStone = 0.01) : totStone; let totWood = totres["wood"]; totWood == 0 ? (totWood = 0.01) : totWood; let totFood = totres["food"]; totFood == 0 ? (totFood = 0.01) : totFood; // --> IMPLEMENTATION // Next Step is add also all Services and products produced // Calculte Resources Prices divinding population for tot resources let totPop = cmpPlayer.GetPopulationCount(); let metalPrice = totPop / totMetal; let stonePrice = totPop / totStone; let woodPrice = totPop / totWood; let foodPrice = totPop / totFood; // --> IMPLEMENTATION // Next Step is to trade every resources with money and calculate the offer and the request to more accuratly calculate resources prices // Calculate GDP let gdp = totMetal * metalPrice + totStone * stonePrice + totWood * woodPrice + totFood * foodPrice; // Adding Money to all players if (cmpPlayer) cmpPlayer.AddMoneyResource(0.01 * gdp); } }; and finally in Player.js adding this method Player.prototype.AddMoneyResource = function(amount) { this.resourceCount["money"] += +amount; }; Done, is simple but work quite well, but now i am planning to create something more advanced, the plan is to create a UnitFinance Component, and record for each entity the money earned and spent , if this is achieved i can divide the entity is simple worker, owner of shop, trader and Goverment, each with different degree of collect, spend and earn money, from that i can also calculate the GDP of the civ in a more specific way and associate the money supply i did before as a percent of GDP or as a Tax collection, with money the Player could buy weapons, Units, Building Infrustracture etc... quite . a lot i know but i will give a try, very appreciated people want to give a help in this or want to implement the idea. Ciaooo
-
If i am succesfull with my idea i will share with the community the code :))
-
Thanks stanislas!! I saw that s great!
-
Hi everyone!! First time i post in this forum, and compliment every developer for the great job done!!!! I am a developer and playing the game i feel i whish to create a economy structure of the game more complex, so as a first step i thought that a wise solution would be add money resource, which i did succesfully, but now i am implementing the way the money resource increase proportionally with the size of the civilization and trade relationships, as far as i understand now i should create a new component in simulation, which i did in Js and added to the Engine through : Engine.RegisterSystemComponentType(IID_MoneySupply, "MoneySupply", MoneySupply); but i run into an error: IID_MoneySupply no defined. prob i miss many concepts here, anyone can help?