Author Topic: Auto-Battle  (Read 16233 times)

Offline OmniscientQ

  • Sergeant
  • **
  • Posts: 14
    • View Profile
Auto-Battle
« on: May 31, 2020, 05:06:23 am »
X-COM Auto-Battle

One of the few features of the old xcomutil by Scott Jones yet to be implemented in OpenXcom is the auto-battle feature. For those who don’t remember, it was an option that would allow the player to automate tactical combat.

It didn’t hand control of your troops off to the AI to finish the battle. Instead, it reduced the participants on both sides to a couple of abstracted numbers, and then rolled some dice. If I’m recalling correctly, it made some sweeping assumptions. Ammunition wasn’t actually consumed. Fire rates didn’t matter. You had a basic 5% chance to capture rather than kill. Night missions applied a huge penalty that was partially offset for any soldier carrying a flare. Psionics basically amounted to an “I win” button. The xcomutil feature could also be invoked mid-battle. Once you had cleared the bulk of the alien forces, tipped the score in your favor, you could leave the clean-up to the grunts.

Some people might be tempted to say that an auto-battle function is cheating, or it defeats the whole point of the game, but I have a few reasons for thinking that OpenXcom would benefit from having one. In no particular order:

1 – One of the self-imposed challenges proposed in the xcomutil readme, and one I enjoyed, was to run auto-battle on every mission, and never assume direct control (Insert Mass Effect meme here). Being unsure of whether you’ll get the live Navigator or Deep One in your first month means having to change things up, and poses some new challenges.

2 – Sometimes, you just can’t stomach the thought of going through the motions to retrieve a medium scout full of Floaters, or to track down the last alien who's hiding in a closet. Even when you don’t have the flying power armor and psionic amplifiers to make such a mission risk-free, it’s just a chore to go after another wreck. Then there are the wonderful mods that border on being total-conversions, like X-Piratez and X-COM Files, where a single campaign *will* last for several years. Two years into a Piratez game, I feel guilty about letting Warehouse Wars missions despawn, but they feel like a chore just like the hypothetical medium scout full of floaters.

3 – The Android port of OpenXcom is wonderfully done, but a touchscreen is sometimes a pain in the ass. For some reason, it feels forgivable to me when I’m doing anything on the strategic level, but the tactical side leaves me frustrated at the lack of a mouse. If I could automate combat while on my tablet, I would.

If an auto-battle feature were to be created for OpenXcom, how would you want it to work? Would you want something fairly vague like the xcomutil version, or would you want the game to track every single movement and shot? A more abstract system might make it easier to work with mods in the mix, though the results might not reflect how difficult the mission would have been if it were played out manually. Would you want a status screen that shows the relative strengths of each side as the battle progresses, perhaps with simple buttons to influence it (something along the lines of Cautious, Standard, Aggressive, Retreat), or should it jump straight to the battle summary? Should it be made interruptible, so that the player can step back in if something goes horribly wrong (Much harder to implement. Where do you place all the units?)

I realize this falls outside the scope of OpenXcom, or even OXCE. The OXC mission statement was to faithfully recreate X-COM without the bugs and limitations imposed by hardware of the time. Adding an auto-battle feature means designing an entirely new system for which there's no canonical reference, so I want to get some input and feedback, and maybe even some semblance of consensus on what it should look like.

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile
Re: Auto-Battle
« Reply #1 on: May 31, 2020, 08:12:20 pm »
If an auto-battle feature were to be created for OpenXcom, how would you want it to work? Would you want something fairly vague like the xcomutil version, or would you want the game to track every single movement and shot? A more abstract system might make it easier to work with mods in the mix, though the results might not reflect how difficult the mission would have been if it were played out manually. Would you want a status screen that shows the relative strengths of each side as the battle progresses, perhaps with simple buttons to influence it (something along the lines of Cautious, Standard, Aggressive, Retreat), or should it jump straight to the battle summary? Should it be made interruptible, so that the player can step back in if something goes horribly wrong (Much harder to implement. Where do you place all the units?)



