Liaison Tools Modding Questions

Post Reply
TimDee58
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 270
Joined: Wed Mar 07, 2018 1:32 am
Location: Russian Federation

Liaison Tools Modding Questions

Post by TimDee58 »

I hope to achieve the following by tweaking the Liaison Tools file however as a non programmer / scripter I'm hesitant to change the file without seeking guidance from those cleverer (and more experienced) than I am...

I've obviously created a Mod folder in the appropriate place so am now wondering how to achieve the following....

Attacker or Defender?
I wish to ensure that the player that owns the province in which the battle is to be fought is always considered to be the defender, likewise if in an enemy province my army should always be the attacker.

(I'm constantly frustrated to find that my better defensive generals fighting in their home territory often are considered to be attacking for some reason, how can I base a strategy on my generals abilities when I cannot be certain that they will actually defend? - likewise when in enemy territory I'd like to know that I can rely on my better attacking generals to actually do so)

I'd also like to know if this could be integrated with Rise of AI which I use for playing out my campaign battles.

Being naive I'm assuming this is an easy tweak?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: Liaison Tools Modding Questions

Post by rbodleyscott »

TimDee58 wrote: Tue Feb 11, 2020 11:58 pm I hope to achieve the following by tweaking the Liaison Tools file however as a non programmer / scripter I'm hesitant to change the file without seeking guidance from those cleverer (and more experienced) than I am...

I've obviously created a Mod folder in the appropriate place
That won't work as Empires battles uses the script from the main build.
Attacker or Defender?
I wish to ensure that the player that owns the province in which the battle is to be fought is always considered to be the defender, likewise if in an enemy province my army should always be the attacker.
You can't without modding Empires, as Empires sends the relevant information in the export file. (Which is really just which ratings each general uses). It doesn't send the information as to who is attacker and defender, nor indeed what the generals' other rating is, it just sends the rating that Empires deems should be used. FOG2 does not have access to the data to do what you want.
(I'm constantly frustrated to find that my better defensive generals fighting in their home territory often are considered to be attacking for some reason, how can I base a strategy on my generals abilities when I cannot be certain that they will actually defend? - likewise when in enemy territory I'd like to know that I can rely on my better attacking generals to actually do so)

I'd also like to know if this could be integrated with Rise of AI which I use for playing out my campaign battles.

Being naive I'm assuming this is an easy tweak?
It can't be done by modding FOG2, only by modding Empires.
Richard Bodley Scott

Image
TimDee58
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 270
Joined: Wed Mar 07, 2018 1:32 am
Location: Russian Federation

Re: Liaison Tools Modding Questions

Post by TimDee58 »

Thanks Richard

