I changed my mind. Licenses.

posted in KrisWolfe
Published May 21, 2019
Advertisement

This weekend I probably put in around 20 hours with my economy code. I ripped up everything and slowly rebuilt it in a new class, transferring over logic. My controller code is now just a flow controller, and all the logic is contained in the actual companies and contract logic.

So what can we do? Both companies and agents create job contracts, and put them on a market. Sometimes companies decide to just take the lowest contract from the consumers as far as salary goes, and sometimes the agents will take the highest paying company contract. Those contracts get thrown into a active contract list, and the list executes the contract. What the execution is left up to the company's internal logic based on what type of employee it needs.

So far the only company I have is producers, or manufacturers. They have a recipe, and they hire employees to execute that recipe. Each recipe has different conversion times, or time it takes to convert from raw materials to finished goods. I have some goods that come from nothing, and some that require other goods. Apple Pie needs Apples. These companies will create Goods contracts with each other, sending off their inventory for an agreed on price, and they change the price of the contracts everyday that it doesn't get filled in order to be a more attractive offer. I also have productivity in the game, but it currently is just set to 100% until I decide what I want to affect it.

Contracts expire, thrusting agents back onto the job market. Agents and companies both change their prices if they do not get what they want. Agents have the chance to apply to any job instead of just their highest skill. I have multiple skills now. Each of them show up on the market. And the best part of all, it works (at least as far as I can tell).

So what's not in the game? I took out hunger for now, because I don't have a place for agents to shop. I don't want producers to sell goods directly to consumers, I want them to act like vendors and distributors. I need retailers. I don't have a way for consumers to die from hunger, or go shopping. So that's what we're going to fix today.

So, how does a company know what type of employee to hire? I want shopping markets to hire retail clerks, and restaurants to hire cooks and waiters/waitresses. Right now, producers hire only "Good Makers". I thought that I didn't really want to differentiate between farmers and iron workers. But now I'm rethinking all of that.

So producers have "Good Makers" hardcoded into their logic. But what about retailers? Both shopping markets and restaurants are going to look identical. I don't want to make a separate class for them. Their class is just going to be "RetailAgent". They just have input contracts, they don't have output contracts. They don't send goods anywhere. Consumers come to them to consume their goods and pay for it. So how do I differentiate these types of retail agents within their class, but reuse all of their code?

I decided on something called "Licenses". Inside this class will be everything a company needs to hire employees. It will be an array of what skills are needed, so we can have multiple jobs needed. I will have a licensing database to hold all the different licenses, and when businesses are instantiated, they will decide then what license they want. License to sell alcohol, or marijuana, or italian food, or a shopping mart. And depending on the license, it will tell it what type of input goods it needs.

On top of that, we can use licenses to differentiate between farms and iron mines. So there's a bunch of different possibilities. We can even outlaw licenses with a government system in the future.

Anyways, all good stuff, and I have a clear road now on how to have infinite possibilities of company types without having to have a billion different classes. I'll have 3 classes, Retail, Service, and Producer with 3 interfaces for each, and then licenses that tell them what goods and employees they'll provide.

That's the focus for this week...get retailers up and running and hunger back into the market. Also my significant other told me that I needed art very very badly, so I might start researching what type of unifying aesthetic I want for this game.

1 likes 0 comments

Comments

jbadams

Sounds like an interesting simulation, getting quite detailed! :)

May 24, 2019 01:48 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement