Author Topic: Base Defense Mechanics  (Read 44128 times)

Offline Dioxine

  • Commander
  • *****
  • Posts: 5455
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Base Defense Mechanics
« Reply #45 on: April 12, 2015, 07:13:24 pm »
It is obvious, that blaster defense is best. But what will be best defense in general case? Is best defense that most powerful? Or best defense which has maximum range? Or best defense which can shoot rapidly? May be best accuracy should be taken into account? I think about maximum range.

In other hand, are you really will to use more than 2 types of base defense in one base? ;)

True, true, with this mod, you will have more statistics to weigh against one another... Which is what I love :)

About the last question though... Umm... what if I do without even thinking I shouldn't? :) I think it's highly likely (build a missile, then a laser, then 2 plasmas, bolstering progressively, for example - especially if a mod which allows non-battleships to attack base is enabled - sure missiles are old but why should I dismantle them? I have lots of space left :) ) Even 4 craft weapons mod doesn't fix it - vanilla has 4 types of defences, but what about non-vanilla? :)
« Last Edit: April 12, 2015, 07:15:19 pm by Dioxine »

Offline Ridаn

  • Colonel
  • ****
  • Posts: 269
    • View Profile
Re: Base Defense Mechanics
« Reply #46 on: April 12, 2015, 07:59:42 pm »
May be make each defence building behave like 1 interceptor? If submenu is impossible, then just use the same Interception menu used by craft. Sure it might get cluttered, but I think people who desire such option can handle some micromanagement in exchange for new strategic options.

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Base Defense Mechanics
« Reply #47 on: April 12, 2015, 08:20:15 pm »
Does this mechanic make base defences easier?

Like, a Battleship is fired at twice - first on the Geoscape and then on the defence screen. Or is the base artillery defence part disabled?

I don't think it would be a problem if it is attacked twice, I just would like to know.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Base Defense Mechanics
« Reply #48 on: April 12, 2015, 09:38:27 pm »
May be make each defence building behave like 1 interceptor? If submenu is impossible, then just use the same Interception menu used by craft. Sure it might get cluttered, but I think people who desire such option can handle some micromanagement in exchange for new strategic options.

Actually it's a lot of micromanagement.
Will be very annoying to manage an swarm of interceptors which can fly 5-10 sec on short distance, then will be the repair/refuel/rearm cycle at least 2 hours.

Does this mechanic make base defences easier?

Like, a Battleship is fired at twice - first on the Geoscape and then on the defence screen. Or is the base artillery defence part disabled?

I don't think it would be a problem if it is attacked twice, I just would like to know.

Even 3 times if you have a Grav shield. :)
But you not always can detect a battleship on Geoscape.
I'm not sure that need change something in vanilla base defense. At least need several tests to balance this behavior.
I will add one string to vanilla base defense mission: after shots of base defense will be start the recharge countdown.

In the other hand, in this mod first shot to a battleship can be at distance 280 m.
Velocity of a battleship can be up to 5000 mph.
Therefore base defense can have 280/5000*60 = 3.36 min to recharge.
So, if you set rechargeTime to 3 or 4 min then this behavior will be looks good :)
I think, the Grav shield also can give you 3-4 min of time to the second attack and second shot.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5455
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Base Defense Mechanics
« Reply #49 on: April 13, 2015, 08:43:19 am »
I think I have one solution - why not bypass the interception screen completely? Only add option for bases (or R-click for each defensive facility?) to either "fire at will" or "cease fire" and do the firing proper through the "base defensive fire screen" which is activated as an interrupt whenever "fire at will" is enabled and any UFO is detected & within range of any defences which are ready to fire atm.
Might seem primitive but has 4 advantages:
- No awkward "interception without interceptor" screen, uses familiar base defence screen instead (only with changed text and color, I'd suggest);
- Hence, no new gfx needed!
- No multiple defence building/type problems;
- Very little in the way of micromanagement, even if each building has to be activated/deactivated separately (which I'd prefer).
« Last Edit: April 13, 2015, 08:45:43 am by Dioxine »

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Base Defense Mechanics
« Reply #50 on: April 13, 2015, 10:43:32 pm »
Of course this solution is very easy to implement.
But where is the fun? ;)

btw, new interface for active base defense:
« Last Edit: April 13, 2015, 10:45:14 pm by redv »

Offline Dioxine

  • Commander
  • *****
  • Posts: 5455
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Base Defense Mechanics
« Reply #51 on: April 13, 2015, 10:47:46 pm »
Of course this solution is very easy to implement.
But where is the fun? ;)

