[MD][AP] Advanced Opponent Balancing System v1.02 (10/09/12)

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

[MD][AP] Advanced Opponent Balancing System v1.02 (10/09/12)

Post by morbideth » Wed, 22. Aug 12, 16:39

The Opponent Balancing System is responsible for determining what opposition you face during missions.

The current system uses a fixed range, giving it a relatively low upper limit on what you will face even at the highest combat rank.

This mod changes that by taking into account the player's fleet in the sector. If you are stronger than what the normal OBS would spawn, you get stronger opposition. If you are weaker, no change is made. This provides the best of both world, giving you casual missions if you want them, and big battles should you prefer those.

[ external image ]Download v1.02

Install as a fake patch in the addon folder, or by placing in the mods folder and selecting it from the launch screen.

Changelog:
v1.02
  • Fixed a bug causing less opposition if the player was weaker than what the mission would normally spawn.
  • First pass on improving opposition fleet composition. Feedback is requested: too hard? too easy? just right?
  • Added some randomness to the players fleet strength calculation.
  • NOTE: You may have to reset the mission director cues if you are updating. Esc->Gameplay->Mission Director->Reset Cues
  • WARNING: The changes to fleet composition significantly increases the difficulty at higher ranks, and this affects all missions. It is recommended that you install this as a mod package so you can turn it off and lick your wounds.
  • Note: For large fleets there will be a significant delay between accepting a mission, and objective updating, due to the time it takes to create the fleet. The longer the delay, the more devout your prayers should become.
v1.00 Initial Release


Old Versions:
[ external image ]Download v1.0

TODO:
Improve fleet organization, placement, and naming.
XRM version?
World domination
Customization options and/or more dynamic opposition based on ?
Last edited by morbideth on Tue, 9. Oct 12, 21:50, edited 3 times in total.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 8. Oct 12, 20:41

I've been meaning to ask what it would take to consider the player's entire fleet strength, rather than just the in-sector fleet?

The player could have a fleet of capital ships, but if they accept a mission while flying a TP or scout, then OBS creates a very weak opponent. In that case, the opponent should be strong enough to require the player to call for reinforcements.

When I look at your changes, I cannot figure out how you filter by sector. But, then, I am weak at reading MD code.

BTW, this is a great idea. OBS could use some tune-ups to improve combat challenge. Thanks for doing this!

User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR » Mon, 8. Oct 12, 21:53

DrBullwinkle wrote:BTW, this is a great idea. OBS could use some tune-ups to improve combat challenge. Thanks for doing this!
Agreed. Good work morbideath. We need more mission related stuff for AP.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Mon, 8. Oct 12, 23:59

DrBullwinkle wrote:I've been meaning to ask what it would take to consider the player's entire fleet strength, rather than just the in-sector fleet?

The player could have a fleet of capital ships, but if they accept a mission while flying a TP or scout, then OBS creates a very weak opponent. In that case, the opponent should be strong enough to require the player to call for reinforcements.

When I look at your changes, I cannot figure out how you filter by sector. But, then, I am weak at reading MD code.

BTW, this is a great idea. OBS could use some tune-ups to improve combat challenge. Thanks for doing this!
The problem comes in with... well do you want every single fight to be tooth and nail? And what about sector defense fleets? Do those get included in the scale or not? It is kind of a hard thing to get both the challenging/fun mission and the "I just need cash" mission all in one file.

I may do something with impossible mission difficulty so that when you take an impossible mission, it reeeaaaaaly means it.

Maybe even something that spans more than one sector simultaneously for the high combat ranks.

First I want to fix the fleet composition, but that is proving to be a pain. The flow of control in MD makes my brain cry.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 9. Oct 12, 00:06

Yeah, I was really trying to start a conversation about "how" to do it. Mostly because I have been dabbling with OBS for a while, and want to learn/share more.

One way to deal with the intensity level is a random choice between Vanilla, Sector Fleet, and Universe Fleet. Add to that a random multiplier, and I think you could achieve a good spread pretty easily.

Another idea that I had was to include a multiplier that reads from a t file (or, better but more difficult, a command menu). 1x = Vanilla, 2x = Regular, 5x = Hardcore, 10x = Insanity. Something along those lines; give people an option about combat difficulty.

What do you mean by "fix the fleet composition"?
Last edited by DrBullwinkle on Tue, 9. Oct 12, 08:42, edited 1 time in total.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Tue, 9. Oct 12, 04:10

I saw someone mention a way to interact between MD and scripts, however they didn't go into details, so I don't know how to do that. If I could it would make things a lot easier. Then I would be able to customize it and not be limited to a one size fits all MD file.

