Spawning minefields

Order of Battle is a series of operational WW2 games starting with the Pacific War and then on to Europe!

Moderators: The Artistocrats, Order of Battle Moderators

StuccoFresco
2nd Lieutenant - Panzer IVF/2
2nd Lieutenant - Panzer IVF/2
Posts: 669
Joined: Sun Feb 10, 2019 11:10 am

Re: Spawning minefields

Post by StuccoFresco »

Erik2 wrote: Mon Nov 02, 2020 11:42 am Maybe defense structures (and bunkers) should simply replace the inf unit with the structure. That should force the players to think long and hard about using this.
Or use 8-9 strength points of the original unit.
I'd completely "destroy" the infantry unit, honestly.
Shards
Slitherine
Slitherine
Posts: 3991
Joined: Tue Aug 25, 2015 10:05 am

Re: Spawning minefields

Post by Shards »

There are, but the Imperial Japanese Navy does not have the defensive specialization.

Thus using two versions of the Japanese Force to create this setup.
GabeKnight
Lieutenant-General - Karl-Gerat 040
Lieutenant-General - Karl-Gerat 040
Posts: 3710
Joined: Mon Nov 27, 2017 10:24 pm

Re: Spawning minefields

Post by GabeKnight »

Erik2 wrote: Mon Nov 02, 2020 11:42 am Maybe defense structures (and bunkers) should simply replace the inf unit with the structure. That should force the players to think long and hard about using this.
Or use 8-9 strength points of the original unit.
If you "kill" the original unit by building something (e.g. construction group), you may end up with a "core" bunker in your unit roster that you can't deploy.

A good idea with the "Bautruppe" unit, though. There's a whole spec awarding you this basically "useless" one unit. Them being able to construct bunkers and/or airstrips (maybe very expensive or with a 5-turn delay; I'll have to test this) sounds good to me.

Is it possible for land units to make repairs to structures, I wonder?
Shards
Slitherine
Slitherine
Posts: 3991
Joined: Tue Aug 25, 2015 10:05 am

Re: Spawning minefields

Post by Shards »

Something like how the medic jeep can heal units?
GabeKnight
Lieutenant-General - Karl-Gerat 040
Lieutenant-General - Karl-Gerat 040
Posts: 3710
Joined: Mon Nov 27, 2017 10:24 pm

Re: Spawning minefields

Post by GabeKnight »

Shards wrote: Tue Nov 03, 2020 7:26 pm Something like how the medic jeep can heal units?
Exactly like this, yes.
Right now I'm not sure if it's maybe possible (with modding) already?
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: Spawning minefields

Post by Horst »

Shards wrote: Tue Nov 03, 2020 7:26 pm Something like how the medic jeep can heal units?
Interesting, the Medical Jeep can actually repair damaged structures even if structures have the noRepair class-trait. Oh, I'm going to add this to the engineer units. Could make these more interesting to play. :mrgreen:
AFAIR, the repair function of the Jeep and Support Ship was quite expensive or the xp-loss higher compared to units' own ability.

Shards, are you the new coder of the game?

Btw, I beg to change the damage dealing of minefields. Instead of using engineer units to clear them, I tend to abuse this by cheap units to cheaply attack them and repair their costs afterwards. I suggest clearing mines penal-unit style in a 1:1 strength ratio, so a "clearing" unit gets more or less wiped out during the attack-process. I mean attacking them and not safely engineer-clearing of course. Damage dealing when accidently running onto them may be untouched as our units aren't lemmings. Otherwise, mines are too useless. I've already tried to change their damage dealing in the past but this seems hardcoded.
GabeKnight
Lieutenant-General - Karl-Gerat 040
Lieutenant-General - Karl-Gerat 040
Posts: 3710
Joined: Mon Nov 27, 2017 10:24 pm

Re: Spawning minefields

Post by GabeKnight »

Horst wrote: Tue Nov 03, 2020 9:49 pm Interesting, the Medical Jeep can actually repair damaged structures even if structures have the noRepair class-trait. Oh, I'm going to add this to the engineer units. Could make these more interesting to play. :mrgreen:
Ah, thanks, seems I've misunderstood Shards answer. So it's already possible? Cool.