btw, new interface for active base defense:

Hehehe, I like it.
So it seems you have around 2 unused buttons - maybe use them as <next building> <prev building> buttons?

Offline pilot00

  • Colonel
  • ****
  • Posts: 487
  • Back in the day it was gameplay not a feature....
    • View Profile
Re: Base Defense Mechanics
« Reply #52 on: April 14, 2015, 03:09:25 pm »
I have a.... radical way of doing this. Though I dont know if its possible code wise. So as Jstank said I am throwing wild donuts:

Seen as the 4 buttons concide with our four available defense types (plasma, missiles,lazer, fusion) why not hard code each one to be "linked" durring the "interception" screen to one of them? Effectively switching which one will fire (as oposed to all of them firing together). Each one should have a number of shots according to how much you have of each.

And we can cram the X-Com logo in place of our interceptor status screen.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Base Defense Mechanics
« Reply #53 on: April 14, 2015, 05:25:59 pm »
The interface has one free button. Possible to choose weapons in cycle (as suggested @Dioxine).
For example the base has 4 types of defense facilities: A, B, C and D.
When the dogfight window loaded, shows types A and B.
One click - then shows B and C.
Second click - shows C and D.
Next click - D and A. etc.

It is not a big problem to implement. But will be problem with support in future.
This feature better to implement after TFTD to avoid compatibility issues.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Base Defense Mechanics
« Reply #54 on: April 14, 2015, 06:16:39 pm »
Final version of Active base defense is ready.

The button "Activate base defense" will be shown only if ruleset "Active_Base_Defense.rul" loaded and the base has at least one defense facility.
In other cases will be shown the standard intercept window.
Each base can be activated separately.


If the defense was activated and found a suitable target then starts a dogfight window.
Will be chosen 2 most long-range weapons. Quantity of ammo = Quantity of facilities of this type  x  Maximum quantity of ammo for this facility.
Possible modes: not shoot / shoot / disable defense / allow disengage for UFO
One base can track only one target.


The window can be minimized if you not began an air battle.
After each use of base defense starts a recharge countdown (even after vanilla use of base defense).


Behaviour can be tuned via ruleset:
Code: [Select]
# X-COM 1 (UFO: Enemy Unknown) ruleset
defense:
  rechargeTime: 10      # minutes. If value == 0 then active defence will be disabled permanently.
  retaliationChance: 30 # 0..100 %. Chance to uncover the base by aliens after air battle.
#-----------------------------------
crafts:
  - type: STR_BASE
    requires:
      - STR_BASE_DEF
    sprite: 30
    damageMax: 100      # should be > 0. Actually not used.
    weapons: 2
#-----------------------------------
craftWeapons:
  - type: STR_MISSILE_DEFENSES
    sprite: 1
    sound: 5
    damage: 100         # the same as for launcher
    range: 40           # range in pixels: (range for facility)/4; i.e. 160/4 = 40
    accuracy: 50        # the same as for defence facility
    reloadStandard: 72
    ammoMax: 5          # maximum ammo for each defence facility
    launcher: STR_AVALANCHE_LAUNCHER
    projectileType: 1
    projectileSpeed: 8
  - type: STR_LASER_DEFENSES
    sprite: 4
    sound: 8
    damage: 70
    range: 50           # 200/4 = 50
    accuracy: 60
    reloadStandard: 24
    ammoMax: 5
    launcher: STR_LASER_CANNON
    projectileType: 4
  - type: STR_PLASMA_DEFENSES
    sprite: 5
    sound: 9
    damage: 140
    range: 60           # 240/4 = 60
    accuracy: 70
    reloadStandard: 24
    ammoMax: 5
    launcher: STR_PLASMA_BEAM
    projectileType: 5
  - type: STR_FUSION_BALL_DEFENSES
    sprite: 3
    sound: 7
    damage: 230
    range: 70           # 280/4 = 70
    accuracy: 80
    reloadStandard: 48
    ammoMax: 4
    launcher: STR_FUSION_BALL_LAUNCHER
    projectileType: 3
    projectileSpeed: 8
