GUI and C# compilation time
This week, little bit of work, towards the following GUI elements and C# code reorganisation
GUI: Item Description Panel
Previously, when moving over different inventory items, all you got was a context menu: drop, equip, use, etc, depending on the item. Of course that's not enough -- an item description panel is pretty much essential, in addition to all that! So I started working on that, although some mini refactor "opportunity" promptly appeared, with regards to enchantments. Previously, an enchantment could be for e.g. attack rating (chance to hit) which would specify a scale/bias factor that could be applied to a base value ( e.g. a*x+b, where x is base value, a is scale factor and b is bias). This ended up being a bit annoying as for some effects, one of the two values would be default, e.g. for an armor that gives you 50 health, you'd need a bias value, and for a weapon that does 10% more damage you'd just need a scale value, so it was a one-stop-shop kind of abstraction with too much waste. So now it has been split so that there are separate enchantments for percentage-based quantities or absolute quantities. This means there are more enchantments (.e.g AttackRating and AttackRatingPct for absolute and percentage-based modifications) but the extra granularity is worth it
GUI: Calendar rework
Changed the widget size and shown details. Smaller fonts, split date to separate day/month/year, hour/minute/second and millisecond/microsecond (ludicrous I know, but it's for resolving turns close to each other, and is greyed out a bit as it's mostly unnecessary). Time-of-day image has reduced in size, so that it overall looks a bit more appropriate, still not perfect, as I thought it needs a nicer border. I tried a quick shader-based parchment-style look, but still not great, I thin it needs a border texture actually.
C# compilation time
This is a laptop problem mainly, but desktop isn't great either. The project has grown enough so that making a single C# change, which causes recompilation of the entire project, is slow. For the desktop is several seconds (yeah maybe I'm lacking patience) and for the laptop is about 10-20 seconds iirc, which is really annoying to me. Now, problem no1 is that when working on the laptop, I'm now actively avoiding compilation of code often, it's not ideal. Problem no2 is that even on desktop I can feel the tumbleweed during compilation, and every second is an additional opportunity to distract myself for 5 minutes "oh let me check this while it's compiling". Problem no3 is that in the summer I'll be away for a month, with just my laptop, and while I don't plan to code often, well it's going to be slow. So I've been cautiously looking for ways to improve the speed.
In Unity, this is possible with assembly definitions. Godot does not support such a thing as far as I'm aware, so the process is manual. After experimenting a bit, here's a setup that looks like it's working:
- Add a class library in the C# solution
- Explicitly reference the folders in the codebase that this library will use
- Explicitly remove the folders from the being scanned in the "main" project, using this
- Add a reference of the new library in the main project
- Add a reference to GodotSharp.dll in the new library if Godot code is needed, and of course references to any other libraries
This so far seems to work, and the goal is to organize the code into 4-5 libraries (core, game, ui, tools, maybe break game to a few). This means, that I can work on UI from the laptop, and every change means recompiling 45 files rather than 590 files (as of now). To be continued.