Yeah, also noted for my mod. :D
Horst wrote: Tue Nov 03, 2020 9:49 pm AFAIR, the repair function of the Jeep and Support Ship was quite expensive or the xp-loss higher compared to units' own ability.
Always "regular" repairs, yes, that's why I never use them repairing my core units.
Don't remember if repairing was more expensive but the Jeep healed 3HP I think and even units that moved - although it's been ages since I've ran those tests.
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: Spawning minefields

Post by Horst »

The unit-trait healer only works for allied units and those with at least 1 action point, what means in vanilla pristine condition, the bulldozer and the horse_transport couldn't be repaired/healed.
You should still add costs, like for the mines 20 and for other buildings, as otherwise the Medical Jeep could repair damaged mines and other buildings for free.
The regular repair cost is half of unit-cost when I tested it, but haven't tested the exp-loss yet compared to units' own repair ability.
StuccoFresco
2nd Lieutenant - Panzer IVF/2
2nd Lieutenant - Panzer IVF/2
Posts: 669
Joined: Sun Feb 10, 2019 11:10 am

Re: Spawning minefields

Post by StuccoFresco »

How can I mod the cost and/or number of HP healed with the Healer trait?
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: Spawning minefields

Post by Horst »

StuccoFresco wrote: Thu Nov 05, 2020 11:38 am How can I mod the cost and/or number of HP healed with the Healer trait?
Normally, you should pray to the machine god to hear your plea.
Another way is to hack your way into Assembly-CSharp.dll and change something there. That's at least what I am going to do as unbeliever sooner or later, as I'm also curious if I can change the mines' damage there.

The healer cost is the same like the green/regular repair. What else I noted about costs:

Code: Select all

Unit-cost
=========
- series-upgrades cost 50% for land/air and 10% for naval; non-series upgrades 80% of purchase cost
- 50% of repair costs on auxiliary units is refunded at scenario end
- Disbanding units nets 20% of purchase cost
- Repair Cost R/E:
  - regular/green: 50% unit's purchase cost
  - elite: 61-140% unit's purchase cost depending on XP
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: Spawning minefields

Post by Horst »

I've already managed to tweak the damage of mines, although this isn't as easy as it sounds.

Code: Select all

public static class MinesAttack
{
    public static List<List<int>> Execute(Unit attacker, Hex fromHex, Hex hex, Unit defender, bool ambush, bool simulate, GameState gameState)
    {
        Unit unit = attacker;
        Unit unit1 = defender;
        if (defender.State(gameState).unitType.uClass.mines)
        {
            unit = defender;
            unit1 = attacker;
        }
        GameCommanders.GetCommanderInRange(unit1, gameState);
        int num = 0;
        int num1 = 0;
        if (attacker.id != unit.id)
        {
            num = Mathf.Min(100, unit.State(gameState).strength); the damage done to mines
            num1 = num / 3; the attacker's strength loss
        }
        else
        {
            num1 = 10; this is the unit's strength loss during ambush
            num = 30; mines' strength loss during ambush
        }
        if (!simulate && App.game.combatRandomising)
        {
            if (attacker.id != unit.id)
            {
                int num2 = unit.State(gameState).strength * App.game.SetState(gameState).GetNextRandomInteger(0, 11) / 100;
                num1 += num2;
            }
            else
            {
                int nextRandomInteger = App.game.SetState(gameState).GetNextRandomInteger(0, 5);
                num1 += nextRandomInteger;
                num = num + nextRandomInteger * 3;
            }
        }
        if (unit1.State(gameState).unitType.mineImmunity)
        {
            num1 = 0;
        }
        List<List<int>> lists = new List<List<int>>(2);
        if (attacker.id != unit.id)
        {
            lists.Add(Combat.UnitResult(attacker, 0, defender, defender.State(gameState).hex, num));
            lists.Add(Combat.UnitResult(defender, 0, attacker, fromHex, num1));
        }
        else
        {
            lists.Add(Combat.UnitResult(defender, 0, attacker, fromHex, num));
            lists.Add(Combat.UnitResult(attacker, 0, defender, defender.State(gameState).hex, num1));
        }
        return lists;
    }
}
Originally, the brute-force clearer only suffers 1/3 strength loss compared to the damage to mines. Note that damage calculation is done with factor of 10 to save decimals.
Problem is that even a 1-strength unit could normally do 100(%) strength loss to mines, although that would still be suicide. I'd rather have it in a 1:1 ratio depending on the attacker's strength. No idea yet how to change this.
Right now, I could make it a ratio like only 1 or 3.4 damage/strength loss for attacker and mines per turn; or at least to mines with possible less for the brute-force clearer. I think mines should hinder the enemy for a certain number of turns and not be simply passable in a single turn of self-sacrifice, as long as not engineers are used.
Opinions?
GabeKnight
Lieutenant-General - Karl-Gerat 040
Lieutenant-General - Karl-Gerat 040
Posts: 3710
Joined: Mon Nov 27, 2017 10:24 pm

