Day 6:
Today was spent figuring out the economy system (resources, trading, production, etc). I think I done it in the best way I could given the time we have for this jam. I created a list with all the objects, and if they're "craft-able" they have a list of ingredients, within the game each city goes through this list and checks if it has those resources locally or imported or produced, if so then that resource gets added to production and exported. This resource list is a simple JS Object literal, so I can add loads of resources and create complex production chains pretty easily. The biggest issue will be will balancing the resources over the map, working out what's best for each city (or at least region).
Another challenge is going to be how to place limits on routes so you can't just spam out for all the resources. My current thought is that you can only have 1 route FROM a given city. So to get resources into a "hub", you have to send them from the other cities. This forces you to expand and set up routes in a chain fashion. That hub city will then be producing the best stuff it can, and so a trade route FROM here will have a large cultural impact.
Here's setting up a small economy during testing:
![](http://i.imgur.com/UzVKCoh.gif)
I'm going to show a bit of code for a change as well. This particular piece works really well, but I have a hate for it's complexity/odd flow. But this is what tends to be resorted to in a jam where you may be in a rush :P
![](http://i.imgur.com/z15i6iq.png)
It's the "newResource" aspect that I don't like but couldn't think of a more elegant solution at the time. Basically, what it does is if you start to produce a new item, go through the list of craft-able items again. This is so that the item you produced can be used as an ingredient in production of another item. For example, if the city is making bronze, it stands to reason they'd use it to make tools. I try to avoid "IF-ageddon", seems I failed here! :P