Sign in to follow this  

An economics engine

This topic is 3779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am about to embark on creating an economics engine capable of interfacing with games. Does anyone know if this has been done before? Do you think it would be a useful engine? Would a fully fledged economics engine be salable? can you give me any other tips or resources? Google brings up nothing. Thanks

Share this post


Link to post
Share on other sites
If you could make it work and it would replace 90% of the work done by the game programmers, then you might be able to sell it. Keep in mind that the number of games that have an economy is small. That is probably why 3rd party graphics and physics libraries sell well, but AI libraries don't.

Share this post


Link to post
Share on other sites
Quote:
Original post by JohnBolton
If you could make it work and it would replace 90% of the work done by the game programmers, then you might be able to sell it. Keep in mind that the number of games that have an economy is small. That is probably why 3rd party graphics and physics libraries sell well, but AI libraries don't.




When I first read this statement I saw 90% I said 'no way' but then considered that it would eliminate 90% of the work by the programmers who had to create the economics system in a game (not the entire coding effort of the whole game -- so you would also have to qualify this with 'and for most games, economics is only a small fraction of the entire programming'.

Economics is not just money, its also manipulations of commodities and labor and consumption, and those get very intricately entwined with the rest of the game mechanics which I would think is very hard to genericize.

[Edited by - wodinoneeye on August 13, 2007 10:04:32 PM]

Share this post


Link to post
Share on other sites
This how I am starting out (c#)(keeping it simple for now)

//I write this
public interface IProduce
{
string Name
{
get;
}
int CycleTimeInSeconds
{
get;
}
string Category
{
get;
}
}
//User writes this
class Apple : IProduce
{
public string Name
{
get { return "Apple"; }
}
public int CycleTimeInSeconds
{
get { return 5; }
}
public String Category
{
get { return "Fruit"; }
}
}



What do you think about this style of implementation?

[Edited by - RivieraKid on August 13, 2007 3:58:14 AM]

Share this post


Link to post
Share on other sites
I think that's a fine start for a product interface. I'm not sure why you're storing the Category per object. It would make more sense to create a category class to keep the name of the category (and any other helpful Category level information) and keep a reference to it in IProduce. Or you could create a subclass of IProduce for fruit and have Apple descend from that. There are a number of different options, but I think that you could do better than storing a duplicate string in every derivative of the produce class. Plus, it'll make life easier in the long run. What is the CycleTimeInSeconds? Is it the amount of time between pricing updates? Again, I'm not sure you want to store that at the Produce level.

I don't want to sound discouraging, but you may be attacking this from the wrong end. Sure, it's most fun to write code as soon as possible, but there are design issues with economic simulations that you should probably deal with before you start to code. It sucks, but you'll be much happier in the long run to have classes that contain the information you want, and have methods you'll use. By thinking about how products will interact with the economy first, you'll be in a much better position to design your classes and implement them.

Economic simulation isn't an easy problem. It's especially hard to generalize. Much of what an economic simulation does is specifically tied to the game using it. For instance, World of Warcraft's economy is much different than Sid Meier's Pirates economy. So what are your goals for your economy?

There have been some discussions here at gamedev on this topic (Here and here for example).

Hope that helps.

[Edited to fix a C# mistake]

Share this post


Link to post
Share on other sites
Thanks for the advice.

CycleTimeInSeconds is the time required to produce the item.
And Category is really placeholder code so i dont forget about categories later.

Do you think Fuzzy Logic would be suited to deciding a price for a product?

I thought i would have the following membership functions.

Cost to make-
low,medium,high

Supply To Demand-
low, medium, high

sale price-
very low, low, medium, high, very high

Example rules:
If cost to make is high and Supply to demand is medium then sale price is high
If cost to make is low and supply to demand is low then sale price is medium
etc

This seams like a good system (maybe overkill buy it gives me practice in fuzzy logic).

Ive created some more interfaces and structures. I'm a bit of a devil when it comes to designing on the fly and coding too much. Bad habit.

Share this post


Link to post
Share on other sites
Quote:
Original post by RivieraKid
.

Do you think Fuzzy Logic would be suited to deciding a price for a product?

.



Prices/costs generally are continuous values, whereas fuzzy logic determines modal results. It would be more for things like determining buy/hold/sell modes of behavior (as inputs for activating policies via if-then methods)

Share this post


Link to post
Share on other sites
Implementation is generally good but I think you safely
can add another layer

public interface IProduce
{
string Name
{
get;
}
int CycleTimeInSeconds
{
get;
}
string Category
{
get;
}
}

class Ifruits : IProduce
{
...
};

//User writes this
class Apple : Ifruits
{
public string Name
{
get { return "Apple"; }
}
public int CycleTimeInSeconds
{
get { return 5; }
}
public String Category
{
get { return "Fruit"; }
}
}

Share this post


Link to post
Share on other sites

This topic is 3779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this