(if I had any teeth left I'd gnash them lol)
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: Liaison Tools Modding Questions

Post by rbodleyscott »

TimDee58 wrote: Wed Feb 12, 2020 10:00 am Thanks Richard
You could of course manually edit the export file for each battle, to change the generals' ratings. It would only take a few seconds. You would need to do it before hitting the Empires Battle button in FOG2.

You will find the export file at:

/Documents/My Games/FieldOfGloryEmpires/SAVES/AgeodBattleData.TXT

It starts as follows:

Code: Select all

SAVENAME 450057002700>600020013000200350007001600270047001600020067005600270037005700370002003500070016002700470016000200740027001600>6004600020034001600=6000700160096007600>60002003300130003000200240034005400
BATTLEID 12887
SIDEID0 39
SIDEID1 14
MAPTYPE 1
NOCOAST
SEEDNUMBER 1014248831
REGION 1400270036001600460096001600
DATE -310
 
[GENERAL0]
AGEOD_ID 576192512
NAME 540067005600270076005600470056003700
QUALITY 1
 
 
[GENERAL1]
AGEOD_ID 0
 
 
########## UNITS RECORDS ##########
You just need to change the value of QUALITY (Only 0, 1 or 2 are valid values) for one or both generals. (GENERAL0 is your general, GENERAL1 is the AI general. In the example above, the AI army has no named general).
Richard Bodley Scott

Image
TimDee58
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 270
Joined: Wed Mar 07, 2018 1:32 am
Location: Russian Federation

Re: Liaison Tools Modding Questions

Post by TimDee58 »

BRILLIANT! Thank you Richard
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

I'm mostly playing around with this for my own fun, and something to do during the virus lockdown. But the leader rating thing is something I was starting to look at, it does feel a bit wierd at times who is attacking and defending, I'm wondering whether to avoid the extreme 2-0/0-2 generals and stick with 1-1 generals as at least I know what I get, the others feels far too swingy. This is exacerbated by the experience hit if you change general so it is hard to get the best general in place if you suddenly need to go from a defensive general on the border to one who needs to move and attack a besieger etc, or an attacking general who is stuck besieging when a large relief force arrives.

I can mod empires to change this, here is what I was pondering, it may go some way to what you were after, but isn't the same logic. It still leaves open the possibility of a general fighting the wrong battle, but hopefully less so in some cases.
  • Work out which general has the advantage.
    • This will be the one who has best overall rating, so a 1-1 = 2, a 0-2 = 2 etc
    • The person who didn't move gets +1 (they have an edge for being first there)
    • The person who owns the region gets +1 (they have an edge from knowledge, locals etc)
  • The general with the advantage will choose what they are best at (without regard to the enemy, cos unbalanced generals are sure of themselves) or if they are balanced the worst the enemy is at (a balanced general will consider the enemy), if still a tie go with the standard current logic
  • If no one has the edge go with the standard current logic
So the idea is that there is some attempt to have the better general force the tactical battle to his strength, no matter his strategic situation. Think Hundred years war where the English often attacked enemy provinces but tried to fight defensive battles. This won't always work, there is a good chance of a tie, and it just comes down to who moved etc.

So for example:
My 2-0 attacking general has campaigned in enemy lands and is now stuck besieging a city.
A large enemy force is moving in.

Currently I'm likely to be the defender, and be using my 0 rating.

The above logic would give me 3 points of advantage (2 + 1 for being there already), and the enemy 1 (home ground). a 0-0/1-0/0-1 enemy general would not be good enough to out think mine and I would choose a rapid attack on the relief force rather than sit and wait. An enemy 1-1/2-0/0-2 would tie and we would go with normal logic, which probably means I defend. A better enemy general (2-1 etc) would have the edge and force a battle that is good for them or bad for me (NB good for them may actually not be bad for me, a 1-2 general would defend leaving me still attacking but with no clear edge).


So there is still a chance my 2-0 general is defending, but it now is less likely against inferior enemy leaders, and will happen when facing good enemy generals. My 1-0/0-1 etc generals may likely have more problems, but whilst bad is not as swingy as the better generals being forced onto their bad stat.


As a side point, it appears I can mod what is passed to FOG2, so can also indicate attacker and defender there. Though I'm having issues on the FOG2 side with modding the LiaisonTools.bsf properly (it won't use a modded version, only the installed version). So it should be possible to tell FOG2 who to make defender, though I'm not currently sure what difference that would make (I think there is some logic about who wins a tied battle maybe, but when does that ever happen!). My main interest though was in passing extra map properties, so the better general has more advantageous terrain rather than just modify unit experience a lot. I may have to play around with that, FOG2 has map types but currently no easy way (or I missed it) of saying add even more forest/rough because my excellent battle ground choice has decided that the enemy phalanx would be worse off with that but my light infantry force would not be. If I can do that then I can lessen the experience modifier which is bugging me - having troop quality bounce around so much per battle is annoying. I don't mind some experience mod, but the amount is currently very noticeable with even a 1 leader difference. I notice that the game does not apply this mod if it is a human waits for reinforcement battle, so there is a precadent that other balancing acts negate the need for experience mods.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: Liaison Tools Modding Questions

Post by rbodleyscott »

IIRC Empires does not pass the information as to who is defender and who attacker, it just passes the applicable general skill.
Richard Bodley Scott

Image
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

