Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

163 Neutral

About omikun

  • Rank

Personal Information

  • Interests
  1. omikun

    Realistic economy in 4x

    It works! Well for the most part. I can't explain all its behaviors right now. Check it out at: https://github.com/omikun/EconSim It's written in C# for Unity. Right now it only models price as a rough function of supply and demand based on agents' price believes, which is influenced by price and the success of their bids. Things to add: multi-markets with optional import taxes and export restrictions, and unique currency per market.
  2. omikun

    Realistic economy in 4x

    I spent a long time replicating economy-sim in c++ before I realize it doesn't support (and cant' be made to support) the kind of dependencies I wanted in bazaarBot. Now I am working on another sim in unity based on the paper linked by the bazaarbot project. It's looking good! This graph is quantity traded vs trading rounds. The quantity traded is based on commodity type with 20 agents. The commodities are from the paper: food, wood, ore, metal, tools. I simplified it so only the woodworker needs the tools, everyone eats, and only farmers need wood. Blue is food, everyone needs that. Maroon is wood, needed by the farmer, and that stabilizes. The other stuff, ore->metal->tools fluctuates much more.  I only have a subset of the functionality implemented. Still need to switch agent jobs on bankruptcy, set max prices, more intelligent bids based on supply/demand and historical averages. I made the graph from scratch, but if anyone knows of a good graphing library for Unity I wouldn't mind switching over. It needs to be open sourced since that is the goal of this project.
  3. Have you thought about why players would want to change the price of his goods? Is the average selling price changing? Or is there just some fixed sweetspot (say $485) that will always yield the maximum profit and the player just needs to mess around until he finds it? I think the key idea is to make this fun. What would be fun vs what is realistic? This is also a question I'm looking to answer. It sounds like you want to write a bunch of if/else to check for specific price points to simulate the market psychology and/or the supply/demand curve. I feel this is frustrating for the player because they may not even know these rules exists.  I like an algorithmic supply/demand curve that changes in time based on the average selling price and the total supply/demand in the market. Of course, this means the average selling price must also change in time. You can do this w/ an RNG or model it based on fluctuations on other commodities.
  4. It really depends on what the rest of the game is like. Will the player be competing against other producers? What affects demand beyond the price of your product? If you are looking at competitive sectors like cellphones, no manufacturer can jack up the price without customers fleeing to another company unless that product has something no other competitor has and its worth something to the customers. If you are a monopoly, feel free to jack up the price of your product and demand will be around the same until your customers can no longer afford it (assuming your product is a luxury item, in which case demand would shrink pretty fast). Look at what happened to the price of epi-pen and that HIV vaccine. Monopoly + essential item = sky high cost.  So I would take into account a few things in your game: number of competitors for this product how essential is this product budget consumers have to spend on this product budget consumer has in general to spend on products in general;  Oh I see you're working on a 4x game as well. Check out my realistic economy thread, that might help you a little. In particular I found this that might work for you: https://github.com/larsiusprime/bazaarBot It's an agent based economy sim that models supply and demand of commodities by simulating bid/ask prices from suppliers and consumers.
  5. omikun

    Game environment

    Making a game is tough and requires a lot of tedious/mindless work. You should find something that inspires YOU not someone else. It will be this inspiration that drives you to keep working on the game. So it should speak to you, not someone else.
  6. omikun

    Spaceship weapon ideas?

      I like this idea. It can be generalized into more of a temporary damage to specific ship systems: engine, radar, optical sensors, comm, life support, steering/RCS/vector thrust. Continuing with this idea, damage could be a function of time, upgrades, ship type, fuel level, etc. This function does not have to be linear. It can be exponential or polynomial, with different factors as coefficients: distance, relative speed, direction (more damage or shutdown lasts longer if they're running away). A weapon can slowly sap the power out of their engine or drain their fuel tank or inhibit their maneuvering system. It can reverse the polarity of their shield so it amplifies damage received. Ultimately they're just equations in the form of : target.stat -= f(weapon.damage) Make the function into whatever! Some other ideas: A gravity bomb that pulls them around. EMP that shuts down some of their HUD s othey can't see where you are or if you have a missile lock on them. A missile that, when it hits, accelerates them/teleports them some distance forward so if they're heading close to an asteroid they'll smash right through. A tracking missile with pulsed detonation as propulsion that essentially becomes faster and faster unless the enemy can turn tight enough to avoid it. A missile that teleports 200ft at a time every second that can evade walls/asteroids. Anime-style missile barrage that 1. takes time to lock 2. launches 50 mini missiles at a time and detonates when close to the enemy :D I think you got your math wrong there. power * time = energy 1GW * 10s/3600(s/Hour) = .002 GWH or 2MWh
  7. omikun

    Spaceship weapon ideas?

    I think there are two ways of brainstorming: take inspiration from science -> game mechanic (weapon) take desired game mechanic quality -> find scientific concepts for decoration Starcraft II did a great job with the levels of variations in their weaponry across the three races. You can look at them as points in some multidimension space. The dimensions are: speed of projectile, damage per shot, # of shots, rate of fire, tracking yes/no, area of attack, bonus against (armor, bio, ...), secondary damage (mutalisk deflects). Now that I think about it, Overwach has great weapon variations as well. Each gun feels very unique with its own character. I think in a sim or any game really you want to be able to distinguish each weapon and give each a persona of sorts. Identifying the dimensions you want and finding the absolute distance between the weapons (use Pythagorean's thm) will help you ensure they aren't too similar to each other. Other dimensions from Overwatch:  continuous stream vs discrete fire damage amplified by x (boosts, bonus, crits, power absorbing shields, etc) anti-projectile projectiles that affect pos/vel of yourself or target or nearby ships omni-directional/no need to target/always tracking speed of projectile vs spread
  8. omikun

    Realistic economy in 4x

    I've been looking at some economy simulators: https://github.com/chewxy/economy-sim - simulates the influence loans have on an economy; fair price calculated by finding the minimum surplus (supply - demand) for some set range of prices. Individuals in the economy have fixed consumption/production weights. Price fluctuates based on money supply and individuals going into debt/kicked out of system https://github.com/larsiusprime/bazaarBot - agent based simulator with a bargaining system: buyers guess offer prices, sellers guess asking prices, market price determined by the average. This tracks dependencies between commodities (axe needs 1 wood and 1 steel) so a flux on one commodity impacts others, as well as the number of sellers. Sellers that go broke will switch jobs to where there is more demand. I'm looking into a hybrid of these 2: using economy-sim to model the population with bounded-random fluctuations in preferences combined with a small number of agents visible to the player (corporations) that the player either creates or has finer control over (issuing buy orders, bailouts, subsidies, etc) to fulfill player goals: explore the moon, other planets, mine asteroids. Once the player has created the first corp that can mine asteroids, the population will slowly start consuming those commodities and new corps will be created to mine other asteroids if the demand exists (player must drive demand in the early stages until the population's demand can sustain those corps in times of idle gov spending).
  9. omikun

    Realistic economy in 4x

    I'm thinking of a game where an empire consists of multiple entities (populations, corporations, government) with the player controlling the gov and AI (or a set of equations) controlling the rest. Keeping an empire alive should be a balance between the different entities. This balance can be upset by trade imbalance or propaganda.   Wars are not started before the military is ready, at least on one side. As one side is building up, the rest of the world can take actions. An empire can keep secrets but only for so long and only until an operation reaches critical mass. If Russia ramps up  military production, the rest of the world will know before too long. This ramp up may take a year or two, in the mean time trade sanctions can be made to slow them down.
  10. omikun

    Realistic economy in 4x

    Hi Lorenzo, I think you make a great point. Empires function by treating population like slaves without consequence. Want more production? Get more people and they will work. No need to worry about rebellion if you dangle enough shiny in front of them with entertainment buildings and culture bonuses. But that's not how the real world works. And I would like games to model the nuances that drives the modern world. People work for credit that they can then redeem for what they want. The price of things fluctuate based on supply and demand. Nations must trade with one another because of unequal resource distributions. There are a lot of interesting and emerging behavior from this kind of system and there aren't many games that even try to model it. Going back to your example: if I want more space ships, I need more production. But more often than not, I just don't want my enemies to have more spaceships. So instead of building an armada of my own to counter theirs, I can undermine their ability to make more spaceships by driving up the cost of raw material for them with an embargo, an export limit, import tax, or even surgical strikes into key mining/manufacturing sites. To that end, I'm going to drop inflation for the time being and focus on implementing supply/demand dependent pricing. It's a lot trickier than I originally thought, but it's a lot of fun nevertheless!
  11. omikun

    Realistic economy in 4x

    After reading more on this issue I am beginning to see two parts to a realistic economy, and by realistic I mean an economy driven by first principles (supply/demand of commodities and money supply): which is there is a marketplace of commodities and a meta layer of money that greases the wheel in that marketplace.  I think inflation is interesting but it is not the foundation of trade. I think I need to establish a barebones marketplace first: trade occurs with real money, not nominal money subject to inflation. I'm afraid implementing both inflation and trading will mask hard to tune parameters. This is my revised idea: everyone start with some initial amount of (real) money, they use this to exchange for good and conduct trade.  UpdateTick(): for each nation:     for each corp #compute exports for each commodity: for each foreign nation #determine demand or just remember demand from last tick #use demand to maximize profit for corp, depends on f(demand/supply), to determine production; do this every month? numCommodityProduced = demand (if just using demand/supply) for each nation: for each commodity: sum demand from all sinks: corps, population, gov, foreign bids in the form of export (taken from last tick) sum supply from all sources: mines, corp output, imports cost per item = f(demand/supply) * innate cost I do have a question of which should come first: estimate demand or estimate supply? It's like a chicken or the egg problem. Any suggestions? It also occurs to me that, given a turn based game, maybe don't change production every turn but every fixed period, since it may take some time to produce the product. If one unit of a commodity is made every n turns, then recompute every n turns? Or, if the corp is capable of making n units per turn, then recompute demand every turn.
  12. omikun

    Realistic economy in 4x

    Thanks frob! When you are talking about the curves, do you mean inflation versus money supply? I was thinking inflation = money_supply / value, but you are suggesting I do more of an inflation = f(money_supply/value) where f is sigmoid or others? Is there any literature on this? I know inflation has a psychological component and the f models that perhaps?   What I'm wondering is the in-game effects of all this. If the player can at anytime grow or shrink the money supply, where is the fun in that? It could turn into another knob that the player has to always be fiddling with and that can quickly become an annoyance.  Perhaps it can only be changed at intervals or the money supply can only be changed in fixed amounts. But that's really arbitrary. So I have a thought experiment that might illustrate the problem with this idea: Suppose, in a very reduced context, the nation has one company and a uniform population. The company pays the population, and the population consumes the products they help the company produce. Now if the company starts with 100 money, and spends 50 on the population as salary. The population has at most 50 to spend on the products they produced. The company can never make money. Say the pop borrows 50 from the government (gov injected 50 into the economy) now the company can sell 100 worth from spending 50, so it has a 100% profit margin. But in order for the company to keep making profit, the pop has to borrow more and more. Maybe the company is introducing value, but most of that value is in the form of debts owned by the pop. As t->infinity the economy will increase linearly but all the value will exist as debt from the money the government pumps in, which results in hyperinflation.  How do you stop that from happening?
  13. I was thinking about implementing a realistic economy and happened on this old thread: https://www.gamedev.net/topic/554811-what-makes-a-good-4x-space-game-economy-model/ I like it, and I think it is doable. I would like to write a proof of concept but I am having trouble getting started. Here is my idea:   The economy is a white box with resources and people as inputs. Money is a proxy for value and the mapping between money and value will change with inflation/deflation. Value is in the form of labor from people and resources mined from the environment. The economy start with some amount of money. As resources are brought in, there is more value in the economy than money, so deflation occurs. The player can inject money into the system, inflating the currency. The player can destroy the injected money to cause deflation. (buying/selling treasury bonds) The player, in this case, controls the government. So if the player wants to spend more money to buy a product or service (raise an army or a space fleet), it must print money and use that money to pay corporations to build it. The corporation takes the money and buys resources and convert that to the product and give that to the government. By printing money, inflation occurs so the price of that product will increase. The more money the player prints, the more expensive everything becomes. The player also gets money in the form of taxes, so the larger the economy, the more money the nation gets. The player can use tax money to buy products without driving the prices up. Now what prevents the player from injecting a ton of cash into his economy and then building a massive fleet to conquer the world? Well it would be very expensive, especially early on when the economy is small and the tech is low. But there could be a mid game inflection point when the tech is high enough that the player can hyper inflate her economy and make a one time push for mass militarization. Of course this will take a while, perhaps several years. In that time the rest of the world can see it and will either Raise their own armies and band together Embargo trade with the player to strangle her economy The second point would require trade between nations and resource distributions where the player cannot have everything it needs to build a massive army. But I feel I'm getting too far ahead now.   So here is my implementation idea in python for readability class nation: var money var injectedMoney var population var productivity #1 is normal, var value #all worth in nation var govMoney def CollectTax(): govMoney += taxRate * gdp def GetInflation(): return (money + injectedMoney) / value def PrintMoney(moarmoney): injectedMoney+=moarmoney def BuyBackBond(money): injectedMoney -= money def BuyThing(money): gdp += money valueBought = (1 - profitMargin) * money / GetInflation() #collect resources value += valueBought timeToCompletion = UnitManTime / (population * productivity) I'm missing a few things, like trade, embargo, and how to actually collect resources and bring that into the economy and what that means. I guess that is where I am stuck. Any suggestions? Anything else I am missing?
  14. Should you spend your spare time learning how to make video games? Absolutely! Should you quit your job and go into gamedev? No reason you need to decide now.   Download Unity or Unreal and follow the tutorials to make simple games. You'll find it's really rewarding to just make something move! Gamedev is like the ultimate sandbox. You can do anything with it!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!