Development Discussion: Speeding up battle calculator (and thus Hard AI)
-
I'm not 100% sure what @redrum's opinion on this is, but I'd really like to see this as an experimental Ai in the game.
But for now hide it behind the test flag? -
Perhaps it could be added as a checkbox in the battle calculator for now as well?
Otherwise, I think the two things it needs is a heuristic for when it should be used (e.g. if too many units or when there are unsupported cases, it should do the usual battle calculator instead) and some kind of way to find cases where it disagrees with battle calculator. For example, maybe run some percentage of simulations using both and send error reports when the results disagree too much? Or perhaps we can have an experimental AI that always runs both so we can use it to validate it and find cases where it's incorrect?
-
An AI variant IMO would be an excellent step. The idea of computing the actual odds vs the current monte carlo approximation is a very good one.
The combat/battles code suffers from complexity and is already somewhat time-optimized. It would be very easy to underestimate the level of effort to replace the battle calc (simply having something that mostly works is just not quite enough, it would need to be cleanly coded, not be duplicative, well tested, complete, etc...)
-
@RoiEX I'm not aware of the test flag. How do I use it?
I can make a sibling of FastAI that uses this calculator. I also like the idea of having it automatically compare the actual odds vs the new odds. @Alexei-Svitkine when you say "send error reports", how would I do that? Is there existing classes in the code that I can just use to send the reports?
-
if(ClientSetting.showBetaFeatures.isSet()) { // add experimental feature } -
@LaFayette I tried using that in the PlayerType enum
BATTLE_TREE_AI("BattleTree (AI)", ClientSetting.showBetaFeatures.isSet()) { @Override public Player newPlayerWithName(final String name) { return new BattleTreeAi(name); } },But the player is still showing up in the list.
I also tried:
BATTLE_TREE_AI("BattleTree (AI)") { @Override public Player newPlayerWithName(final String name) { if (ClientSetting.showBetaFeatures.isSet()) { return new BattleTreeAi(name); } } }, -
@Trevan
Looks like @LaFayette trolled you a little bit there.
TryBATTLE_TREE_AI("BattleTree (AI)", ClientSetting.showBetaFeatures.getValue().orElse(false)) { @Override public Player newPlayerWithName(final String name) { return new BattleTreeAi(name); } },instead
-
@RoiEX That worked. I have to restart triplea for it to affect.
I tried to play a game in the UI since everything I've done has been through the test framework. But when I try to start a game, I get the error
Failed to start game IllegalArgumentExeption: File must exist at path: /.../game-headed/assets/unit_scroller/unit_sleep.pngI've checked and that file definitely doesn't exist. I've also checked out master and tried to run it in case my changes broke it but master also throws that same error.
Is there something I'm missing?
And should I create a PR now?
-
@Trevan are you using a specific IDE?
I think you have to run
./gradlew downloadAssetsbefore running the game in order to download all the default assets -
@RoiEX I'm using IntelliJ
-
And yes, you can create a PR whenever you like, it will take us a while to review it though
-
@Trevan If you're using intelliJ then it should automatically download the assets.
Try deleting theassetsand.assetsfolder and it should force a re-download -
@RoiEX It looks like IntelliJ is running that command but I ran it manually as well. I'm still getting that error. There are other files in
game-headed/assets/unit_scrollerso things have been downloaded. -
@RoiEX deleting the
assetsand.assetsfixed the issue. -
I've created a PR - https://github.com/triplea-game/triplea/pull/6501
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login