No, but that is moddable:

SAVENAME 450057002700>
BATTLEID 16767
SIDEID0 32
SIDEID1 10
DEFENDER 1 <<< - new element to indicate defending side
MAPTYPE 0


The inability to get LiaisonTools working as a mod is a downer at the moment of course, so nothing is yet reading it.
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

So I managed to get the above attacker/defender logic, or at least a 1st pass. The logic for setting up a battle and resolving it caught me out a couple of times, and whilst I don't think I've ever seen it yet in game, there appears to be script for allies in battles! the existing script also seemed to account for more than 1 group on a side doing different things which could impact who was defending - e.g. You have an army in the region for a long while and another who arrives at the same time as the enemy, so you had 2 groups one of whom may qualify as defender and the other as not.

For now I've ignored those factors, and just used the primary group (as chosen by the logic initiating a battle elsewhere) and the commander of the combined force (also set elsewhere).

Within those params it seems to be working quite well now. Whilst it will still drop to the old behaviour on ties, it is a bit more predictable, so for example if you are already sat on your home turf against an enemy coming at you then your general is going to have to be quite out classed to not get his best rating (or the worst enemy rating), so your good attacking general will take to the offense or defense as suits. On the other hand attacking enemy regions, especially where his army is already setup, is something to be very wary of if the enemy has any half decent generals himself.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: Liaison Tools Modding Questions

Post by rbodleyscott »

The answer is that the Liaison stuff is called from MainMenuOverlay.BSF, which is a CORE UI script, and so won't load modded scripts. This is WAD. No doubt for good technical reasons.

So if I am to make it possible for a modded version of LiaisonTool.BSF in a global mod to work, it will require some reorganisation of the way Exported battles are launched in FOG2.

I will look into it for a future update.
Richard Bodley Scott

Image
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

Thanks for confirming that problem.
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

So I've been playing around a bit more with empires battles/leaders and also FOG2 conversions.

The Empires -> FOG2 part was my main reason for getting Empires, though I have to say it is quite good on its own. However, the conversion of units experience in FOG2 due to leader difference was getting to me at times. Having elites troops in one battle and then noticeably not, or supposedly naff enemy troops bouncing between average and superior etc was sort of spoiling it for me personally. I can certainly see why it was done, but I wasn't so keen on the implementation. I wanted to change that to a lesser effect, so leader difference impacting troop quality still exists, just not so much, but then use something else to represent the leader difference.

To compensate I've been looking at 2 things.

First tweaking the break points of the armies so that whilst the troop quality is more as what I'd expect; the army with the better general will not break at 40%. For the moment I've given the general with the edge a 5% bonus (45%) and if the difference is 2 pts of leadership (the max I think) then the worst leader receives a 5% penalty (35%) and a briefing note that the enemies reputation preceded him. The 60% point I've left for now.

The other thing I've been playing around with is terrain adjustment. The idea is to make a rough guess at good/bad terrain types for the armies and then twiddle with the amount of that terrain in favor of the better general so that the map type is set as normal, but the better general will obtain a slightly more advantageous field on top of that. Well in theory anyway, at times bad terrain is good for the player. Which is where I am at the moment, what logic to try and use for terrain adjusts.

To at least prove the script works I've just totted up the terrain modifiers per unit in Empires and written out the difference between the 2 sides in the export. LiaisonTools then uses that to adjust the terrain setup. Empires and FOG2 don't work the same way terrain wise, but it at least shows it can be done and seems to work and is sort of heading the right way. The terrain gen in FOG2 took me a while to work out (especially with rough terrain which is the first type plotted and then gets overwritten by everything else - confused me as to where my mass rough was going :D ), but I seem to have it working.

So if others were looking at something similar what sort of changes would you think? Or are there maybe other game adjustments that could represent a better leadership to make the single player FOG2 conversion more interesting?

Morale - is +/- 5% OK. I've had a few close games before where a 5% change could well have made the difference, or should it maybe be more.
Terrain - is this a good idea or not. How would others look at maybe implementing that to make a good difference.
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