By fleet composition I mean change how OBS spends its points. Right now it just loops buying the biggest ship it can afford. You end up with carriers with like 3 m5s protecting them. In my mind, that isn't right. I want to change it so you get fleets. Carriers protected by m2s and wings, actual wings, of fighters, with frigates supporting the m2, and m6s supporting the frigates. That alone would make things a lot more challenging as well as fun.

There is a lot that could be done to improve things. I just wish MD was easier to work with.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 9. Oct 12, 04:54

MD can call an SE script, but not vice-versa. So the trick is to communicate from SE to MD, which can be done by creating objects which MD can detect. Create one object in SE; trigger a cue in MD. Create a different object in SE to trigger a different cue in MD. Perhaps more information can be communicated, such as the name of the object which could pass a string.

The objects are created far from the trade lanes or, perhaps, in a special sector created just for this task.

MD Control by h2o.Ava is an entire framework for communicating that way, although it seems to me that a custom object/message pair might be just as easy to create from scratch.

I understand what you mean about fleet composition. Yes, M5's just create lag; better to add an M6 or M7 instead of multiple M5's.

I agree that MD is difficult to work with. Only a few have really mastered it. A proper editor for it would make a night-and-day difference (like Exscriptor or X-Studio).

To repeat my original question, how do you filter the player fleet to the sector? What change would count the entire player fleet? I could not figure out where you set the filter to the current sector.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Tue, 9. Oct 12, 08:31

I think it just defaults to one jump.

Multiple Jumps would be like:

Code: Select all

<find_ship includedocked="1" multiple="1" race="player" group="this.PlayerShips">
	<jumps exact="3"/>
</find_ship> 

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 9. Oct 12, 08:38

morbideth wrote: <jumps exact="3"/>
Awesome. Thanks!

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Tue, 9. Oct 12, 09:47

Update tomorrow, be afraid, be very afraid. Also, invest in some anti-fighter ships, and missiles, lots of missiles.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 9. Oct 12, 09:49

Oooh... sounds like big fun!

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Tue, 9. Oct 12, 21:34

Updated, let me know if it is too hard now.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 9. Oct 12, 21:36

I have done a lot of testing -- I am fairly certain that X3 combat cannot be made *too* difficult (without making it impossible). The engine simply cannot support it.

For example, if you spawn 100 enemy M2's, only two or three will attack that player at any one time. The rest spend most of their time avoiding collisions with each other. So three M2's is about as tough as it gets. Or two M2's plus an M1 with fighters.

(The above assumes that the player has a capital ship and strong fighter escort, plus appropriate OOS defense. Combat *can* be made extremely difficult early in the game -- while the player is still flying fighters and M6's.)

Thanks.

PS: Do you happen to know how to make an enemy follow you, like the three Tyr's at the end of Balance of Power? That was the toughest enemy I have seen in the game. You wouldn't want that all of the time, but once in a game day or two might spice things up a bit. :twisted:

(Of course, only if the player is at top fight rank).

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Tue, 9. Oct 12, 21:57

You might wanna try the update before you say it can't be too hard :twisted:. So far none of my ships have survived a mission... of course I was using the cheat package create fleets option, so they were not exactly balanced fleets.

Off the top of my head... I guess you would use set_command to tell it to attack the player specifically instead of the default just respond to direct threats.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 9. Oct 12, 22:03

morbideth wrote:You might wanna try the update before you say it can't be too hard :twisted:
Sorry, I edited my post rather than double posting. I explained above. The maximum effective opponent is, approximately, three M2's. I base that on several hundred hours of trying to make harder opponents. :)

Early in the game, when the player is flying a fighter or corvette (M6), then the combat difficulty can be very high.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Tue, 9. Oct 12, 22:07

That is based on an assumption, that m2s are the most effective combat ship. They are not. Not in terms of firepower per unit volume.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Tue, 9. Oct 12, 22:14

morbideth wrote:That is based on an assumption, that m2s are the most effective combat ship. They are not. Not in terms of firepower per unit volume.
Not based on any assumptions at all. It's based on hundreds of hours of experimentation with all ship classes.

I did say "approximately". :)

Bombers and M7M's can be extremely difficult if they are sufficiently hostile. Also, a sufficiently large swarm of Mk2 drones can be tough. Missiles and drones might be exceptions to the rule (although good flak weapons help a lot).

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 10. Oct 12, 05:12

It takes a long time to test OBS thoroughly, but I did a few missions with v1.02 and then the same missions with my modified OBS.

v1.02 definitely creates a stronger response than vanilla, although not as strong as my (currently 7x) multiplier on the total points pool. Your fleet code made a noticeable and welcome difference. In one mission, v1.02 produced 2xM7 and 3xM6 (plus a couple of dozen fighters), while my hack produced an M1 and more fighters for the same mission. The M1 was good, but making 5 heavy ships was also good.

