Simple Economy Unity

Ok, so I’m working on a grand strategy game, and I need nations to have incomes, so that they earn money in a set amount of time. Provinces make up the base of the game, and different provinces has an id, and a value used to determine the amount of income it generates (along with multiple other values) defined in a json file. Nations can own these provinces, and each nation has it’s own id. There is also a dictionary which defines each provinces owner. I also have a separate script that manages time, and I am making it so that every time the month value increases, each nation also gets some money. The nations economy would be defined in a dictionary, and I need to be able to calculate the amount of money to be added, and add it to the economy dictionary (or find another way if it would be easier/faster) without slowing the game down. What would be the easiest way to do this?

Okay, so there’s a lot to unpack here. I actually think this is more of a design question and doesn’t really have a straightforward answer. Hopefully some of this information can be useful for you as you think about the system you’re creating.

I don’t know what the rest of your project looks like, so I’m going to go based off of what you included here. My takeaways are: Provinces make up the base of the game and a dictionary [that] defines each provinces owner. Shouldn’t you give more importance to this in your implementation, then? I think misuse of a data structure here is limiting your options (reliance on a dictionary).

Why not utilize Object Oriented design and structure your system the way you describe it here? I’m imagining something along the lines of:

  1. Define a Nation class and a Province class. Since Provinces make up the base of your game, it deserves it own class!

  2. In your province class, define the properties that make it a province (ID, Income generation value). You may also want to include useful methods here that you mentioned above.

  3. In your Nation class, define the properties that make it a Nation (a list of Provinces, an ID, etc.) This removes your reliance on a dictionary for tracking owners, and instead you can just check Nation.provinces.

  4. With your time script (a time manager class?) You can implement a method like Payout(Nation n) that distributes income based on the input nation’s province (which the nation itself is tracking!). So when your time manager script decides its time to payout (because the month value increased) you just call Payout().

The nations economy would be defined in a dictionary, and I need to be able to calculate the amount of money to be added, and add it to the economy dictionary.
If by economy you mean the money it has, you can store this directly in your nation class! But if you mean an entire system, you could consider a separate Economy class. If it’s the former, then this would already be done in your TimeManager’s Payout() function.

C# is an object oriented language, so I’d consider this the ‘easiest’ way even if it takes some upfront time to design and plan out your system.

Just fell over this, and maybe just for completness sake a couple of additional references:
a) Unity has an economy system (probably not exactly what you have in mind) In-Game Economy Designer: Plan, Build & Manage | Unity
b) there is a decent artikle on the basics by Fernanda Gonzalvez here Building an in-game economy: How-to guide | Unity
c) Have a look at scriptable objects for your Provinces and Countries
d) This here is a good artikle on how to get to balancing an economy: Fast prototyping in Unity: Scriptable objects - LogRocket Blog using scriptable objects
e) if you are interested at an economy on a personal level and for citizens you might start with a free asset in the store here: Economy Manager (Full) | GUI Tools | Unity Asset Store

I am sure there is more
all the best