Vanilla missions are too easy! There is no sounds!

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

Vanilla missions are too easy! There is no sounds!

Postby Ze_PilOt » 29 Sep 2013, 18:20

The sound.
The sound format between SC and FA has changed.
They are both using "Xbox Wavebank Audio Data file", but probably with different settings.

If someone can convert the VO voices from supcom to FA (in sounds\Voice\us\), I will gladly distribute them.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: Vanilla missions are too easy! There is no sounds!

Postby Ze_PilOt » 29 Sep 2013, 18:26

The difficulty.

One of the main addition to FA campaign AI was the reaive AI.
The reactive AI is what produce most of the attack waves.

If you look at any FA campaign (in your map folder), you will see a serie of "m<number>AiName.lua".
These are the AI scripts for different missions part and ai brain.

Let's take mission 2 part 1 as exemple.
The only AI at that point is "The order". The file used is :m1orderai.lua.

It's imported in the main _script.lua file :

Code: Select all
local M1OrderAI = import('/maps/X1CA_Coop_001_v06/X1CA_Coop_001_v06_m1orderai.lua')


As it's on startup, the AI is created in the startup script. For others parts, they are defined in each mission intro/setup.

Code: Select all
    # -----------
    # Order M1 AI
    # -----------
    M1OrderAI.OrderM1WestBaseAI()
    M1OrderAI.OrderM1EastBaseAI()


Because the Order has two bases (west and east).

So in the AI script (m1orderai.lua):

Code: Select all
# -------------
# Base Managers
# -------------
local OrderM1WestBase = BaseManager.CreateBaseManager()
local OrderM1EastBase = BaseManager.CreateBaseManager()


That initialize the AI for both base.

Code: Select all
function OrderM1WestBaseAI()

Is the function called in _script.lua.

Code: Select all
local opai = OrderM1WestBase:AddReactiveAI('ExperimentalLand', 'AirRetaliation', 'OrderM1WestBase_ExperimentalLand')
    opai:SetChildActive('HeavyGunships', false)
    opai:SetChildActive('StrategicBombers', false)


These are the reactive AI.
What it means is that if the player is building an experimental, the AI will send some air, but without the HeavyGunships and StrategicBombers (these are presets).

That's probably the main thing you want to add.

At the end of that function, we have:
Code: Select all
OrderM1WestBaseAirAttacks()


It call another function that set up air attacks:

Code: Select all
    # -------------------------------------
    # Order M1 West Base Op AI, Air Attacks
    # -------------------------------------

    # sends 2, 4, 6 [bombers]
    quantity = {2, 4, 6}
    opai = OrderM1WestBase:AddOpAI('AirAttacks', 'M1_WestAirAttack1',
        {
            MasterPlatoonFunction = {SPAIFileName, 'PatrolChainPickerThread'},
            PlatoonData = {
                PatrolChains = {'M1_Order_W_AirAttack_1_Chain', 'M1_Order_W_AirAttack_2_Chain', 'M1_Order_W_AirAttack_3_Chain'},
            },
            Priority = 90,
        }
    )
    # using quantity count based on difficulty for number of units sent in per group
    opai:SetChildQuantity('Bombers', quantity[Difficulty])


It's quite self-explanatory.
"AirAttacks" is the type of attack.
'M1_WestAirAttack1', is an unique name for the attack (same as OrderM1WestBase_ExperimentalLand in the ReactiveAI)

Code: Select all
MasterPlatoonFunction = {SPAIFileName, 'PatrolChainPickerThread'},

It's what the platoon will do. In this case, it will patrol around some waypoint. You have to inspect the existing FA campaign scripts to see what is possible (attacks, random patrols, ...)

Code: Select all
PatrolChains = {'M1_Order_W_AirAttack_1_Chain', 'M1_Order_W_AirAttack_2_Chain', 'M1_Order_W_AirAttack_3_Chain'},

It's the patrol of the attack. These are waypoints defined in the _save.lua (Domino editor will create them easily).
You should either create new waypoints, or use existing one in the vanilla maps.

opai:SetChildQuantity('Bombers', quantity[Difficulty]) define the quantity of bombers depending of the difficulty. It's defined here:
Code: Select all
    quantity = {2, 4, 6}



I think altering vanilla maps to add these AI is a good starting point to learn how to script a campaign.
Feel free to ask questions here!

In order to test your map, you can make a copy of it and start FA from
c:\ProgramData\FAForever\bin\
with
Code: Select all
ForgedAlliance.exe /init init_coop.lua


Then select your map. You don't need to restart FA each time you modify a script. You can just restart the map inside FA.
Nossa wrote:I've never played GPG or even heard of FA until FAF started blowing up.
User avatar
Ze_PilOt
Supreme Commander
 
Posts: 8985
Joined: 24 Aug 2011, 18:41
Location: fafland
Has liked: 18 times
Been liked: 376 times
FAF User Name: Ze_PilOt

Re: Vanilla missions are too easy! There is no sounds!

Postby Complex » 30 Sep 2013, 12:44

I did a little research on converting the voice over audio files to the FA format and I think I found a way, however I lack the knowledge to complete the process so I will leave what I have here and let someone else take over.

