1/8/2017 in devlog
It seems like the team has made a few New Year's resolutions. At least that would explain the frequent mentioning of automated tests in this issue of our development log...
I had a very productive start into the new year and completed large parts of the server-side code required for commodity exchanges.
As all areas of the game I've worked on recently, the commodity exchanges are a core feature and as such have existed in the codebase for a while. The commodity exchanges in particular were never even deactivated (like the production code) because I used them for my interface prototypes last year. But still, up until now they were missing a crucial functionality required for an actual release: Escrow.
So far, when a trade happened on a commodity exchange, all the broker did was to set up a contract between the buyer and the seller and the two parties had to then fulfill this contract by paying for the purchased goods and delivering them, respectively. As you can imagine, this can be cumbersome and -- more importantly -- quite risky. Contracts can be broken, after all. Therefore, the initial exchanges operated by NPCs offer escrow services: The seller has to deposit the goods for sale and the buyer has to deposit the maximum amount they're willing to pay. Once a deal takes place, the goods are delivered immediately and the seller has their money in the bank right away.
Technically, the game now allows for all options: Purely escrow-based exchanges, simple brokers that only set up contracts and a mix of both (for example escrow for payments but a contract for the delivery). The reason for this is that players will eventually be able to operate their own exchanges and they will have to decide whether to offer escrow or not. There are advantages and disadvantages to either option.
Anyway, I got most of the server-side code done but I'm still busy completing a proper test suite for as many possible scenarios as possible. These things tend to become complex quickly, with several entities involved (buyer, seller, broker, ...) and various complicating factors (trades in different currencies, insufficient storage capacity at the buyers's end, trades with NPCs, ...) making things...well...complicated. So this will keep me busy into the next week before I can get started on finishing the interface integration and hooking up the commodity exchanges to Michi's awesome data visualization framework.
The last thing I worked on before the holidays was the server part of the universe map visualization. I told you in the last dev log entry that we figured out how it should work but haven't had to time to implement it. This week I finished implementing it :)
It works like this: A data source (say a commodity exchange) calculated a new price for a product. It tells the newly created visualization actor about it. The visualization actor then accumulates these price changes from all data sources of that kind and, after a certain time, sends it to all clients that are interested in that information. All this is hidden from the client, it just receives price updates in regular intervals and can graph them.
Besides the visualization I fixed some bugs in space flight and the display of ships. It seems like intensive refactoring has caused some data formats to change so the client wouldn't display and calculate these things properly anymore. Since we are usually focused on one thing when implementing something we tend to forget to test if everything still works as it should.
Maybe one of our early goals for this year could be to create a small staging environment for the game where a few players (and we developers) can test new features and see if everything works like it should. That way we instantly know if we broke something. Of course we are writing automated tests for the client and the server code, but it seems that most of these errors occur when the two have to work together. So eventually, we'll have to set up proper, fully automated integration tests.