#-----------------------------------
facilities:
  - type: STR_MISSILE_DEFENSES
    defenseRange: 160   # maximum range is 280 miles (70*4 = 280)
  - type: STR_LASER_DEFENSES
    defenseRange: 200
  - type: STR_PLASMA_DEFENSES
    defenseRange: 240
  - type: STR_FUSION_BALL_DEFENSES
    defenseRange: 280
#-----------------------------------
extraSprites:
  - type: INTICON.PCK
    width: 352
    height: 80
    subX: 32
    subY: 40
    files:
      27: Resources/ActiveBaseDefense/abd_geoscape.png
  - type: INTERWIN2.DAT
    width: 160
    height: 556
    singleImage: true
    files:
      0: Resources/ActiveBaseDefense/abd_interwin2.png
#-----------------------------------
extraStrings:
  - type: en-US
    strings:
      STR_ACTIVATE_DEFENSE: Activate Base Defense
      STR_CANT_MINIMIZE_DURING_BATTLE: Can't minimize during battle
  - type: en-GB
    strings:
      STR_ACTIVATE_DEFENSE: Activate Base Defence
      STR_CANT_MINIMIZE_DURING_BATTLE: Can't minimize during battle

The code: https://github.com/SupSuper/OpenXcom/compare/master...redv:active_base_defense
The code compatible with latest nightlies.

If you have an interest I'll try to build an standalone exe (I never did it before:)
« Last Edit: April 14, 2015, 06:21:22 pm by redv »

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: Base Defense Mechanics
« Reply #55 on: April 14, 2015, 08:45:25 pm »
I think I'd prefer without the intercept window, mostly for balance : Aircrafts give you the flexibility of changing targets, delaying your attack (over sea) or guard a landed UFO.
If a "missile defense" building can be used as a ICBM, it already has the advantage of being four times smaller than a hangar, no 600k$ renting fee per month, no storage of the cumbursome missiles. So it would be a balanced alternative if the missiles were shot in a fire-and-forget way : If the missile reaches the UFO while it's landed, it's a miss (no bombing Earth). If it reaches the UFO while over a lake, "ploof", no crash site.

Offline redv

  • Colonel
  • ****
  • Posts: 335
    • View Profile
Re: Base Defense Mechanics
« Reply #56 on: April 15, 2015, 01:18:33 am »
If you not use base defense, then you need only interceptors.
But if you use base defense, then you need and interceptors and base defense.
Therefore economic calculations is not the point.

Balance in this case will be determined by quantity of downed UFOs by the base defense.
How many could be as maximum? 5%? May be 10%? Who know. Need tests.
Quantity of downed UFOs (by the base defense) can be easily adjusted by distance (defenseRange).

Offline pilot00

  • Colonel
  • ****
  • Posts: 487
  • Back in the day it was gameplay not a feature....
    • View Profile
Re: Base Defense Mechanics
« Reply #57 on: April 15, 2015, 02:44:25 am »
Should also take into consideration amunition problems though I dont know if it is possible to link it somehow. Perhaps the power building module that was suggested in another thread could be used as a balancing factor to counter spamming defenses?

Offline NuclearStudent

  • Captain
  • ***
  • Posts: 92
    • View Profile
Re: Base Defense Mechanics
« Reply #58 on: April 15, 2015, 03:52:44 am »
Should also take into consideration amunition problems though I dont know if it is possible to link it somehow. Perhaps the power building module that was suggested in another thread could be used as a balancing factor to counter spamming defenses?

Only two base defense facilities can be used for active defense. As well, each module has limited ammo.

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: Base Defense Mechanics
« Reply #59 on: April 15, 2015, 12:08:23 pm »
But if you use base defense, then you need interceptors and base defense.
Why? because of risk of discovery ? Interceptors won't stop a retaliation battleship anyway.
Should also take into consideration amunition problems though I dont know if it is possible to link it somehow.
If you mean ammo as a way to incur a cost every time the facility is used, you can make the facility consume missiles that you simply store in general stores.