First off, all the files come in pairs, the .xsb file contains the cues that link a name to a section of audio (the cues follow the following format: {Mission Number}_{Character}_{Mission Part}_{Some Number}), and the .xwb files contain the audio itself. The format of these files are almost completely undocumented (and they apparently use an unknown hash function, so simple editing won't work).

However I did manage to find a tool that can extract the audio from the .xwb files (Found here: http://aluigi.altervista.org/papers.htm#xbox under "XWB/ZWB files unpacker 0.3.4"). The supcom audio files seem to be in the ADP compressed WAV format, FA seems to use the PCM compressed WAV format (I don't know the bit-rate), so they will probably need to be converted. Lastly, to recreate the .xsb and .xwb files, you can use the Microsoft Cross-Platform Audio Creation Tool (XACT) tool contained in the DirectX SDK, you will need to use the correct version (August 2007 I think, link: http://www.microsoft.com/en-us/download/details.aspx?id=13287), I think the .xwb is the Wave Bank and the .xsb is the Sound Bank.

Please keep in mind that I have not tested too much of this, and I hope it helps.
User avatar
Complex
Crusader
 
Posts: 15
Joined: 30 Nov 2012, 09:52
Has liked: 0 time
Been liked: 1 time
FAF User Name: Complex

Re: Vanilla missions are too easy! There is no sounds!

Postby Myromax » 30 Sep 2013, 23:14

I've managed to get the sounds to work.
Or 1 sound to be more exact, converting them all will take a while.

EDIT: Where should i put them when i'm done?

Another EDIT: The first Aeon mission is complete and works. The file is about 45MB
Myromax
Crusader
 
Posts: 14
Joined: 17 May 2013, 00:15
Has liked: 0 time
Been liked: 1 time
FAF User Name: Myromax

Re: Vanilla missions are too easy! There is no sounds!

Postby Complex » 01 Oct 2013, 01:10

I created a script that I think might speed up part of the conversion process, it will extract the .wav files from the .xwb files and then re-encode the .wav files in the format that FA uses. Simply download this file: https://db.tt/w2ewihjq and extract to a directory that has all the .xwb and .xsb files that you want to convert and then run convert.bat, the script will create one sub-directory for each .xwb file, it will also name each of the .wav files to what I think is the cue name.

My scripting skills are not all that good, so please be careful when using this script, I have not made it idiot-proof.

I used:
ffmpeg: http://ffmpeg.org/
unxwb: http://aluigi.altervista.org/papers.htm#xbox
hexdump: http://www.dostips.com/forum/viewtopic.php?p=7038
User avatar
Complex
Crusader
 
Posts: 15
Joined: 30 Nov 2012, 09:52
Has liked: 0 time
Been liked: 1 time
FAF User Name: Complex

Re: Vanilla missions are too easy! There is no sounds!

Postby Myromax » 01 Oct 2013, 02:22

Complex wrote:I created a script that I think might speed up part of the conversion process, it will extract the .wav files from the .xwb files and then re-encode the .wav files in the format that FA uses. Simply download this file: https://db.tt/w2ewihjq and extract to a directory that has all the .xwb and .xsb files that you want to convert and then run convert.bat, the script will create one sub-directory for each .xwb file, it will also name each of the .wav files to what I think is the cue name.

My scripting skills are not all that good, so please be careful when using this script, I have not made it idiot-proof.

I used:
ffmpeg: http://ffmpeg.org/
unxwb: http://aluigi.altervista.org/papers.htm#xbox
hexdump: http://www.dostips.com/forum/viewtopic.php?p=7038


Nice!
With that i'll have everything done in 30 mins or so.
Was renaming every file by hand before after listening to it lol
Thx!
Myromax
Crusader
 
Posts: 14
Joined: 17 May 2013, 00:15
Has liked: 0 time
Been liked: 1 time
FAF User Name: Myromax

Re: Vanilla missions are too easy! There is no sounds!

Postby Complex » 01 Oct 2013, 02:33

One odd thing that I noticed: some of the cues seem to be unused, if my script picks up one of those it could have the wrong cue name for the rest of the files. In the cases that I found so far, the unused cues are at the end of the list, so they shouldn't be a problem.
User avatar
Complex
Crusader
 
Posts: 15
Joined: 30 Nov 2012, 09:52
Has liked: 0 time
Been liked: 1 time
FAF User Name: Complex

Re: Vanilla missions are too easy! There is no sounds!

Postby Myromax » 01 Oct 2013, 02:50

Complex wrote:One odd thing that I noticed: some of the cues seem to be unused, if my script picks up one of those it could have the wrong cue name for the rest of the files. In the cases that I found so far, the unused cues are at the end of the list, so they shouldn't be a problem.


Seems to work fine so far.
I'm zipping everything atm and then i'll upload to mega.
It's about 700MB.
Myromax
Crusader
 
Posts: 14
Joined: 17 May 2013, 00:15
Has liked: 0 time
Been liked: 1 time
FAF User Name: Myromax

Re: Vanilla missions are too easy! There is no sounds!

Postby Myromax » 01 Oct 2013, 03:14

All the files are converted and send to Ze_Pilot.
All credit goes to Complex since he basically did everything by himself.
Myromax
Crusader
 
Posts: 14
Joined: 17 May 2013, 00:15
Has liked: 0 time
Been liked: 1 time
FAF User Name: Myromax

Re: Vanilla missions are too easy! There is no sounds!

Postby Complex » 01 Oct 2013, 03:30

I don't deserve all the credit, Myromax was the one who took the time to do the long repetitive process of adding everything into the correct spots.

On a second note, Myromax, you might want to upload the source files (and link them here) so if anyone needs to change something, it would be easier.
User avatar
Complex
Crusader
 
Posts: 15
Joined: 30 Nov 2012, 09:52
Has liked: 0 time
Been liked: 1 time
FAF User Name: Complex

Next

Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest