Monday, September 19, 2016

Sea Trading Game- Trust Factor, Upgrade Buildings, Automatic flow of goods, prefer closer cities for missions

This was a week of a whole bunch of little fixes. There are a number of little things that I needed to do in order to start adding more goods. That is the major milestone that I'm working towards at this moment. I was able to finish almost all of them.

Fixes this week include:

1. Transporting people will actually cause a loss of talent and people from the original station, and bring that to the new location.
2. Goods now will flow automatically, albiet rarely, from city to city.
3. Missions now have a preference towards closer cities, not having to go so far out.
4. Automatic good and people transfers will prefer closer voyages as well.
5. There are more types of buildings in a city. These buildings will be mostly hidden, at least initially, although I have hopes to include them in a photo of the city. These buildings will allow for the production of various types of goods in addition to what they currently do.
6. There is a trust factor. If you complete many missions for the same location, then it will tend to trust you with more cargo.

I also did an appraisal to review every time in code that I have listed an item as needing to be done in the future. Many of these I was able to do now due to updates I've made in other locations in the game. I did add an action item list to keep track of all of these things, and moved a few of the higher priority ones to the top of the list!

This week, on my agenda, is to prioritize a bit more my to-do list that I captured this week, to do some speed enhancements by object pooling, and to finish a few upgrades that I need to do to allow for entering goods. If I get all of those changes done, then I will start with the fun stuff, namely adding goods. I'm hoping to include a LOT of types of goods, my goal for this initial pass is maybe 30-40, or even more if I can make it happen.

Lastly, I'm going to leave with a request for some feedback. One of the things that I think is the least clear in the game is the ship dialog. Part of that is the poor graphics, which I've included below. I'm very much in favor of changing just about anything. Please let me know what you think!



Things that I'm looking out for:

1. I would like to have different types of holds.Currently I have hidden compartments, very secure storage, two types of passenger cabins, and a generic hold, plus an area that isn't set up for anything. I'm considering more options.
2. Some goods will prefer certain types of holds.
3. The ship should be configurable.

Right now I have the tile based system seen above, where each section of the hold can be independently configured. I was hoping to someday make the outline of a ship out of this somehow, but I haven't quite figured out what I want to do. I'm curious to see what ideas you have. Thanks!

Monday, September 12, 2016

Sea Trading Game- Improved missions, pathfinding speed, trade goods in the background, and better population distributions

This has been a pretty productive week, and once again I'm starting to really make some good progress. My list of things to do is mostly relatively easy, except for the re-balancing which no doubt will be a long term task, and adding new goods. I even put out a test build to my Google Groups test group, although it has plenty of problems.

One of the first things that I did was to allow one to see more missions in the "Broker" screen. This proved to be relatively difficult, but it is now working as expected.

The next major task was to try and improve the frame rates, in particular when doing pathfinding operations. I did quite a few changes, including many updates to my C# A* I released to Github. All in all, I improved the speed by about 5 times, which reduces the lag considerably in the game!

That being done, the next task was to increase the mission level in a logical fashion. While no doubt I will need some improvements, including letting the user know when they have achieved a new level, levels are now in fact being updated behind the scenes. The effect of this will be to gradually increase the size of the cargo of the missions, which ultimately will allow for making more money. I'm still no doubt going to tweak the system somewhat, but it is coming along nicely!

People and goods now will be  moved around spontaneously. This will keep cities fed even if they can't produce food, for instance. It's still a primitive system, but it is coming along nicely.

Lastly, I improved how people are managed. People moving will actually transfer skills when moving from place to place. Also, the number of people in a given location is more realistic.

For the next week, I'm hoping to do a number of small systems on my plate. The most difficult of these changes will be to allow for goods to be manufactured in buildings, for things that require such buildings. Finally, I'm going to start working on a more realistic set of initial conditions, which should come together nicely. If I manage to get all of that done, I'll start adding goods, which you can suggest for possible credit in the game, especially for unique items!

Monday, September 5, 2016

Sea Trading Game- Making missions more meaningful

After making my ship move around the screen, the first thing that I did was create primitive missions. These missions were randomly generated, and didn't really mean anything at all, aside from a way to earn some money. That, however, has changed this week.

For those of you who have been around a while, you may remember that only one mission was ever assigned at a time. That is now quite different. Look at this one random collection of missions now created:






Note that there are a few missions to carry passengers, but most of them are to carry cargo. There is a third type of mission that I have defined, to bring cargo to the point of origin.

Previously these missions were completely randomly generated. Now they are based on a few things. People are more likely to want to leave a city if the moral in that city is low. There eventually will be consequences for that city, but for the time being, there isn't. Next, if there is a surplus of goods, then the desire is to send them to other locations. If there's a high demand and low supply for something, then it tends to request that you bring goods of that type to the city. They also will affect the supply of goods.

While I was going through this, I also overhauled the process of buying/selling goods. For once thing, I noticed that selling goods didn't increase the supply at the location the goods were delivered. I also need to improve the display of missions. The dialog doesn't work well with multiple missions, among other things it doesn't scroll, so for resolution challenged screens not everything can be seen. Last on my list before I can really do a new test build is to improve some algorithm speeds behind the scenes that result in a noticeable lag, particularly when docking with the first city.

Beyond that, I still need to do a lot of tweaking, things like adding new goods. If you would like to help me with that, please do! I have a google form set up to accept suggestions for goods to include. If I receive lots of help, I might even list you in the credits for the game!

Monday, August 29, 2016

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!

Monday, August 22, 2016

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.

Monday, August 15, 2016

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.

Monday, August 8, 2016

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.