Weekly development report: 2020/08/08


Finally, the work of replacing GTK library with Tk comes to the end. Last things which were to do are done: finished debug UI and the UI themes system. Also I started fixing bugs. In around 24 hours since this post, the new ugly and buggy development version of the game will be available for download from the GitHub release page. Now some more details about the whole process.

The preparation

Generally, the preparation started when the development of the game was started. Then I made the decision to split the game mechanic code from the game UI. Just before this work started, the only decision was to keep the game code structure (file names, packages purposes, etc.) that same.

The journey

Splitting the game mechanic and UI code allowed me to avoid a lot of work and of course, a lot of new bugs. Basically, the game core code required only two small changes in the game default configuration settings. All other things are unchanged, thus there should not be any new problems. Also a lot of the old UI code was used again. The goal of the first version of the new UI was to finish work as fast as possible, thus for now a lot of work with beatification is still missing. At this moment I'm probably biased toward Tk but work with it was a lot nicer (and required a less code) than with the GTK.

The biggest change compared to the old version of the game (except a new look and feel of course :)) at this moment is the UI templates system. GTK was using CSS (very bloated to be honest) for setting UI, Tk uses simple Tcl scripts. Which may lead to some interesting effects. But about this later. For now one thing is sure: old themes unfortunately will not work. Also, there can be some problems with the game old configuration files, but this may be possible to fix before the stable release.

The whole process was similar to frog's jumps: a lot of old code copied and pasted (jump, a lot of things back to the game) then tweaking, fixing and generally updating it to the new version (no jump, no new things).

The effects

The main purpose of this change was to attempt to reduce the size of the game. And I must write that this one was reached :) Especially on the Windows version of the game. It's size was reduced by around 60-70%. On Linux there is also some reduction but not that big. But as mentioned above, this change also brings other interesting options.

Because the Tk library is mainly written in Tcl, there was a need to create an API between the game mechanic code and UI. Exactly public C API. And this means that Steam Sky now can be completely changed with an external code. And I mean not only add new factions(races), careers(classes), this was available earlier with modifying the game data files, but also the whole game mechanic now can be replaced or upgraded. And not only by the code written in Tcl but also by code written in any language which can use C code. Or if someone prefers, it is possible to execute an external code via named pipes: in that situation, any programming language which can read and write to standard IO can be used to extend or replace the game code. At this moment the whole "modding process" is very tricky: it requires you to modify any UI Tcl script (so the external code will be loaded to the game). But possibilities are interesting: for example, ladies and gentlemen I present to you Steam...Angband?. In the background you can even see the whole modification to the file `mainmenu.tcl` :) In that same way you can replace the whole combat or remove crafting from the game. Also at this moment, getting the game data (like info about the player and his/her ship) can be very hard. The whole plugins/modules system will be created later, for now here are other plans for the game.

Also here is another option which appeared after replacing GTK library with Tk. But at this moment I have not tested it yet thus for now I don't want to write yet about it. I hope I will find some time before the next big stable release for it. If not, soon or later it should appear too ;)

The future

And what next? Well, first of all I'm back to standard 4-weeks periods for the development releases. Thus next development versions will be a lot faster than this. Also the main goal now is to make the whole UI more user-friendly. The current UI is still from the console version of the game. Time to finally upgrade it too :) Plus of course, fixing all these new bugs which were added during the game transformation. The next stable version probably doesn't bring too much changes in the game mechanic but should has a lot of visible changes :)

Get Steam Sky

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.