Spitballs - AGermyContagion/Simulator GitHub Wiki
How trade works
Premises:
- The farther a demander is, the less likely a supplier will trade to them.
- The higher the population of the demander, the more likely a supplier will trade with them.
- The more suppliers a demander has, the more likely a supplier will trade with them.
- If trade occurs between two cities for X years, then a dirt road will appear on the shortest possible route between them.
- If trade occurs between two cities with a preexisting road for X years and is profitable, then the road will be upgraded.
- Upgraded routes (aka better roads) speed up trade, and result in more trips and more money.
- Distance will matter less on the oceans than on land, although coastal sailing will be prefered over ocean sailing.
Lets say with City A makes a lot of Iron. City B needs Iron, has 1000 people, and is 500 miles away. City C has 800 people, and is 1000 miles away. City A will trade Iron with City B, because although the trip costs them 500 Gold, they profit 1000 Gold when they sell their goods. City C is too far away to be profitable for City A (values not final).
Later on, City D is built. City D ends up being the largest city in the continent, and although it is 3,000 miles away, has a population of 5,000,000, and trades with many other cities, and thus City A has a high incentive to trade with them.
Other Resources:
http://www.instructables.com/id/Make-Tic-Tac-Toe-in-Java/?ALLSTEPS The "famous" Amit (with the giant page of various game programming topics) has a game programming blog, and he just completed a 3-part tutorial of an interesting method of map generation. I really enjoyed the reads, and there's a working demo in the bottom of the third article which is pretty stellar. "Polygon map generation" part 1, part 2, part 3. This may be a technique that you want to adapt to your needs! At the very least, he mentions the algorithms he uses at each step of the process: he starts by generation Voronoi polygons, relaxes them to a more even distribution using Lloyd relaxation, uses "a simple function to divide the world into land and water", and then flood fills to determine oceans and lakes. It sounds like you can stop there, or read on for mountains and valleys and turning it into 3D and so on.