danbuis / ArmadaAIEngineNew

Revisit of an old project to create an AI for Star Wars Armada
1 stars 0 forks source link

Create logic for use of defense token #50

Open Sobonis01 opened 3 years ago

Sobonis01 commented 3 years ago

Requirements

How should the AI use Defense tokens How will it know that one is exhust,locked,or does not apply or will be of little benefit long term swaping tokens

Potential Solutions

Make a flow chart How do we want to have the AI make a decision on use of token Step 1 is the token equiped and in a useable state. Step 2 what are the damages amounts and will the token help ie we dont want to have the AI use brace on a 1 hit Step 3 How does the AI make the decision

I believe we should base it on the number of Shields total plus hull remaning. Meaning If 5 damage is done to a target lets say at CR90 8 shields in total and 4 hull, write it like this.
Damage > 75% of total hull and shields use brace.
With redirect it would be simpler it would be is redirect able to be used, if yes is damage greater than 1? if so move to nearest side.
Draw out a simple flow chart showing this for each token.

Potential Tasks

We need to draw up a basic flow chart showing for each token how and when it should be used. It should not be ship specific but for each token. As that way if we can get consistence behavior for each token we can save time by not having to write a new code for each ship.

It would be a yes/no answer that would have to occur when each ship is attacked.
we could improve on this as well. Just got to get it working.

Sobonis01 commented 3 years ago

contain.docx contain logic flow chart.

danbuis commented 3 years ago

Next time can you toss in an image rather than a full file. Downloading a file is a pain and github does a good job of displaying images.

That being said. Would it be worthwhile including a decision of ("Is the damage going to even go to the hull?"

Sobonis01 commented 3 years ago

contain

Sobonis01 commented 3 years ago

done and done!

Sobonis01 commented 3 years ago

Salvo salvo

boredompwndu commented 3 years ago

I don't know how exactly we will model attacks here. From looking through the code on the Fly Casual something that should have been relatively simple starts exploding in complexity quickly (95% of bugs I would catch in the X-wing sims surrounded performing attacks)

I would imagine when we reach the "Choose defense tokens to spend" step, each token should be able to answer for some of its attributes, such as:

Can this token be spent? Will spending this token result in it being discarded

We should probably also be able to measure the "Utility" of spending tokens in certain situations. If a token has 0 utility, it should not be spent.

Some easy measurements of utility in their own separate vacuum.

Evade - the damage removed from the pool - discarding a die- 2 for a double 1 for a single 0 for blank Rerolling a die - estimated as the difference between the current value on the die vs Brace - the damage removed from the pool, 5 brace to 3 = 2 utility, 1 brace to 1 = 1 utility Redirect - the largest amount of damage that can be sent to shield on other hull zones. if shot by xi7, the best you get is `1. If there are no shields, utility is 0 Scatter - the amount of damage cancelled Contain - If there is a crit effect that can be meaningfully negated by contain, utility is 1, else 0. Salvo - expected damage or something

I'm not entirely thinking about opportunity costs of spending this now vs holding for a different attack later. I'm mostly trying to find ways to measure if something is a "good enough" idea (A heuristic if you're nerdy enough)

Misc questions that pop into my mind as factors in spending tokens:

Will not spending this token kill me? How many more chanced will I get to spend this token? Am I holding this token for offense?

boredompwndu commented 3 years ago

Thought the next: I like the idea of the above flowcharts, but I don't think it handles multiple tokens well as it looks like we run through the flowcharts separately for each token. I'm mostly complaining that its inefficient and might accidentally lead to spending multiples of the same token. (Though I would love me some double braces) I think there's a generally accepted "Best" order to spend tokens, as it creates the most informed decision making

1 Scatter 2 Evade 3 Brace 4 Redirect 5 Contain 6 Salvo

For each, we most likely want to check if each token in the list exists and can be spent (Can we use it) and find the least punishing of the available tokens. (Do we have to discard it? Can we find one that doesn't have to be discarded?) I suspect we have different flowcharts for tokens we don't have to discard vs ones that we do (Unless its turn 6 or some token token is cursed to a life of 0 utility)