petak, 26. siječnja 2018.

Preview release v0.6.4

Now that holidays are over it's time to get back to work. And what a better way to kick off a new year by doing something crazy: own GUI engine.

Download Stareater v0.6.4-alpha

Making own mouse and keyboard event handling, element positioning, drawing variable length borders, state handling, positioning text and images inside elements and many more gotchas sound like a lot of complicated work. But when you look at the project code you'd see good deal of that already implemented. Turn number on galaxy map and bombardment buttons in postcombat bombardment are the most prominent examples, galaxy map scrolling and interaction is a subtle one which also uses most of aforementioned features. So it was mostly a matter of restructuring already existing code and thinking through some details. And think it through I did, after all, I've abandoned very first Stareater incarnation due to GUI logic getting too complicated. Since then I've seen a lot of GUI code, both in use and details under the hood. I saw a lot of interesting approaches and a lot of bad realizations.

I've looked for existing solution I could use but they were either one of bad realizations or couldn't smoothly integrate with C# and OpenTK. Still, I have to give credit for an effort to Gwen.Net, a port of C++ library to C# with OpenTK. It's easy to integrate and emulates WinForms quite well. And that's the problem, I want to get rid of WinForm's look and feel. Gwen's skinning support looked very convoluted, you had to look through code to figure out which pixels on texture did what and documentation is practically nonexistent. Also I'd like to work with more modern layout mechanisms, something where it's easy to say "put this button at the bottom right corner" and have a framework calculate exact (x, y) coordinates and update them when window resizes. Something like GUI framework in Unity Engine and Android framework. WinForms is very limited in that area and from what I managed to dig out from Gwen.Net the situation is not much better there either. So I rolled my own framework and replaced old end turn button. Visually it needs more time in the oven but that's a challenge for another time and it would be an issue with any GUI framework, all of them expect you to bring your own artwork.


Core game feature in this release is colony maintenance, bad planet traits increase maintenance cost per population and it's payed up by whole nation. If maintenance cost is greater then 50% of nation's productivity then colonies in the worst shape will suffer population loss. Reason for including this mechanic is to make bad planets less desirable since they are going to put a burden on all of your colonies, to make star "catalysis"(afflicted by stareater's native organisms) bigger problem for a player and to make terraforming and building up more desirable. This also gives me an opportunity to fill some gaps in tech tree :).

Finally, another tier of technologies has been worked over and again it took more time then expected. In fact it took more time then making new GUI framework. Reason this time around is that I decided to make few changes to the tech tree: to remove limited use technologies. In Master of Orion 2 when you research new type of armor all previous types become obsolete. New ships are automatically built with the best armor and there is no trade-off between lower and higher tier armor. In Master of Orion 1 there was some nominal trade-off, lower level tech costs less and takes less space but even then I rarely went more then one tier below highest available. Something similar was in old concept of Stareater tech tree plus the fact that techs in Stareater can be upgraded with more science investment. I don't think it would play well "dead end" techs. Why would you invest a lot in an item that would go obsolete. In case of armors I've removed all techs that unlock particular armor type and replaced them with two techs: one which unlocks new types of armor material as you level it up and other which improves armor quality (level within armor type). Ditto for reactor technologies, reactor type tech and reactor level tech instead of one tech for each type. For computers, sensors and interstellar drives I'd make a mix of cumulative upgrades and special abilities. Quantum computer would increase instead of replace electronic computer bonus, lidar would add up to radar bonus and provide "telescope" ability for increased detection strength in a narrow cone, inerstellar drives would have unique movement abilities, etc. Thrusters are still one foot in old concept and one foot in new one, there will be less thruster types and upgrading them will provide some economic bonuses like lower space lift penalty due to gravity and increased migration capacity.

This left a few holes in a tech tree and by moving few items around I might go back to originally planes 7 tiers per field. Physics is still cramped full for 8 tiers while biology and sociology are very sparse, sometimes having only one item in a tier. Work on tech tree is still in progress, I hope to fill the gaps with techs for missing features (trade treaties, espionage, fuel range) and end up having 3 items in every tier in 7 tier model.