Author Topic: changing BANK_WHEN_TURN macro to a command line flag  (Read 4428 times)

0 Members and 1 Guest are viewing this topic.

Offline arisian

  • 23
Re: changing BANK_WHEN_TURN macro to a command line flag
Hi guys, sorry about the delay, but I got busy with the stuff I actually get payed for...anyway, I've got a patch here that implements the banking multiplier in ai_profiles.  The trouble with this is (as it took me some time to figure out), most missions have the string "$AI Profile: FS2 RETAIL" in them somewhere.  The presence of that statement effectively means that no custom ai profiles will ever be used, because you can't modify the FS2 RETAIL profile with an ai_profiles.tbl, and any other profile you put stuff in will just get ignored.  This is true even of the Blueplanet mod missions; while they did, in fact, create a custom ai_profiles.tbl with a "BP" profile, and set "BP" as the default profile, every single  mission file then has "$AI Profile: FS2 RETAIL" in it, so the custom ai_profiles.tbl never actually affects anything.  By going in and editing the mission files to use the "BP" profile, and then adding the "$Delta Bank Multiplier" line to ai_profiles.tbl, you can get the behavior I originally wanted.

So, what I've done in this patch will allow mod builders to play with the banking multiplier, if they know what they're doing.  But so far as I can see, there's no way to have a custom ai_profiles.tbl in a tacked-on personal "mini-mod" to disable banking, because everything uses the "FS2 RETAIL" profile anyway.  I suppose we could modify things to ignore the "$AI Profile" statement in missions and always use the "default" profile, but that would make it impossible to have mission-specific profiles.  Alternatively, since I suspect that FRED is automatically generating the $AI Profile: FS2 RETAIL" statement, someone could modify FRED to not do that.  In the mean time, however, I don't see a way to use the ai_profiles patch I've made as a way to let me actually alter the behavior of anything without unpacking and editing all the mission files in a mod (which I should *not* have to do).

Again, there's a lot of code here that I'm not real familiar with, so if there's something obvious I'm missing, I'd appreciate it if someone would let me know.  Otherwise, it looks like you need to hand-edit mission files for ai_profiles.tbl to actually do anything.



[attachment deleted by Tolwyn]

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: changing BANK_WHEN_TURN macro to a command line flag
I thought you could modify the FS2 Retail entry with a +nocreate command or whatever.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Sushi

  • Art Critic
  • 211
Re: changing BANK_WHEN_TURN macro to a command line flag
You can. Arisian, meet the .tbm (modular table) file. :D

You can create a .tbm "min-mod" that will affect FS2_RETAIL.

I'll have a look at your code a bit later.

 

Offline arisian

  • 23
Re: changing BANK_WHEN_TURN macro to a command line flag
Aha, yes, I missed the "modular extensible" tables.  Thanks for the link!  Now the code patch from my last post does exactly what I want, when used in conjunction with an XXX-aip.tbm that modifies the "FS2 RETAIL" profile to have "$Delta Bank Multiplier: 0, 0, 0, 0, 0".  No need to modify mission files, or anything else.  Thanks for the help guys; sorry it took me so long to see what you were all getting at.  Whenever you get around to looking at the code patch, let me know whether you think this version looks good or if you have other suggestions.

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: changing BANK_WHEN_TURN macro to a command line flag
I think you misunderstand something, arisian. It's easy to set a custom AI profile in FRED - this is how one alters the string in question, without any direct editing of mission files. BP's custom AI profile, for instance, hasn't yet been implemented just because it wasn't thoroughly tested.

Furthermore, there is no 'they' in BP; it was just Darius at the time.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: changing BANK_WHEN_TURN macro to a command line flag
No the point was we were trying to explain that you can use a tbm file to modify the ai_profile that retail missions use without ever opening the mission files in FRED or notepad, I think.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline Sushi

  • Art Critic
  • 211
Re: changing BANK_WHEN_TURN macro to a command line flag
Alright, I took another look. The biggest problem is that this seems to affect all ships again, not just the player. Since the point of this (I thought :)) was to make it so that the player has the option of not banking when turning, this is bad.

Also, I recommend using a binary AI Profiles flag instead of a float-list. Just have something like "$Player Bank When Turn: YES/NO" modeled after the other binary AI profiles flags. I think that better suits your purpose, although a float-list can obviously do the job too. :)

 

Offline arisian

  • 23
Re: changing BANK_WHEN_TURN macro to a command line flag
Yes, if you modify the FS2 RETAIL profile it does affect all ships; I'd initially thought that you could have a different profile for the player, but I haven't yet found a way to do that easily (doesn't mean it can't be done, so if anyone knows of a way, let me know).  I could go back to explicitly checking whether the ship belongs to a player, but that would mean you could *never* apply the changes to AI controlled ships, which it seemed like might be something someone might want to do someday.  The reason I chose a float list was that it allowed more than just a binary on/off; it's actually a multiplier, so you can scale the banking up or down by using numbers greater or less than 1 if you want, allowing finer grain control.  Again, I thought that someone might someday find that useful; if you think it's unlikely, I'll make it a binary flag instead.

 

Offline Sushi

  • Art Critic
  • 211
Re: changing BANK_WHEN_TURN macro to a command line flag
I could go back to explicitly checking whether the ship belongs to a player, but that would mean you could *never* apply the changes to AI controlled ships, which it seemed like might be something someone might want to do someday. 

There's already a ships.tbl entry that allows the banking factor to be adjusted on a per-ship basis. So there IS a way to do that, if you want to. :) If someone wants to make a mod with high-bank ships or no-bank ships (or any combination) they already can. What we can't do right now is change the auto-bank just for the player, basically as a concession to player flight styles.

The reason I chose a float list was that it allowed more than just a binary on/off; it's actually a multiplier, so you can scale the banking up or down by using numbers greater or less than 1 if you want, allowing finer grain control.  Again, I thought that someone might someday find that useful; if you think it's unlikely, I'll make it a binary flag instead.

Fair enough, and I guess some players may want to just reduce (or even amplify!) the banking constant for them. I don't think it makes sense to have a different value for each difficulty level though (at least not if the flag only affects the player). It would probably be better to read just a single float value (using stuff_float).