Dev Notes: Initial 3.10 maintenance effort - openly-retro/stellaris-machine-robot-expansion GitHub Wiki
Big refactoring under way. I am working on putting in the 4 subclasses for the 3 leader classes. I'm starting with the Commander class.
There is a lot of tech debt in the localisations files. Lots of things needing to be renamed. Fortunately, once they are all said and done, they can be copied to all the other languages' folders.
The tooltips for the leader subclasses show that there are some considerations for the bonuses of the subclasses. If I'm adding new subclasses, they may have to have bonuses and costs set. Or just copy from the earlier subclasses for now..
VSCode with the cwtools extension is fantastic. VSCode is a beast in terms of search and replace. It is SO handy with all the stuff that needs to be renamed. And the cwtools extension gives me so many hints that I'd never pick up on my own. This PDX script absolutely needed an extension because it is custom-made. Without the extension ... who am I??
Stellaris GUI work is a little weird but not too bad to pick up. It uses a window system with X and Y coordinates for location, and integers for width and height. Then elements within the box get their own XY coordinates. If we want a grid then we have to calculate the next position of an item in a row. There is some Stellaris math that's helpful, we can use @[ somevar <operation> anothervar]
to calculate things.
I am thinking of taking all the GUI vars out of the .gui
files and putting them into a single constants declaration file. It's a bit awkward to scroll up and down the entire .gui file to find a var.
One very cool thing is there is an entire Korean translation in the original mod. It makes me think the author is Korean, as no other translations were included.
Jumping into refurbishing this mod has been pretty exciting. There is a LOT of repeated code, and I'm wishing for little scripts on the side to help auto-generate stuff. I started a spreadsheet for tracking effects names, for each trait. I am not sure if I want to write any scripts now, but for future maintenance, some python scripts will really help. Probably a spreadsheet is enough.
I'm also dreaming of a tool to extract all the variables from a translation file into a spreadsheet, so that a translator can use the sheet to add their preferred language's translations.
I have been searching the code for exactly how does clicking on a subclass button in the leader-maker GUI cause the subclass picker window to "go away" and reveal the trait pickers underneath. I suspect it has something to do with the dummy button effect somehow resetting the position of the window. I wonder if there is a way to dynamically "hide" (move the window to an invisible place) the window in an effect. I am worried about this hidden functionality (if it is a hidden functionality) being deprecated in a future version of Stellaris and then we will be caught off guard.
I spent time carefully searching all of the mod's files but didn't find anything that explicitly resets the subclass picker window when a button is pressed.
Renaming the GUI sizing variables to say "row" or "column" was very helpful in understanding where things are in the layout. https://github.com/openly-retro/stellaris-machine-robot-expansion/commit/ac637714465ec09d3d37cd49ada4677310dd6cc9
Tweaking the GUI is less of a daunting experience now. It is a bit overwhelming re-ordering all the traits by hand. I think it's worth it to make tools to generate code for different sections of the GUI, to manage effects, etc. Using python would be a cinch. Format strings and do simple substitution inside. Going to need a data source however. Probably the easiest approach is a spreadsheet. Put all traits, class, subclass, has_paragon_dlc, etc.
Maybe even a vanilla trait scraper... but I would need a parser for that. I don't feel like writing one, or using cwtools' parser bc even though it's amazing, it's written in F# which I have no motivation to learn right now.
Need tools especially given the scale of everything. Tooltips for all the traits are duplicated across leader-builder, core-modifying.. the potential for typos on all that data is huge.
Core modifying screen looks tidy now.
Leader-building GUI is tidy also. and 100% functional even though a lot of the tooltips are broken.
Interesting that the icons are all black, on top of a green or red background!