Sea Trading Game- Speed improvements, finishing city personality

This was a somewhat slower week, but still productive! This week there are a few new changes that really make a difference. The first is finishing adding city personality items. The personality now fully works, including testing!

The biggest improvement, however, was in speed improvements. I did a lot of code profiling this week, and found where there are bottlenecks in my code. The biggest ones are in my A* implementation, which I was able to speed up quite a bit. I still have a fair bit of work to go, but the game has gone from occasionally having unplayable slowdowns to simply noticeable slowdowns, which I am confident I can make go away. That should make things much smoother! For the technically minded out there, I found that using arrays instead of dictionaries can make things go much faster, especially for things that change a lot.

The other thing that I’ve done is to start to re-write the contracts system. Contracts now will be to carry a good that is in short supply to somewhere needed, or to bring in a good that is much needed. I’m still working the details out, but it’s coming along!

I hope by the end of this week to have most of the hard stuff done. I might even have a test build to try, likely one that I will only send out to my Google Groups page. The key things that I am trying to do is to finish the contract model, and to model shipping by sea to other locations. I might even model moving from a land based city to a sea based city. Thus far I don’t have any land based cities, so… I’m hoping by mid-September to have something that’s in really good shape, possibly ready to start bringing it to the next level!

Sea Trading Game- City Personality

It’s been a slow week, but it happens. I’ve been making good progress towards my city personality definition. While I’m at it, I’ve improved pretty significantly the goods generation process, as well as the consumption process. They both are working much better.

Goals for the coming week are to distribute the city personalities, and work on spreading the demand from neighboring cities. I’m also planning on overhauling the contract management.

Sea Trading Game- City needs, consuming goods, land based navigation

This was a very productive week, which allowed me to accomplish most of the goals I had set for the week. I was able to create generalized city needs, consume goods, and even start update to the mission profiles such as land based navigation.

The biggest thing was working on City Needs. A City Need is defined as a fundamental need of a city, namely those that can be transported. These include things like food, water, clothing, building materials, and even non-needs like luxuries. Each good is set such that it will satisfy one or more of these needs. Demand then is not for a specific material, but rather a “need”. I will likely set some specific “needs”, most likely for things like drugs, but otherwise it will be more general.

A city can now consume these goods. Consumption of goods will increase the happiness of a city. Failure to meet the needs will result in the people being unhappy. I might even add in a death connection, I haven’t figured out all of the details.

I’m working towards connecting all of the cities, keeping a list of the distance between each city. I haven’t yet optimized this list generation, it can take considerable time, but I’m getting there, slowly. The rewards for missions is now more in line with the rest of the system.

I also added a super secret invisible dev panel, to assist in debugging things. For instance, I’ve added a calculation of global supply/demand, as seen below. Note that is tells me that balance is required, as there are too many of some materials (gold, silver, rum, tobacco), and not enough of others (water, good, wool). Of course, I haven’t even yet tried to arrange the material generation in a more logical manner.

Lastly, I wanted to show how being at a marginal demand can affect price. Here’s an example of the price changes for a material, as one purchases most of the good, the price goes up.

This week I’m hoping to do some work on flushing out a personality profile for a city. These will include things like how much storage of an item do they require, how willing are they to try new things, do they value people’s happiness more than money, and related attributes.

Sea Trading Game- Price based on Supply/ Demand!

Modeling supply and demand is proving to be quite difficult, but I am most certainly making progress. This week I was able to increase/decrease the price based off of the supply and demand, including the short term future supply/demand! This actually took considerably more effort than expected. Previously, I had code to estimate a year’s worth of supply and demand, to determine what goods to work on. This was relatively easy. What was far more difficult was to determine the average supply and demand for a sliding window of time. Just that feature took me far longer than expected, and in fact, took almost the entire week. In fact, if you compare my to-do list with last time, you might notice a slight increase in the number of items. The good news, these should be quicker things to complete than what I finished this week.

Aside from that, I was able to use this feature to adjust the price based off of the supply and demand. The price will adjust somewhat, so purchasing a large block of goods or selling a large block of goods can affect the price and be adjusted for accordingly.

Lastly, I was able to add in a “rot” feature, where a good will go bad if sitting in storage for some period of time. There are a few more things that I want to add to this calculation, including thievery, reduced rotting if properly stored, and quite a bit of balancing, but it’s coming along slowly.

On the table for this week is a problem I’ve long debated, and have been unable to find a suitable answer yet. There are many types of food, grains, meats, etc. I don’t want to particularly care what type of food is eaten, although I want to store the type of food individually, at least to some extend. For instance, Sheep and Wheat will have very different behaviors, and I want to model that. The question then becomes how do I determine how much food to eat, and of what type? I have a few ideas that I’m going to play with this week, we’ll see what happens.

Lastly, a bit of a note about references. For those of you long term followers of this blog, you will know that originally I was planning a 17th/18th century time frame, the age of colonization. As time progresses, I’m shifting that time-frame earlier. The start of the game now is planned for something shortly after Columbus sailed to the United States, perhaps most of a 1530 starting time-frame as opposed to 1610 that I previously considered. A big part of this was an excellent book that I have read called 1493, by Charles C Mann. It has inspired me to change the focus somewhat of the game to the Colombian Exchange, where before Columbus arrived in the Americas, diseases, plants, animals, and even cultural references were very regional, while after the entire world began to exchange these items.

What things are purchased with my Amazon Affiliate Link

I have an Amazon Affiliate link. Most of the links are for specific products, however, people end up buying all kinds of stuff using this link. This is a list of some of the more interesting things that people have bought so far this year using my affiliate link. This is a small collection of the things that have been purchased, still, they are among the more interesting ones. Note that if you don’t see the images below, you might have an ad blocker enabled, you might want to disable it for this post.

 

Thanks to everyone who has helped support this site by using my affiliate links, no matter what odd things you purchase. You guys are awesome!

In case for some reason you can’t see the images, here’s the text list.
  

Sea Trading Game- Supply now determined by demand

This week was a slower week than many, but I did still make progress. As in previous weeks, I’ve been working on supply/demand, and figuring out how to get it. This week much of my time was spent supporting an Android app I made for Amateur Radio operators, Ham Finder. It took longer than expected, but it was necessary, and now I can focus on what I really want to work on, my Sea Trading Game!

Each city now automatically determines what the supply/demand requirements are for a given turn. Each city does this by estimating it’s yearly requirement for a given good, and making goods accordingly. It’s still not perfect, but it’s good enough for early testing. It works now, although the system is quite primitive. I’m going to eventually add in more logic, some kind of behaviors. The behaviors will determine how much goods to stockpile, if the city wants to make money, be self-sufficient, or other such things. That of course will take time, I’m hoping to still get to it by the end of the month.

On my plate for this week is determining the price based on Supply and Demand. I have an idea of what I want to do for that, that will take in to account the current supply/demand, the short term future supply/demand, and what is the intrinsic value of an item at a particular location.

If I get that to where I want it, then I’m going to do a few other things, including have supplies consumed by the people, probably rotting with time, and hopefully “Good Families”, where demand is for a family of goods, like food, as opposed to a specific type of item, like grain, meat, etc. I haven’t thought exactly through what I want to do with that, but I’m getting there.

Lastly, I showed you my list of things to do last week. Compare that to this week’s list, and you’ll see that I am in fact making progress! Note that most of the things on the bottom of the first list are to refine things that I started this week.