In all tests, however, there were still too many fighters and not enough heavy ships. So you could prefer more heavy ships when selecting the fleet.

Ideally, I would like to see a fleet more like 1xM1, 2xM7, 3-4xM6, 1xM8, plus fewer fighters, for the same mission.

When I look at the code, it appears that you create the fleet *before* applying the random multiplier to the total points. Did I read that correctly? If so, that would explain why there were so many fighters, even after your fleet code.

Would you get more points to apply to the fleet by calculating the total points multiplier first? Or by adding a similar random multiplier before the fleet calculation?

But I'm not sure that I am reading your changes correctly. I appreciated your comments in v1.00. If you feel like adding more (to describe how you are assigning the fleet) then that would be appreciated.

It is definitely an improvement over vanilla (and over v1.00). Thanks for working on this. :)

.

morbideth
Posts: 391
Joined: Sun, 9. Nov 08, 03:07
x3tc

Post by morbideth » Wed, 10. Oct 12, 06:10

DrBullwinkle wrote:It takes a long time to test OBS thoroughly, but I did a few missions with v1.02 and then the same missions with my modified OBS.

v1.02 definitely creates a stronger response than vanilla, although not as strong as my (currently 7x) multiplier on the total points pool. Your fleet code made a noticeable and welcome difference. In one mission, v1.02 produced 2xM7 and 3xM6 (plus a couple of dozen fighters), while my hack produced an M1 and more fighters for the same mission. The M1 was good, but making 5 heavy ships was also good.

In all tests, however, there were still too many fighters and not enough heavy ships. So you could prefer more heavy ships when selecting the fleet.

Ideally, I would like to see a fleet more like 1xM1, 2xM7, 3-4xM6, 1xM8, plus fewer fighters, for the same mission.
.
It is somewhat difficult to create modular fleets that will work for all values. But my personal experience concurs somewhat with yours regarding the number of fighters. I do want to wait until I improve the organization before I make any big changes though.
DrBullwinkle wrote: When I look at the code, it appears that you create the fleet *before* applying the random multiplier to the total points. Did I read that correctly? If so, that would explain why there were so many fighters, even after your fleet code.

Would you get more points to apply to the fleet by calculating the total points multiplier first? Or by adding a similar random multiplier before the fleet calculation?

But I'm not sure that I am reading your changes correctly. I appreciated your comments in v1.00. If you feel like adding more (to describe how you are assigning the fleet) then that would be appreciated.

It is definitely an improvement over vanilla (and over v1.00). Thanks for working on this. :)
.
No, this is where the brain crying flow of control comes in.

Code: Select all

<cue name="OBS Points" library="1" version="3">
Note the library flag. That means it is called elsewhere, like a function. So it is called way up at the top, then the other stuff runs, it would not work otherwise.

Edit: More info would be helpful. Such as what you are basing your suggestions on. What combat difficulty, what mission difficulty, what type of mission, what ship were you in, what was your fleet strength if any, ect.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 10. Oct 12, 08:14

morbideth wrote:Note the library flag.


OK, perfect!

I do understand that it is difficult to make OBS work correctly for all conditions. In fact, I believe it may be impossible. Eventually, I want to add an external difficulty factor. It might, for example, change the "75" to "125" in your random factor near the end of the script.

Edit: More info would be helpful. Such as what you are basing your suggestions on. What combat difficulty, what mission difficulty, what type of mission, what ship were you in, what was your fleet strength if any, ect.
Well, it was just one data point. Not really a suggestion, other than to try to demonstrate the idea that I would like to see your technique combined with mine -- and improve on both. :)

That said, I currently have Fight Rank 20, half a dozen M7's, a couple of M7M's, a dozen M6's, and a couple of dozen M3's. I might have an M2 lurking about somewhere, although I don't use it.

In-Sector I was flying a Tiger M7 with half a dozen docked M6's. The M6's are miners; they never launched. I did switch from the Tiger to a Hyperion Vanguard to clean up fighters after the big ships were dead.

It was a Defend Station mission; difficulty "Hard".

Obviously, two M7's and three M6's were not much of a challenge for a player-flown Tiger.

If the player has an M7 or larger, then enemy fighters make almost no difference at all. Too many of them just produce lag.

I would expect a "Very Hard" mission to include multiple M1/M2's in addition to M7's and M6's under these circumstances.

As mentioned previously, I multiply the vanilla total points by 7 in my own game. At the start of the game I use a multiplier of 2, and increase it gradually as my fighting strength increases. I will probably bump it up to 10 soon. So a range of 2 to 10 would be a good starting point (possibly higher later).

In TC I found that a factor of 30 was the maximum practical number. That typically produced a dozen M1/M2's, a couple of dozen M7/M6's, and 50 or more fighters. Anything higher than 30 produced more lag than combat. :)

Hope that helps.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”