Mod support & Train config
Whats going down in code land?
Mod support
Lately, I have been working on mod support. I wanted to get this done early in the piece, so that modders can start working their craft.Also I want to get feedback from modders to help improve my code API for them, and so would rather do this sooner rather than later.
For example, in writing the "Example Mod," which will ship with the game I wanted to replace the train with a customized version. To do this without any modifications to my code would take 5-10 lines of code. This was overly verbose, and as a result I modified my game code so that I could do it in 1 line of code.
The tricky bit with modding at the moment is that of breaking backwards compatibility as I continue to work on code. This is the bane of modders - when a developer goes and radically alters their code breaking mods. Unfortunately there is nothing I can do here except provide good communication over what has changed and why.
For research, I looked at Factorio, which has really good and plentiful mods. I also looked at Unreal tournament, which I used to write mods and mutators for many years ago.
Train setup/routing system
I have also been working on upgrading the train setup and routing system. I identified this is the biggest and worse user friendly system in the game and seeing as the user interacts with this system the most it must be a real joy to use.The original system I replaced worked like this:
(1) Click the train button to enter the train setup state
(2) Left clicking to add stations to the train route (with no way to see the route)
(3) Repeat step (2) until you think you have a good route
(4) Right click to apply and bring up the train dialog which displays how you
want to configure the carriages with different resources.
Here is a screenshot from a very early version:
Gross hey?
For my first attempt to revamp the system I tried a drag and drop system. The first thing I did was to ensure that a dialog would show up as soon as you entered the train state to list the stations you have added to your route.
A great improvement, but I had this massive dialog that was really taking up 90% of the avilable screen space as half the dialog listed the selected routes, while the other half showed the train inventory, the supply and demand and allowed the user to drag and drop resources around. Taking up so much screen space was not a good solution!
For my next attempt, I came up with the solution which I am very happy with.
It is very similar to Railroads in that I have merged the panel into a thin tall dialog. I realized I did not need drag and drop, as when you click you either are moving things into the train or off of it. One thing I don't like in Railroads is how it takes the user to a full-screen dialog - taking them out of the game. It disorienting and it is unnecessary. I want to allow the user to remain in the game to set things up and I also want to avoid stealing the camera from the user where possible (When this happens in Stellaris and Hearts of Iron 4 I get irritated!).
And here it is:
Whats happening in the art department?
In fact, my artist has been learning more programming! This is great since programming is always the slow point on any project, soon I will have him trained up and in the code gulags with me!I have even managed to get him to learn some C++. To that end, we have worked on a mini C++ project to get some foot pedals working on a project he has called "macrokey," which is on git hub: https://github.com/bit-shift-io/macrokey
The three pedals are like typing on the keyboard: a, b and c. So macrokey reads this input events, blocks them from going to any apps and converts them into mouse click events. This reduces the RSI pains that we both suffer from mouse usage.
Finally...
Now for something fun to leave you all with:
Have a great Christmas everyone, and let us not forget why we celebrate:
8 And there were shepherds living out in the fields nearby, keeping watch over their flocks at night. 9 An angel of the Lord appeared to them, and the glory of the Lord shone around them, and they were terrified. 10 But the angel said to them, “Do not be afraid. I bring you good news that will cause great joy for all the people. 11 Today in the town of David a Savior has been born to you; he is the Messiah, the Lord.
Luke 2:8-14