Actually, if the same AI that the enemies use could just be substituted in as the player, the difficulty of implementation would be similar(but in a different area) to balancing out an abstract points system.

Offline OmniscientQ

  • Sergeant
  • **
  • Posts: 14
    • View Profile
Re: Auto-Battle
« Reply #2 on: May 31, 2020, 11:24:45 pm »

Actually, if the same AI that the enemies use could just be substituted in as the player, the difficulty of implementation would be similar(but in a different area) to balancing out an abstract points system.

One of my biggest concerns was how to get an auto-battle feature to incorporate mods, and do justice to the intended balance of the mods. That's one of the best arguments I can find in favor of turning the X-COM units over to the same AI that runs the aliens, and just let it play out. Then the auto-battle would be running by exactly the same rules that the mod author already balanced towards. The AI would be dumb as hell, but that'd just be the trade-off the player accepts by using it. Would you want to be able to watch the battle play out? It'd be useful, if the player were allowed to interrupt and take control back. On the other hand, if you just want the battle to be done, being forced to watch half a dozen turns of "Hidden Movement" flash across your screen could get annoying fast. I do think I'd personally prefer that the game get to the battle summary as fast as possible once I hit the button.

I think I recall a post by Meridian stating that turning X-COM units over to the AI wasn't possible, but a quick forum search didn't find it. It may be the case that this isn't possible.

Offline vadracas

  • Colonel
  • ****
  • Posts: 285
  • Just another player/modder combo.
    • View Profile
Re: Auto-Battle
« Reply #3 on: June 01, 2020, 01:10:41 am »
Currently, you can't turn them over to the AI, all of these suggestions require changes to source code. By the way, no matter what you would see the long-hidden movement times if you turn the player over to the AI do to most of that being the AI figuring out LOS and what to do. The ability to interrupt would probably be pretty doable by using the right-click functionality that can already interrupt movement, but that's all that you would be able to interrupt.

The abstraction is a completely different matter.



By the way, I am certainly not asking ANYONE to do this unless they are very interested as this would be a challenging task.

Offline NancyGold

  • Colonel
  • ****
  • Posts: 186
    • View Profile
Re: Auto-Battle
« Reply #4 on: July 06, 2020, 08:01:00 pm »
It didn’t hand control of your troops off to the AI to finish the battle. Instead, it reduced the participants on both sides to a couple of abstracted numbers, and then rolled some dice.
Given that aliens always have numerical and firepower superiority, that wont ever work in a fair playground. So yeah, it has to make assumptions. Moreover, players always has a chance to retreat, taking away some stuff. For me it was always Chryssalid present = instant retreat.

Some people might be tempted to say that an auto-battle function is cheating, or it defeats the whole point of the game, but I have a few reasons for thinking that OpenXcom would benefit from having one. In no particular order:
Yeah. It makes a totally different game, similar to Civilization, or more precisely to Emperor of the Fading Suns, which had stack autocombat, with different type units getting different initiative (i.e. artilery goes before tanks).

The whole point of XCOM is tactical combat, while the strategic world map is here just to glue the tactical missions into a coherent story.

In my XCOM inspired game I do have autocombat, but it is used only for AI vs AI battles, since properly simulating battle scape would take some time and annoy human players.

Offline humbe

  • Colonel
  • ****
  • Posts: 135
    • View Profile
Re: Auto-Battle
« Reply #5 on: August 14, 2020, 02:37:34 pm »
It would be very nice to have. If someone feels it is cheating, then just don't use it. Someone might just want to test out playing just the strategic bits. Maybe testing out the game, learning what techs exist, or just because they prefer to, so why not? And some might find some missions tedious and want to finish a mission they've started or just want to automatically handle a mission that is easy at that point.

But it's not easy to implement (so I don't expect such a feature to come). In games that has an AI, in a player vs AI battle on equal terms, it is easy to use the AI engine to play for the player too.. But aliens and X-Com soldiers don't fight on equal terms, so leaving it up to the AI may require quite a bit of code, and would probably not work that well.. The game is kind of forgiving for a poor AI, as you don't want to lose half the battles because the AI is too smart and has a tactical advantage from the start.

Just evaluating some dice and rolling some dice sounds like a horrific implementation in my mind. A proper AI implementation that played like a not too overly dumb human would be preferrably, but probably too much work.

Something doable would be to automate camping strategies. But likely too situational for someone to bother implementing.. For instance it could work something like this:

 - Enable recording of camping auto-play.
 - Move the players you want to move.
 - Press auto-play, this will end your turn and start auto-mode, which may (possibly optionally?) hide what happens while in auto-mode to be able to speed it up.

- In alien turns your forces will of course just do reaction shots.
- In your own turn, if any of your soldiers see an alien, shoot at him, preferring to use soldiers the alien cannot see first (as in, use soldiers with line of sight that cannot spot the alien themselves)
- The soldiers you moved when recording, will try to do the same movement pattern each turn ending back up in the same spot (including facing). If they spot an alien, shoot at it, again preferring to use soldiers the alien doesn't see first.
- If the aliens kill any of your soldiers, or give them fatal damage, abort and let you take back control.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Auto-Battle
« Reply #6 on: August 14, 2020, 02:51:47 pm »
It would be very nice to have. If someone feels it is cheating, then just don't use it. Someone might just want to test out playing just the strategic bits. Maybe testing out the game, learning what techs exist, or just because they prefer to, so why not? And some might find some missions tedious and want to finish a mission they've started or just want to automatically handle a mission that is easy at that point.

If you want to cheat or to test strategic functionality, there are already cheats available to either kill or stun all enemies. Same applies if you feel a mission is tedious.

Offline Bonakva

  • Colonel
  • ****
  • Posts: 197
    • View Profile
Re: Auto-Battle
« Reply #7 on: January 09, 2021, 07:09:58 pm »
If you want to cheat or to test strategic functionality, there are already cheats available to either kill or stun all enemies. Same applies if you feel a mission is tedious.
These cheats are sterile. They do not allow pumping soldiers. In the mid / late game, missions to exterminate spiders, zombies, etc. cause laughter. My soldiers are 100% victorious in such battles. This is 100% pumping and getting medals. But this is a very long time and you have to cheat. The auto battle theme has been relevant for a very long time. Many people ask. Many people want it. It is foolish to answer every time that you need to use cheats.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Auto-Battle
« Reply #8 on: January 09, 2021, 07:43:50 pm »
These cheats are sterile. They do not allow pumping soldiers. In the mid / late game, missions to exterminate spiders, zombies, etc. cause laughter. My soldiers are 100% victorious in such battles. This is 100% pumping and getting medals. But this is a very long time and you have to cheat. The auto battle theme has been relevant for a very long time. Many people ask. Many people want it. It is foolish to answer every time that you need to use cheats.

I believe any such feature would be detrimental to the normal xcom gameplay.
And I won't implement features that I don't believe in.

If you're playing mods that send your supersoldiers to kill helpless cows, you are free to switch to different mods, that don't do that and give you a balanced challenge.

With all due respect, I don't see many people asking for it.
A dozen or so is not many. It's a few.

Lastly, OpenXcom is and will always be free and open.
Feel free to implement any feature you like and share it with others if you want... even in this very thread.

Offline Bonakva

  • Colonel
  • ****
  • Posts: 197
    • View Profile
Re: Auto-Battle
« Reply #9 on: January 11, 2021, 01:42:22 pm »
I believe any such feature would be detrimental to the normal xcom gameplay.
And I won't implement features that I don't believe in.

If you're playing mods that send your supersoldiers to kill helpless cows, you are free to switch to different mods, that don't do that and give you a balanced challenge.

With all due respect, I don't see many people asking for it.
A dozen or so is not many. It's a few.

Lastly, OpenXcom is and will always be free and open.
Feel free to implement any feature you like and share it with others if you want... even in this very thread.

Topics related to auto combat or similar mechanics have been floating around since 2011.
Many people do not write about this simply because they do not want to register, create a topic, and the like. I am one of those who registered on the forum only after five years of playing.
I think a lot of people would like this feature if it were the default. I am sure that such a function would make life easier for more than a dozen people.
It must be understood that depending on the mod, the duration of the game and the types of missions are greatly increased. If, conventionally, for vanilla such a function is not necessary, then for mods that take 5 times longer, such a setting is already relevant.

I understand your position. Anything that damages the gameplay in the trash.
If I could implement something like this I would do it and put it out for everyone. Unfortunately my knowledge of coding is not enough to create something like this. I just have to wait for a person who can realize it.

By the way, as far as I know, cheats work only when the debug mode is activated. Not every person will think of activating it. Not everyone will seek a solution to a problem.
What I mean is that the vast majority of people use only what is given by default. Many do not even know that files can be edited with notepad...
« Last Edit: January 11, 2021, 01:53:54 pm by Bonakva »

Online Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Auto-Battle
« Reply #10 on: January 11, 2021, 07:20:17 pm »
Quote
If I could implement something like this I would do it and put it out for everyone.
More import HOW. And not in sense of OXC code base but algorithm that should give you result.
What you will consider and what you will ignore? Consider that weapon hit can have arbitrarily result in OXCE, how you model it?
Do you consider possible maps that have checkpoints that have great impact on final results?
Or Chryssalid, how you model something like that? Even one have potential easy kill every one of xcom team.

Only think way to implement somting close to this is simply auto surrender for aliens if you are overpowered, and this already is partially implemented by Meridian.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Auto-Battle
« Reply #11 on: January 11, 2021, 09:37:15 pm »
Let's be honest... nobody would ever accept any auto-result, if they lost even a single soldier.

Everyone will ask for a feature that if auto-result loses even one soldier, they should get a chance to replay the whole battle manually.
(or even worse, they will bad-mouth me, that I am not capable of creating even a "simple" auto-result algorithm and that I have to "fix it" or else they come and kill my dog)

And we're back to an auto-win cheat button... no, thank you.
« Last Edit: January 11, 2021, 09:38:49 pm by Meridian »

Offline WaldoTheRanger

  • Colonel
  • ****
  • Posts: 112
    • View Profile
Re: Auto-Battle
« Reply #12 on: January 11, 2021, 10:27:11 pm »
Yankes makes a very good point about the surrender feature.

Maybe the solution to the issue as it applies to huge modpacks is for the pack makers to apply this feature more aggressively.

Like for example, if over half of the enemy is killed without them getting a single one of your soldiers, they surrender.
If they get bombarded by like, 5-10 blaster bombs in a row (proportional to how many enemies there are and the missions type) then they surrender
If over half of them are mind controlled, they surrender.

I don't know if those things are done already, but the point is they could be adjusted to reduce tedium even more.

It could also be an interesting tactical choice. Like if you're not well enough equipped to actually take on a snakeman supply ship, but you have like, 5 blasters, or 20 high ex that you can throw at the door, maybe you're able to intimidate them into giving up before they should have.

Offline WaldoTheRanger

  • Colonel
  • ****
  • Posts: 112
    • View Profile
Re: Auto-Battle
« Reply #13 on: January 11, 2021, 10:33:02 pm »
If it's not too hard to implement, there could also be a way to make the surrender function apply differently to different races, and at different x-com tech levels.

so for example, xcf cultists have different surrender conditions than a snakeman terror ship would, and they also change their surrender conditions once xcom has gotten promotion 3/4 or something.

That way you don't have cultist safehouses still trying to fight you once you can just blasterbomb the entire map all at once. once you're powerful enough they freak and run as soon as you leave the ship.

basically has the same result as an auto-resolve if all you're trying to do is remove the tedious mop up missions.
« Last Edit: January 11, 2021, 10:36:29 pm by WaldoTheRanger »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: Auto-Battle
« Reply #14 on: January 11, 2021, 10:42:23 pm »
basically has the same result as an auto-resolve if all you're trying to do is remove the tedious mop up missions.

Bonakva calls this sterile, because it doesn't give experience.

He doesn't want to remove the tedium, he wants to keep and automate the tedium, i.e. let the game play itself...