How to make my mod FAF compatible ?

Everything about mods can be found here.

Moderator: Morax

How to make my mod FAF compatible ?

Postby Franck75 » 22 Aug 2016, 14:41

Hi, i'm working on my mod since several month and i'm thinking about to make if FAF compatible.

I saw on this forum that lots of mods broke when new FAF patches are released.

I have latest FAF installed on my computer, does it mean that if my mod is working it will be ok with FAF ?

Thanks for your help.
Franck75
Crusader
 
Posts: 13
Joined: 22 Aug 2016, 13:56
Has liked: 2 times
Been liked: 0 time
FAF User Name: Franck

Re: How to make my mod FAF compatible ?

Postby Uveso » 22 Aug 2016, 21:10

Hello Franck75,

theoretical yes.

But you could also post a link to your mod, an we can have a look at it.
Then we can say yes or no. (We need to see the error log)
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: How to make my mod FAF compatible ?

Postby nine2 » 23 Aug 2016, 13:47

You need to host a game through FAF, enable your mod, and play it, to see if it's compatible.

ie: if you aren't hosting through FAF then no, your test doesn't prove anything
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: How to make my mod FAF compatible ?

Postby Franck75 » 23 Aug 2016, 15:03

Thanks a lot Uveso and Ani for your answer.

My mod is working properly on orginal FA.

I did some test on FAF, and it crashed but i may be fixed i think. I need to make my code more readable in order requesting your help. I'm currently in dev and i'm not paying attention to make it easy.
I'm on 3k new lines of code now. I will take a little time.

But may i try by myself if i understand the FAF constraints.

I think i need to make my code hooking properly and editing not directly the full lua files. I suppose that lua files from original FA and from FAF are different.
I will try to do this.

But i need an answer : What lua files are modded by FAF ?

Thanks for you help.
Last edited by Franck75 on 23 Aug 2016, 15:09, edited 1 time in total.
Franck75
Crusader
 
Posts: 13
Joined: 22 Aug 2016, 13:56
Has liked: 2 times
Been liked: 0 time
FAF User Name: Franck

Re: How to make my mod FAF compatible ?

Postby speed2 » 23 Aug 2016, 15:07

Franck75 wrote:But i need an answer : What lua files are modded by FAF ?

Thanks for you help.

These files https://github.com/FAForever/fa
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: How to make my mod FAF compatible ?

Postby Franck75 » 23 Aug 2016, 15:11

Ty Speed. Very usefull link for any modder.

There are a lot of files. I go back working ^^
Franck75
Crusader
 
Posts: 13
Joined: 22 Aug 2016, 13:56
Has liked: 2 times
Been liked: 0 time
FAF User Name: Franck

Re: How to make my mod FAF compatible ?

Postby Franck75 » 23 Aug 2016, 16:30

Ok, after some tests, i've got a matter to be solved :

By hooking, it supposes that the original function is called before or after the moded code.
Code: Select all
local OldModFunction = ModFunction
function ModFunction()
OldModFunctions()
-- my added code
end

or
Code: Select all
local OldModFunction = ModFunction
function ModFunction()
-- my added code
OldModFunctions()
end

or
Code: Select all
local OldModFunction = ModFunction
function ModFunction()
-- my added code
OldModFunctions()
-- my added code
end


This add a constraint if some of my code need to be called into the original function.

So if i want to solve this matter i'm seeing 2 solutions :

1. I try to solve this by architectural modification on my mod in order to make my code called before or after the original code.

2. If it can't be possible, i need to do some destructive hooking by modifying the function.

Code: Select all
function ModFunction()
-- modifiying and adding my code
end


With Destructive Hooking, if i understand well, i may need to make 2 versions of my mod (if FAF changed the original FA modded file) : FA friendly and FAF friendly. Destructive Hooking will modify FA and FAF different files.

Am i wrong ? thanks for your help.
Franck75
Crusader
 
Posts: 13
Joined: 22 Aug 2016, 13:56
Has liked: 2 times
Been liked: 0 time
FAF User Name: Franck

Re: How to make my mod FAF compatible ?

Postby Uveso » 23 Aug 2016, 20:01

You are right :)

if you need a destructive hook (Overwriting the original function) then you need 2 versions of your function.

You could ask for the gameversion and decide then what function you will have to use.

Code: Select all
local version = string.gsub(GetVersion(), '1.5.', '')
version = string.gsub(version, '1.6.', '') -- steam
if version > '3649' then
    LOG('Gameversion '..GetVersion()..' detected. hooking for FAF will follow')
else
    LOG('Gameversion '..GetVersion()..' detected. hooking for vanilla/steam will follow')
end
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: How to make my mod FAF compatible ?

Postby nine2 » 23 Aug 2016, 23:57

That's pretty smart way of selective hooking.

However, just don't support non-FAF. No one plays it :)
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: How to make my mod FAF compatible ?

Postby Franck75 » 24 Aug 2016, 17:44

Thanks a lot for Uveso for theses very usefull informations.

Selective solution from game version is a good option for me. I think it's always a good idea to make the mod compatible with original FA since this version is carved in stone and because it's already functionnal for me.
Franck75
Crusader
 
Posts: 13
Joined: 22 Aug 2016, 13:56
Has liked: 2 times
Been liked: 0 time
FAF User Name: Franck


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest