Jeroen De Dauw wrote:partytime wrote:Disclaimer 1: I am a noob myself.
Disclaimer 2: I'm doing this from memory so the exact keywords are incorrect.
Thank you for the info!
Starting guide. There are lots of tidbits floating around on different forums with examples but normally just find a mod that does something similar and look at it's code. Critically, the FA code is overridden by the FAF code which is overridden by your mod.partytime wrote:IDE - no way. No go to definition or test runner. Think notepad. I use visual studio because it's just a nice text editor. You can get plugins that understand lua (syntax highlighting) but I don't use them. Basically all you need is something that can find text across many files at once quickly.
I installed the lua plugin into my IntelliJ IDE. (Cannot link it due to derp forum restrictions.) This has things such as go to definition. I've yet to see how well this works for the FAF codebase.partytime wrote:Feedback cycle. ...
I'd like to do this on my Linux box, which means booting the game is not an option. (Well, I guess I could go the VM route, though that is a lot of hassle I rather avoid.)
One question I have now that has not been answered as far as I can see is to what extend the code one typically touches with mods can be executed (and thus tested) without running the game itself. And to what extend this code depends on Windows.
The lua plugin for intellij's "Goto definition" feature works sporadically, so you can't be certain that it points you in the right direction (This is not taking hook files into account!). Use double-shift and do a search for your definition to be sure.
With a few regex tricks to replace GPG's custom lua syntax, you can execute the game code with a lua 5.0 interpreter.
We use luac5.2 as a fancy syntax-checker on our FA repo: https://github.com/FAForever/fa/blob/develop/.travis.yml.
There are no unit tests, and to actually execute useful code, you'll need to define some functions from the engine API. Work on this hasn't really gone further.