Getting started with modding

Post here if you want to help developing something for FAF.

Re: Getting started with modding

Postby Sheeo » 07 Feb 2015, 07:54

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.
Support FAF on patreon: https://www.patreon.com/faf?ty=h

Peek at our continued development on github: https://github.com/FAForever
Sheeo
Councillor - Administrative
 
Posts: 1038
Joined: 17 Dec 2013, 18:57
Has liked: 109 times
Been liked: 233 times
FAF User Name: Sheeo

Re: Getting started with modding

Postby Ksi » 04 Apr 2015, 17:33

Hi! New Supcom player here (got only ~30 games under my belt). I got interested in doing some modding for FA, as a project to learn a bit about LUA and object-oriented programming (I have some basic knowledge of C and JAVA, but that's it really).

Got a couple ideas for mods so far. The second one is a long-term plan, considering my current lack of coding skills. :) If you have any tips or suggestions, I would really appreciate a helping hand in getting to grips with the basics.

Smart build queue
-Allow adding specially flagged units in the queue, which bypass the infinite repeat function. (Click on the build icon with a modifier key). Useful for quickly getting a couple of air scouts or a transport out of an air fac that's churning out ASFs on infinite repeat.
-When dragging unit(s) all the way to the left in the queue, don't cancel the currently building unit, but instead add the dragged units after the one under construction.

Classic RTS UI
-Minimap displayed at bottom left. Display units as small blips instead of as strategic icons (think Starcraft minimap)
-At bottom center display either the selection list, or build queue if a builder or a group of similiar builders are selected.
-At bottom right diplay a multimode command grid that displays the following, depending on selection:
[*]Unit orders (attack/move/etc.)
[*]Unit orders with a hotkey to access the build grid (for mobile builders)
[*]Build grid for buildings, with tabs to access different tech tiers and upgrades (mobile builders)
[*]Build grid for units, with tabs to access different tech tiers (factories etc.)

One challenge I'm facing right now is that I'm lacking a fast way to test the code changes I've made (I'm learning a lot by "reverse engineering" available mods, but restarting the game through FAF after every small change is getting tedious).

partytime wrote:If you want, I can provide those scripts I mentioned and the actual command line args I use. I also have a excel spreadsheet I made that contains all of the functions available ... kind of like luadoc but with heaps more in it that weren't mentioned. I built the spreadsheet by repr'ing all of the modules..

Yes please! Exactly what I need to speed up the code testing. :)

PS. For those looking for a good IDE, I'm using Sublime Text myself, and I find it works quite nicely, as it allows finding function definitions pretty quickly with the search function that spans all the files and folders included in the project folder.
Ksi
 
Posts: 2
Joined: 30 Mar 2015, 19:20
Has liked: 0 time
Been liked: 0 time
FAF User Name: Ksi

Re: Getting started with modding

Postby The Mak » 04 Apr 2015, 18:55

Ksi wrote:
One challenge I'm facing right now is that I'm lacking a fast way to test the code changes I've made (I'm learning a lot by "reverse engineering" available mods, but restarting the game through FAF after every small change is getting tedious).



/EnableDiskWatch

Add that line to the Target line of a shortcut to the FAF ForgedAlliance.exe. This allows the engine to monitor any changes to game files. If a change has been made it will try to re-load the file. This is especially handy when editing units, but you need to build / spawn a new unit for the new changes. Kind off handy when you want to compare changes: build a unit, make the file changes, and then build another unit. Now you have two units with different stats so you can see how they play out.

I do not know how that will work out for UI elements. I know there are console commands to turn on and off the UI, so maybe that can work.

As an example, here is what my target line for my shortcut is:
C:\ProgramData\FAForever\bin\ForgedAlliance.exe /log Maklog.txt /enablediskwatch

Here is a listing of other command line switches as well as other useful information.

You really need to go through the old wiki that I linked for you back in January.
User avatar
The Mak
Contributor
 
Posts: 342
Joined: 03 Mar 2012, 21:09
Location: New York, NY, USA
Has liked: 5 times
Been liked: 39 times
FAF User Name: The_Mak

Re: Getting started with modding

Postby Ksi » 04 Apr 2015, 19:19

Thank you for the response!

I already bookmarked the wiki page, just didn't start going through it yet. :) I'll definitely try the /enablediskwatch parameter too.
Ksi
 
Posts: 2
Joined: 30 Mar 2015, 19:20
Has liked: 0 time
Been liked: 0 time
FAF User Name: Ksi

Re: Getting started with modding

Postby Dragonfire » 05 Apr 2015, 12:07

Debugging is possible:

http://forums.gaspowered.com/viewtopic.php?t=1847

Maybe start a new wiki page for all the stuff?
My native language is not english, please correct me, because I want to improve my skills # Resource Overview
User avatar
Dragonfire
Evaluator
 
Posts: 559
Joined: 19 Dec 2013, 10:18
Has liked: 39 times
Been liked: 61 times
FAF User Name: Dragonfire

Re: Getting started with modding

Postby nine2 » 05 Apr 2015, 12:19

Are u sure? Its said that debugger dies NOT work
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Getting started with modding

Postby speed2 » 05 Apr 2015, 12:20

Dragonfire wrote:Debugging is possible:

http://forums.gaspowered.com/viewtopic.php?t=1847

Maybe start a new wiki page for all the stuff?

Yes! Wiki is just waiting for you guys to contribute. Feel free to unleash your furies there and write as much as you can.
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Getting started with modding

Postby Dragonfire » 05 Apr 2015, 12:22

Some modder show me that, but it is not working on all machines...
My native language is not english, please correct me, because I want to improve my skills # Resource Overview
User avatar
Dragonfire
Evaluator
 
Posts: 559
Joined: 19 Dec 2013, 10:18
Has liked: 39 times
Been liked: 61 times
FAF User Name: Dragonfire

Re: Getting started with modding

Postby nine2 » 05 Apr 2015, 13:02

Are u aware of any single machine where it does work? I am not. Would be so nice
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Getting started with modding

Postby Dragonfire » 05 Apr 2015, 13:10

If I remember correctly it was washy...

viewtopic.php?f=41&t=8700#p83509
My native language is not english, please correct me, because I want to improve my skills # Resource Overview
User avatar
Dragonfire
Evaluator
 
Posts: 559
Joined: 19 Dec 2013, 10:18
Has liked: 39 times
Been liked: 61 times
FAF User Name: Dragonfire

PreviousNext

Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest