Author Topic: Team Loadout changes  (Read 3275 times)

0 Members and 1 Guest are viewing this topic.

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Team Loadout changes
Some of you may have spotted me mention that I was making some changes to the Team Loadout system. The idea is to have the mission accept a loadout that looks like this

Code: [Select]
$Ship Choices: (
"GTF Ulysses" 5
"GTF Hercules" 5
"GTF Hercules Mark II" "NumberOfHercs"
"GTF Ares" "NumberOfAres"
"GTF Erinyes" 5
"GTF Loki" 5

Where NumberOfHercs and NumberOfAres are both SEXP Variables. While I was working on that it occured to me that some people such as IP Andrews and MadAboutGames might appreciate it if you could use this instead.

Code: [Select]
$Ship Choices: (
"PlayerShipType1" 5
"PlayerShipType2" 5
"PlayerShipType3" "NumberOfType3"

where the ship type can also be a variable.

So is that of any use to anyone? It doesn't look that hard to do and I'll probably add it eventually but if I know that there is someone who will want to test it immediately then that takes the burden off me to do anything more than some preliminary testing and everything will get added more quickly. :)

Also while I'm poking about in the team loadout code now's a good time to mention it if there are any suggestions for how FRED handles things (I doubt I'll be touching the Freespace side of things much at all but the FRED side will need a few changes anyway).
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Team Loadout changes
Hmmm. I guess from the lack of interest that there's no one who needs the feature in a hurry. Fair enough. I'll probably add it later cause I want it but it's not a priority then :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Team Loadout changes
I can a lot of use for that one.. to introduce something like the loadout system from the oldie Falcon 3.0 where you simply couldnt always fit your F-16 with the best missiles but had to use other (crappy) ones instead and where every fighter lost from the squadron really felt as it meant one less in the next mission. But as i'm in sort of a hurry i and i would have to learn to FRED properly first ;) so...

Just a check... You are doing that for the weapons - especially secondaries - too (or do they already have it, dunno)?
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline IPAndrews

  • Disgruntled Customer
  • 212
  • This site stole my work
Re: Team Loadout changes
Sorry it took me a while no notice this thread Kara. In answer to your question, I'm not entirely sure how much use this change would be.

Firstly, as it stands BHX does not use briefings (and thus the team loadout screen) at all. This is because it was not possible to do accurate briefing animations. Since ships types are picked in-mission. Each mission now starts with a little 30 second cutscene in which the player's character gives a background speech.

If I did want to make use of this feature I get the problem with the briefing animations back again (or people complaining about the complete lack of briefing animations). Also I would not want all player flyable ships available for every mission. Otherwise the player would never fly a Star Fury for example, they'd always exchange it straight away for a Thunderbolt.
Be warned: This site's admins stole 100s of hours of my work. They will do it to you.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Team Loadout changes
I can a lot of use for that one.. to introduce something like the loadout system from the oldie Falcon 3.0 where you simply couldnt always fit your F-16 with the best missiles but had to use other (crappy) ones instead and where every fighter lost from the squadron really felt as it meant one less in the next mission. But as i'm in sort of a hurry i and i would have to learn to FRED properly first ;) so...

Just a check... You are doing that for the weapons - especially secondaries - too (or do they already have it, dunno)?

Yep. That's basically the reason I'm adding it for. The idea is that at the start of the campaign you would specify how many ships of each class your home destroyer has and every time you lost a wingman you'd lose one ship of that class from your team loadout in later missions.

The changes I suggested above would make certain options easier but as far as I can see you should be able to do anything with the simpler version I'm doing at the moment.

Changes to do the same thing with weapons are also planned although they're somewhat complicated by having to deal with supply ships (which could quite easily burn through your carefully hoarded supply of weapons resupplying your wingmen).

Sorry it took me a while no notice this thread Kara. In answer to your question, I'm not entirely sure how much use this change would be.

Firstly, as it stands BHX does not use briefings (and thus the team loadout screen) at all. This is because it was not possible to do accurate briefing animations. Since ships types are picked in-mission. Each mission now starts with a little 30 second cutscene in which the player's character gives a background speech.

If I did want to make use of this feature I get the problem with the briefing animations back again (or people complaining about the complete lack of briefing animations). Also I would not want all player flyable ships available for every mission. Otherwise the player would never fly a Star Fury for example, they'd always exchange it straight away for a Thunderbolt.

I'll have to look at the way I'm implementing things but I don't think that any of those things would be that big a problem. At the moment the system is also designed to work on ships like Delta and Epsilon wing who aren't seen in the loadout screen either. So far I haven't seen any reason why missions which skip the loadout screen would have any problems.

I can understand why you might not want to use if for Alpha 1 but what about having some wings of ships that are starfuries if the player has lost all the thunderbolts you assigned him? (Not all ships in the mission have to be assigned from loadout variables so that wouldn't mean that you'd have no more thunderbolts in the campaign in case you're worried about that).

I'm trying to make everything as flexible as possible so you've given me a few considerations to keep in mind even if you don't use the system in BHX anyyway :)
« Last Edit: April 18, 2006, 07:36:21 am by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Shade

  • 211
Re: Team Loadout changes
Really excellent idea :)
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Team Loadout changes
It's an old idea but I can see why Goober didn't implement it straight away. There is a fair amount of work involved.

On the other hand it's the SCP idea I've wanted most in the last two years so I figured I might as well learn C and add it myself :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: Team Loadout changes
Remove the quotation marks from the variable names and I'll like it a lot more. As it is, it bugs me how the variables look exactly like ships. It also makes it easier for the code, since it can automatically assume that anything in the ""s is a missing ship, if it doesn't exist in the ships list. I do realize that there's not much chance of variables being named the same as ships, but it usually helps to stay on the safe side.
-C

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Team Loadout changes
At the moment the code I've written complains if the first entry isn't a ship regardless of whatever it is. The old code didn't care if it was a ship or an integer. If you gave it an integer it would simply pass the value along thinking it was a ship index.

That said I could do what the SEXP code does and preface a variable with an @ symbol.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Team Loadout changes
Need a favour. Can someone with the latest CVS version download this mission and campaign file and tell me what three ships are present in the loadout for Alpha, beta and gamma wings.

The mission should crash FS2 back to the desktop with a complaint about an unknown flag but for some reason it absolutely refuses to do that with me.

Shouldn't take more than two minutes.

[attachment deleted by admin]
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Shade

  • 211
Ulysses, Herc, Herc II. No crash here either, sorry.
Report FS_Open bugs with Mantis  |  Find the latest FS_Open builds Here  |  Interested in FRED? Check out the Wiki's FRED Portal | Diaspora: Website / Forums
"Oooooooooooooooooooooooooooooooooooooooh ****ing great. 2200 references to entry->index and no idea which is the one that ****ed up" - Karajorma
"We are all agreed that your theory is crazy. The question that divides us is whether it is crazy enough to have a chance of being correct." - Niels Bohr
<Cobra|> You play this mission too intelligently.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
As I suspected. Something went wrong with the mission when I was editing it with notepad. This is now the 2nd time I've edited a mission and got odd results like this. It makes it really hard to test new loadout code cause when the mission doesn't behave as expected I have no idea if the mission has simply corrupted itself again or if I've made a mistake in the code.  :hopping:

To make things really odd I got the same as you did on one PC but 3 Herc IIs on another one. And I made certain I used the last CVS build which doesn't contain my loadout changes.  :wtf:

EDIT : Where are my manners? Thanks a lot. :yes:
« Last Edit: April 21, 2006, 01:35:24 pm by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
 :bump:

Okay. I've finished all the changes I wanted to make to the ship part of the loadout code and I'm about to start on the weapon code (after that I'll go to FRED and make it possible to add all this stuff without having to use notepad). I figured I'd post now and get people's opinions while it's still fresh in my mind and I'm inclined to make changes :) I'm not posting a build at the moment cause the code is no fit state at the moment (FRED chokes completely on any mission using this stuff and it's non trivial to fix that). Anyway here's how the new code works.

Loadout changes

  • You can specify a string variable for the class of any ship in the loadout
  • You can specify a number variable for the amount of any ship in the loadout

That means that code like this is now perfectly valid.
Quote
$Ship Choices: (
   "Ulysses"   @NumberOfUlysses
   "GTF Hercules"   @NumberOfHercs
   @ShipClass1   @NumberOfRandom
        @ShipClass2   5
)

If that's all you do then the team loadout code will simply work out the number of extra ships available based on the value of the variables you gave it. It won't however do anything about the ships in Alpha wing or any other wing specified in the mission file. That is controlled by changes to the ship object.

Ship Object stuff

Quote
$Name: Alpha 1      ;! Object #0
$Class: GTF Ulysses
+Suggested_loadout_ship: @ShipClass1
+Suggested_loadout_ship: GTF Ulysses
+Optional_default_ship: @ShipClass1

$Team: Friendly
$Location: 0.000000, 0.000000, 0.000000

[ SNIP ]

$Departure Cue: ( false )
$Determination: 10
+Flags: ( "cargo-known" "ignore-count" "player-start" )
+Flags2: ( "class-set-by-loadout" )

New stuff is in red.
 The class-set-by-loadout can be set on any fighter you wish (not just one in Alpha to Gamma wing and even hostiles if the mission requires it). Any ship with this flag will not automatically be set to the class the mission file specified. Instead the code will now check if there are any ships off that class left in the loadout pool. If there are then fine. If not it will then check to see if the +Suggested_loadout_ship: exists. If it does it will then parse in the name (or variable holding a name) and see if that is available. You are allowed to suggest the name of three different ship classes to the code (I've shown two. One static (the Ulysses) and one held in the ShipClass1 string variable.).
 If none of the suggestions work (or if none were given) the game will then look to see if an Optional_default_ship was given. If this exists the ship will be set to this class regardless of whether or not there are any ships left (If there are ships left of this class they will be assigned to this ship).
 If after going through the missions designers suggestions no match was found and no Optional_default_ship was given the game will then loop through the team loadout and assign the ship to the first class for which it can find any ships left.
 Finally if this still fails to find a match the ship is assigned to whatever the mission file originally said it should be.

I know that sounds hideously complicated but it's actually quite simple once you get the hang of it and it gives the FREDder an enormous amount of choice in what will happen.


BHX Stuff

@IP Andrews : I kept BHX in mind when I was writing the code cause even if you don't want to use it I'll probably want to do this with multiplayer at some point and it's easier to keep in mind an actual existing campaign than a hypothetical one :)

That said it can do what you've suggested in your first post quite easily.

First thing you do is edit the team loadout. I already know that you must have a pair of variables defining what class of fighters are available for each race so that bit is easy. You simply assign those variables as the ship class in the loadout.

Quote
$Ship Choices: (
   @FighterClass1   @NumberOfFC1
   @FighterClass2   @NumberOfFC2
)

Then you'd simply assign some suggestions and defaults for each ship. Assuming that FighterClass1 = basic fighter and FighterClass2 = advanced fighter. Then and assignment like this would give you what you want.


Quote
$Name: Alpha 1      ;! Object #0
$Class: EA Thunderbolt
+Suggested_loadout_ship: @ShipClass2
+Optional_default_ship: @ShipClass1

When playing the EA the player will be in a Thunderbolt if he has any left. If not he'll be in a starfury. If you wanted him to definitely fly a Thunderbolt you could simply set the Optional Default to ShipClass2 and still gain all the benifits of the team loadout code for any other wing.
 If playing the League on the other hand the code above would automatically put the player in a Sky Serpent if he had one left and a Falkosi if he didn't.

Comments?

I'm happy to take comments and suggestions. Doesn't mean I'll add them but I'll listen at least :)
« Last Edit: April 29, 2006, 11:13:32 am by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Cobra

  • 212
  • Snake on a Cain
    • Skype
    • Steam
    • Twitter
so, basically what you're saying is that with these variables, if you put one weapon on a ulysses, then all the ship types specified in the mission get that weapon too? (i didn't read the whole thread :p)
To consider the Earth as the only populated world in infinite space is as absurd as to assert that in an entire field of millet, only one grain will grow. - Metrodorus of Chios
I wept. Mysterious forces beyond my ken had reached into my beautiful mission and energized its pilots with inhuman bomb-firing abilities. I could only imagine the GTVA warriors giving a mighty KIAAIIIIIII shout as they worked their triggers, their biceps bulging with sinew after years of Ivan Drago-esque steroid therapy and weight training. - General Battuta

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Nope. What I'm saying is that if you want to you can set up a campaign on a destroyer and have the number of Ulysses available to fly decrease as friendly ones in the missions get blown up. On the other hand if you protect them you'll be able to fly a ulysses in the next mission.

You've only been able to do stuff like that in a very crude fashion before.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Cobra

  • 212
  • Snake on a Cain
    • Skype
    • Steam
    • Twitter
ah. so supplies ARE limited in a campaign now than the before-limitless ships. :D
To consider the Earth as the only populated world in infinite space is as absurd as to assert that in an entire field of millet, only one grain will grow. - Metrodorus of Chios
I wept. Mysterious forces beyond my ken had reached into my beautiful mission and energized its pilots with inhuman bomb-firing abilities. I could only imagine the GTVA warriors giving a mighty KIAAIIIIIII shout as they worked their triggers, their biceps bulging with sinew after years of Ivan Drago-esque steroid therapy and weight training. - General Battuta

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
There was a limit before but it was set in stone. If the mission file said that there were 4 Ares class fighters available in the mission then that was what you had. The only way to avoid that was to not allow the player to use the Ares class in the campaign up to that point at all.

Furthermore one additional thing you can now do is make missions where you can only fly a certain ship class if you play it as part of the campaign. That's the exact opposite of the way round things are now where every ship that is available in the mission is flyable in the techroom. Now you simply set the value of the variable to 0 and it simply won't appear in the techroom. But you increase the number of the variable somewhere during the campaign to unlock it. :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Cobra

  • 212
  • Snake on a Cain
    • Skype
    • Steam
    • Twitter
i actually meant story-wise, but that works too. :nervous:

but you know, an interesting thing comes to mind. make the game arcade-style and if you destroy a certain ship you get it in the next mission. :D
To consider the Earth as the only populated world in infinite space is as absurd as to assert that in an entire field of millet, only one grain will grow. - Metrodorus of Chios
I wept. Mysterious forces beyond my ken had reached into my beautiful mission and energized its pilots with inhuman bomb-firing abilities. I could only imagine the GTVA warriors giving a mighty KIAAIIIIIII shout as they worked their triggers, their biceps bulging with sinew after years of Ivan Drago-esque steroid therapy and weight training. - General Battuta

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Team Loadout changes
That's certainly something that could be done very easily with this code. It also makes having an arcade style shop level where you can buy fighters possible. Until now you could allow the class but you couldn't control how many of that class would be available.

Anyway I'm bumping this for a reason :) The ships code for FS2 is basically done and working. I just want to know what SEXPs people will want for updating the ship numbers. Currently the changes so far are these.

is-ship-class
 Updated to now check ships that have yet to arrive and which have departed. (Previously it would return false if the ship wasn't currently in the mission which made it absolutely useless for determining the class of a ship that had been destroyed :D ). The changes mean you can now roll your own update system like this.

( when-argument
   ( any-of
      "Beta 1"
      "Beta 2"
      "Beta 3"
      "Beta 4"
      "Gamma 1"
      "Gamma 2"
      "Gamma 3"
      "Gamma 4"
   )
   ( and
      ( is-event-true-delay "Mission End" 0 )
      ( is-ship-class
         "GTF Ulysses"
         "<argument>"
      )
      ( is-departed-delay 0 "<argument>" )
   )
   ( modify-variable
      @NumberOfUlysses[1]
      ( - @NumberOfUlysses[1] 1 )
   )
)

Since that is pretty time consuming to do with every single ship class that you may have I added a new SEXP (the name is temporary though :) )

deal-with-ship-loadout

( when
   ( is-event-true-delay "Mission End" 0 )
   ( deal-with-ship-loadout )
)

This is the lazy person's option. You tick a box in FRED for each ship you want the code to deal with automatically and as soon as this SEXP is triggered it will alter the corresponding variable if the ship has been destroyed.


At the moment you only have two options. Roll your own code from scratch or let the game handle everything automatically. I'm willing to take any suggestions for SEXPs that people want that lie somewhere between those two extremes (like say a SEXP that did the same thing but only for a specified class etc.). If no one suggests anything I'll add whatever I feel would make my life easier and I won't feel any particular pressure to add other loadout affecting SEXPs later.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

  

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Team Loadout changes
:bump:

For anyone that cares. That's what it's looking like at the moment.

http://www.hard-light.net/wiki/index.php/Improved_Team_Loadout

I've still got some clean up to do but it's working for ships. I'll probably only be adding support for setting weapon quantities by a variable and not adding any support for figuring out how many rounds were used at first cause it looks like a lot of hassle for a feature that no one seems that interested in.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]