Re: Spawning minefields

Post by GabeKnight »

Don't know if it helps, but here's a bit from some older post of mine:
So, for those interested I did a bit reverse-math and the formulas for repair cost should be as follows:
(tested on land units only, but I guess it applies to all :?: )

Regular repair cost = unit cost * HP * 0.05
Elite repair cost = unit cost * HP * (0.06 + 0.008 * experience/1000)

(spec discounts like "Pilot Rotation" not included; and don't forget the game always rounds up to full RP)
Horst, are the comments in the code yours or original?
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: Spawning minefields

Post by Horst »

GabeKnight wrote: Fri Nov 06, 2020 11:49 pm Horst, are the comments in the code yours or original?
Mines! :D

Such code remarks are often removed during the compiling process. I only added it for dummies like me to remember.
I've currently changed mine-attacking to a 34:34 strength loss. It's still not perfect if an attacker has only 1 strength left, but at least it equals the 3-turn cooldown to place mines somewhat, although you could still use more than one mine-attacking unit to speed-up clearing in the same turn. It's otherwise not balanced if engineers often need 2 turns to place them at the right location, while a bunch of aux Conscripts, which are even cheaper than a 20-RP minefield, runs it over in a single turn. Their aux repair-cost gets even refunded by 50% at the end of the scenario!

Not sure yet how it works for higher difficulty grades, as I'm doing a little break to play Fantasy General II again which plays and works much better after one year expanding, fixing and rebalancing than this game with its buggy options/effects now after five years... I want to see the day OoB is fully working for a while.
Red Star and Steel was still entertaining so far, although the Soviets really lack the many upgrades that the German side has usually to offer. I got envious watching the cool upgrades of the Germans while playing against them.

Btw, the minesweeper trait-ability works with a 1.5-factor strength (1 unit-strength clears 1.5 mine-strength). I'd like to have something like this for brute-clearing too, but this code-injection method by Reflexil is way too complicated to do that for me.
GabeKnight
Lieutenant-General - Karl-Gerat 040
Lieutenant-General - Karl-Gerat 040
Posts: 3710
Joined: Mon Nov 27, 2017 10:24 pm

Re: Spawning minefields

Post by GabeKnight »

Horst wrote: Sat Nov 07, 2020 3:50 pm
GabeKnight wrote: Fri Nov 06, 2020 11:49 pm Horst, are the comments in the code yours or original?
Mines! :D
Ah, okay. Because some of them seemed wrong... :wink:
Horst wrote: Sat Nov 07, 2020 3:50 pm It's otherwise not balanced if engineers often need 2 turns to place them at the right location, while a bunch of aux Conscripts, which are even cheaper than a 20-RP minefield, runs it over in a single turn. Their aux repair-cost gets even refunded by 50% at the end of the scenario!
This is actually quite the good point, but I think it affects rather MP games.

In a single-player game the AI can only clear mines with engineers or heavy infantry, so the 20RPs are well spent usually. And the other way around? The AI can not lay mines. They are preset by scen designers.

But overall I think you're right, mine "clearing" by units walking into them should be punished harder.
Horst wrote: Sat Nov 07, 2020 3:50 pm Btw, the minesweeper trait-ability works with a 1.5-factor strength (1 unit-strength clears 1.5 mine-strength).
Thanks. Added to my knowledgebase.
Post Reply

Return to “Order of Battle Series”