Regarding the Empires side, I've tweaked several things around attack/defense choice, deployment slightly based on leader focus (leader personalities sort of) and a change to frontage to make fields a little bigger if large armies face each other.

However, is there a way of having a non campaign mod in Empires like the FOG2 globals mods. I tried a speculative MODS folder, but on its own the did nowt.
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

Ok, interesting, I don't think I've gone anywhere near the import back to Empires, but I no longer get the auto import battle option on restarting Empires. The issue appears to be that the battleid = 0 in the result file, If I manually copy that over from the orginal export file it works.
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

Aha, that last issue may be an odd bug.

It was down to the issue with LiaisonTools not being moddable in the correct way (see above). I have therefore been modding the installed version.

However, I still had the original version in the Global Mod, even though it wasn't being used.....

Except it is being used, I am guessing (confirmed with some extra debug info, the write back of results was using the non useable verion!), but it appears once you are in the game it is somehow switching to the mod one even though it can't use it early on. That seems to cause it to somehow lose the battleID, but not the other data? At any rate, renamed that out the way and it I'm able to auto load results back into Empires.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: Liaison Tools Modding Questions

Post by rbodleyscott »

storeylf wrote: Thu May 14, 2020 11:56 pm
It was down to the issue with LiaisonTools not being moddable in the correct way (see above). I have therefore been modding the installed version.

However, I still had the original version in the Global Mod, even though it wasn't being used.....

Except it is being used, I am guessing (confirmed with some extra debug info, the write back of results was using the non useable verion!), but it appears once you are in the game it is somehow switching to the mod one even though it can't use it early on.
It is only MainMenuOverlay.BSF that won't use the modded version of LiaisonTools.BSF, because it is a core UI file. However, other scripts may well load the modded version if it exists.
Richard Bodley Scott

Image
storeylf
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 45
Joined: Tue Oct 06, 2015 8:27 pm

Re: Liaison Tools Modding Questions

Post by storeylf »

Thanks, obviously I saw that something like that was happening yesterday. So how does that work? I was assuming that it was more like once it has found a copy it would just use that copy from then on, but it sounds like it will keep looking for other copies at other points. When is that? Is it when ever a script file it hasn't seen before includes it - does it then search again for all dependencies of the new file and find ones it couldn't before (which feels not overly robust) or is it at certain points like starting a scenario, does it clear out what it has and load only what is needed for the scenario?

I was trying to work it out in my mind last night what had happened, but I'm not familiar with the language/runtime you use. Just extrapolating I assume that what ever happened, because it had found the new version of LiaisonTools post launch that I had either had some form of scoping issue or overwrite, and gBattleDesc was now not the same gBattleDesc I had to start with, hence the battleId = 0. the other data that it did write out (unit state etc) seems more likely to have been passed to it from the scenario, only it will know the game state and unit states.

If I can grasp what is going on, and when I may be able to see a modded version for the first time I'm wondering whether i can work around the load issue early on.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28323
Joined: Sun Dec 04, 2005 6:25 pm

Re: Liaison Tools Modding Questions

Post by rbodleyscott »

storeylf wrote: Fri May 15, 2020 12:21 pm Thanks, obviously I saw that something like that was happening yesterday. So how does that work? I was assuming that it was more like once it has found a copy it would just use that copy from then on, but it sounds like it will keep looking for other copies at other points. When is that?
Heaven knows. I am not party to the detailed internal workings of the engine.
If I can grasp what is going on, and when I may be able to see a modded version for the first time I'm wondering whether i can work around the load issue early on.
According to Pip, the author of the engine, there is no workaround that you could do as a modder, because any workaround would require you to mod MainMenuOverlay.BSF, and the modded version of that would not be loaded as it is a core UI script.

There might be a workaround that I could do in the main build, for a future update, but so far my efforts have met with failure, and I must get on with my proper development tasks rather than spend too long trying to make a mod work.
Richard Bodley Scott

Image
Post Reply

Return to “Field of Glory II: Modding”