Showing posts with label AI. Show all posts
Showing posts with label AI. Show all posts

Sunday, 13 April 2025

v.0.8. is Released!

 New version 0.8 available here - add a comment if it cannot be downloaded.

See this article to know how to install it. Practically, just unzip and type in a command prompt: java -jar bloodbowl-0.8.jar. Should be easy 😀 !Java 20 is needed! Double-click on the JAr should also work.

If you want to use 'Bot Bowl' interface, see this blog article, but in Bot Bowl, this AI is slightly less good and some skills are not implemented or properly tested.

To summarize:

The main point of this release is fixing bugs. Do not hope to see a strong increase in the AI performance. Anyway, notice that now 'AI' can use the 'Bombardier' skill: it was the only skill from LRB6 rulebook that was not yet used by the AI.

Enjoy!

Final change log:

Version 0.8

===========


Requires Java 20.


Rules Implementation

--------------------

- It was not possible to use a re-roll on a 'kick back' when using the Chainsaw

skill;


Bug correction

--------------

- Were Team (Secret League): Werecat had armor of 8 instead of 7;

- The skill 'Strip Ball' should not work if the opponent has the skill 'Sure

Hand'.

It was not always the case;

- The skill 'Strip Ball' was not working when pushing the ball carrier out of the

pitch;

- When the user is failing an action (for example pick-up the ball), then

sometimes the turn ended immediately, without finishing totally the action -

like feeding for 'Blood Lust' skill for example. This creates also some bugs at

kick-off;

- It could happen that some status of players of the receiving team was not reset

at the last turn of a half, if the other team had just scored;

- Correct a bug where skill 'Leap' could be used although it was remaining only

0 move and one GFI available;

- Correct a rare bug when the ball is out of pitch at kick-off, then is given to

a player on which a rock is launched. The player was still holding the ball;

- Remove a memory leak that occurred after each AI game;

- If a player is prone and moved out of the pitch due to a Ball&Chain attack,

he was doing two Injury rolls;

- Correction with the Skill 'Disturbing Presence' that was wrongly taken into

account;

- The Interception ruler was not always correct;

- Armour modifier due to Chainsaw was not taken into account in a Foul action;

- When a ball carrier was moved out of the pitch, it was asked to the attacker

to follow or not after throwing back the ball into the game. It must be after;

- Skill Ball&Chain: the rule where the player knocked down or prone must roll

for injury was not applied;

- Skill Ball&Chain: the rule where "Stunned results for any Injury rolls for

the Ball&Chain player are always treated as KO’d" was not correctly applied;

- Players of the receiving team that were stunned during kickoff event

(pitch invasion, blitz, etc) were incorrectly put prone too early;

- Correct a bug that can occur after that a ball&chain player try to move a

Stand Firm player who selects to not move;

- Stunty skill was badly taken into account in the Injury Table;


AI improvements

---------------

- Improve setup at kicking where some strong players could previously remain

in the reserve area;

- Correction in the move selection of the ball carrier (due to this, AI games

could freeze during several seconds);

- AI vs AI game (without UI) takes in mean 20% less time;

- Chainsaw skill was not correctly taken into account when calculating

probabilities (to block/blitz/foul);

- Bombardier skill is now used by the AI;

- During Blitz kick-off event, reduce the risk taken just to go closer to

the ball;

- AI could use a bad path to blitz a player which requires to use all

the GFI - the probability was badly calculated;

- AI could (rarely) try to block with a Ball&Chain player - although only

a Move action is allowed. The action was then lost;


UI improvements

---------------

- It is not longer possible to move a KO's player on the pitch during setup;

- Correction in the display of the mouse icon which was not always correct;

- Some Animated Threads (for .gif) were not correctly terminated after a game;

- It is now possible to get result of activation Roll without moving (for

example Bone Head, Really Stupid or Blood Lust) even for PASS, FOUL and

HANDOFF action. Until now, it was only possible for MOVE or BLITZ action;

- If Pass button was activated, it was possible to right click on a unreachable

teammate. The pass was not executed, but the ball carrier ended his turn.

Now a simple message indicates the pass is not possible. Furthermore the

'interception' squares were wrongly highlighted (in case of Blizzard

for example);

- When the user wanted to move a player on a neighbour square: the less

risky move was always suggested, but it was not always the shortest.

Now this is the shortest, which will allow the user to move the player as

he wants. For non neighbour squares, the behavior remains the same;

- If a bomb was thrown out of the pith, the icon of the bomb was still

visible;

- Path suggestion to blitz a player which requires to use all the GFI wa

not correct;

- Minor animation correction when skill 'Leap' is used;

- In the Team editor, the skills gained by a player appears now in green;

- Sometimes, the 'kick' notification when using the skill Kick was not

shown on the right player;

Wednesday, 7 February 2024

v.0.7 is Released!

New version 0.7 available here - add a comment if it cannot be downloaded.

See this article to know how to install it. Practically, just unzip and type in a command prompt: java -jar bloodbowl-0.7.jar. Should be easy 😀 !Java 20 is needed! 

If you want to use 'Bot Bowl' interface, see this blog article, but in Bot Bowl, this AI is slightly less good and some skills are not implemented or properly tested.

To summarize:

The two main points of this release are:

- Focus on the AI;

- Add new teams (14) from the Secret League (https://fumbbl.com/help:SecretLeague)

Although the AI has been improved, it remains a lots of possible improvements and you will still see some stupid moves. However I have added a lots of tests and developed some debug tools that allow me to easily introduce new tests. Practically, this means we should get less regressions in the AI in the future. I mean, when adding a new AI behavior, you do not always realized that this new behavior introduces a weakness in a different position. With all the tests added in this release, we should have less regression in the future!

The UI for the tournament creation is still ugly - maybe one day it will be improved 💪

Last remark: the AI is a bit slower - an AI vs AI match takes now about 11 seconds without UI activated. This is far too long, but this is not really a problem.

Enjoy!

Final change log:

Version 0.7
===========

Requires now Java 20.

Rules Implementation
--------------------------
- It is now possible to re-roll a 'Ball and Chain' move;

Bug correction
------------------
- Game could freeze with skill 'Ball and Chain';
- Correct regression with skill 'Ball and Chain' where player stopped to move after one block;
- Correction where it was possible for player with 'Leap' to use the skill during 'Quick Snap';
- In some cases, it was possible to use 'Leap' with only one remaining 'Going For It';
- Correct an issue in UI if you use Ctrl + right click to move a player (it was a hidden functionality not working correctly). This has been disabled;
- It was not possible to start a drive if the remaining number of players was lower than 3;

AI improvements
---------------------
- Correction in blocking probability when attacker has skill 'Wrestle' or 'Pro';
- Minor improvements related to dice selection (or reroll choice) when blocking a player that can be pushed out of the pitch;
- When the bank is full (200 000 Gold), now AI uses remaining gold in treasury to buy inducements before each match;
- AI will block/blitz more frequently;
- Small change where blitz was never used if the player was already next the opposite player (this has an impact for 'Horns' for example);
- Blitz is now more often used by 'prone' player;
- Minor change of behavior when the ball is in the air;
- Improvements in the choice of the AI to select the player to assist, and the square to go;
- Improvements when moving the catcher;
- Correct regression where AI was not anymore trying to bother catcher that could potentially score a Touchdown;
- Better take into account skills 'Side Step' and 'Stand Firm' to be less 'afraid' of squares next border;
- Minor changes in selection of square when pushing an opposite player;
- Better move done by prone players;
- Better move to defend ball carrier;
- Correct regression related to skill 'Throw TeamMate' - it was almost never used;
- Do not try to improve assist of an attacker who has 'Chainsaw' skill - because it will not change the probability;
- AI wanted to always move the ball carrier of at least one square before to hand-off the ball. Now it can directly hand-off without moving it is the best action;
- Better move chosen by the ball carrier;
- Hypnotize first players that have a tackling zone;
- Improve choice to follow or not after a push;

UI improvements
---------------------
- It is not possible anymore to click on 'Cancel' when upgrading a player (previously we could re-roll dices until we like the result);
- Some text could be badly displayed depending on the Java version used - like the Team's name on the pitch;
- Do not show inducements dialog before match if not enough money to buy the cheapest one;
- Team Ranking: column 'Points' moved to the last column;
- When the user click on a square, if he doesn't release the button on the same square -> no action is executed. This avoids some potential bugs;

Miscellaneous
-----------------
- Add some 'Secret League Team' from https://fumbbl.com/help:SecretLeague:
    * Araby Team
    * Bretonnian Team
    * Estalia Team
    * Ethereal Team
    * Forest Halflings
    * Giant Team
    * Gnome Team
    * Kingdom of Ind
    * Kislev Team
    * Nippon Team
    * Northern Nippon Team
    * Pirates of Sartosa
    * Treemen Team
    * Were Team


Thursday, 13 July 2023

v.0.6 is Released!

New version 0.6 available here - add comment if cannot be downloaded.

See this article to know how to install it. Practically, just unzip and type in a command prompt: java -jar bloodbowl-0.6.jar. Should be easy 😀

If you want to use 'Bot Bowl' interface, see this blog article, but in Bot Bowl, this AI is slightly less good and some skills are not implemented or properly tested.

To summarize:

Very very few changes compared to 0.5. This release is done mainly for BotBowl competition. It was mandatory to correct a crash in version 0.5.

In 0.5 there was also a very annoying rare crash that freezes the game - hard to reproduce. Maybe the bug is corrected. If not, new debug information should help to find the issue.

Final change log:

Version 0.6

This version is very similar to 0.5 but is released to participate to BotBowl V.

Bug correction

- In previous version, there is a very blocking bug where UI can freeze. This version contains small modifications to try to solve it and to add debug information if the bug still occurs;

- A re-roll done during a block always counted for 2 re-roll;

- Sometimes after a match, clicking on 'End Turn' to exit the game was not working. This was blocking the game;

AI improvements - specific to 'Bot Bowl'

- There was a regression in the previous version (0.5) that leads to a crash when AI has to select a square to push;

Sunday, 27 November 2022

v.0.5 is Released!

New version 0.5 available here - add comment if cannot be downloaded.

See this article to know how to install it. Practically, just unzip and type in a command prompt: java -jar bloodbowl-0.5.jar. Should be easy 😀

If you want to use 'Bot Bowl' interface, see this blog article, but in Bot Bowl, this AI is slightly less good and some skills are not implemented or properly tested.

To summarize:

Some cool stuffs like implementation of latest skill of LRB6 (all skills are implemented now!), blood on the pitch, different pitches, inducements before match can be used also for user team (Wizard and so on), small animations (when gaining XP, etc)... But main task was bug fixing for this release - like turn marker that was moved at the end of the turn and not at the beginning.

This version should be more stable than v.0.4, although I know it contains some bugs I still do not have resolved. But to my knowledge, no big issue... UI to create/manage tournament is still poor, but my time is limited! 😛

Final change log:

Version 0.5

Still requires Java 11.

Rules Implementation

- 'Juggernaut' skill: during blitz action when 'both down' is selected, we can now use the skill to select 'pushed' instead;

- Add skill 'Leap';

Bug correction

- Player that should miss one game was missing 2 games (and in second game, it was counted as a member of the team -> we could start with less than 11 players)

- It was not possible to reroll a failed 'Wild Animal' roll;

- During pushing sequence (after block), ball sometimes bounces before the end of the sequence. Now this is done only after all pushing moves;

- It is no longer possible to use team reroll when catching ball at kick-off;

- Player with skill 'Decay' could keep status 'Badly Hurt' during several matches, leading to some issues;

- Injured Star Player was not always removed from SI area after a game;

- If ball was caught by a player in Touchdown area, touchdown was not counted;

- A player was able to use skill 'Sure Feet' more than once per turn;

- Rare crash when a player with 'DumpOff' has the ball and is blocked by a player with 'Multiple Block';

- During 'Touchback' at kick-off, AI was able to select only player not in tackle area to get the ball. If none available, ball was not anymore on the pitch;

- Turn marker move is now done at the beginning of the turn after kick-off (and not at the end);

- Skill 'Tackle' for stand up player was effective even if the player had lost his tackle zone (being hypnotized for example);

- 'Dauntless' skill was used also for defender although it should be only for the player who blocks (attacker);

- When AI was buying a Wandering Apothecary (inducement), an Igor was bought instead;

- Frenzy skill was not used for 'Pushed' result on a defender who is using 'Stand Firm' skill;

- It was possible to move (during block action) a player with 'taken root' activated;

- The attacker player was earning Star Player point if the defender was stunned and also if the defender was thrown out of pitch;

AI improvements

- Better use of 'Juggernaut' skill;

- Miscellaneous improvements of Vampire team - mainly when 'Blood Lust' failed;

- Corrections in path finding algorithm - in some cases some squares were not correctly evaluated;

- Skill 'Leap' is taken into account in each move probability;

- Minor Skill selection changes when upgrading a player;

- Minor changes in Team management after game;

- Minor changes in behavior during a game;

AI improvements - specific to 'Bot Bowl'

- Now AI never uses 'Apothecary' when player is simply KNOCKED_OUT (apothecary is kept for later);

UI improvements

- Ensure we cannot move player in bad area during set-up;

- When creating new tournament and loading existing teams, now 'Human' coach is correctly retrieved (previously it was always AI selected);

- Now we can load teams coming from 2 different saved tournament if they have the same name - when creating the team, we generate a unique id. This will not work for tournament saved before v.0.5. We can also rename a loaded team (useful when 2 teams of different saved tournament have same name);

- Add possibility to change pitch background;

- In Team editor, Team Value was not directly updated when a player was upgraded;

- In Team editor, some values (like Reroll, treasury, etc) were sometimes incorrect, mainly after switching from one team to another one;

- Information dialog is now displayed to give more information about kick off event;

- Indicate Team Name on each side of the pitch;

- Add blood on the pitch when a player is KO, Badly Hurt, Seriously Injured or Dead;

- Add simple animation when a player gains experience or/and score touchdown;

- Reduce CPU used by UI when a player is selected;

- Correct display of dice roll for 'Shadowing' in the Information window (one modifier due to Movement value was not correct);

- Inducements can now be bought by user in the pre-match sequence (consequently Wizard can be now used by the user);

- It is no longer possible to create, load save a tournament when a game is running;

- Small improvement of UI when creating new tournament - now you can easily delete some teams loaded from previous tournament;

- Background picture added when creating new tournament;

Miscellaneous

- A game win brings now 3 points (instead of 2);

Wednesday, 7 September 2022

v.0.5-dev - Skill 'Leap' is implemented

Yeahhhhh!  Last skill that was not yet implemented, 'Leap' has been developed! In the list of actions available, there is now the 'Leap' button:


This is not an 'action' like Pass or Blitz, but it was convenient to put the button there.

The button is available only if a player with skill 'Leap' is selected, if he has not yet used it this turn and if it remains at least 2 moves. Then you see the possible leap location (in magenta):

A right click on the square and the leap is done (at the cost of 2 moves)!

Another way to use the skill (the simplest one!) is just to let the path finding algorithm find when leap is needed. Example:

If your mouse is on the square '67' (67 is in reality the probability to reach this square, and yes print screen is removing the mouse icon 👎), you see as usual the yellow path and in magenta the leap destination. So the 'Slann' player will move two squares, then leap then move again if leap was successful! Notice algorithm doesn't suggest to do 2 dodges instead of the leap, because the probability of success is lower. If probability of dodge is equal to the probability of leap, then dodge is selected - because it's interesting to keep the leap for later!

Examples:

If selected player wants to go one square right, leap is suggested (to avoid to dodge in a square where 2 opposites players have a tackle area)

However, on the upper square, it is better to dodge (square is yellow = classical move and here with dodge)!

In this last example, dodge is done although leap has the same probability (because player has skill 'Very Long Legs'). But if user really wants to leap, he still can do it - by pressing the 'Leap' button.

And what about the AI? This is cool: as the path finding algorithm is already used by the AI for each move, nothing has to be done! For every action AI will take 'Leap' possibility into account: for moving, for moving then pass, for moving then foul, for blitz and so on!

This implementation and many other fixes will be available in v0.5. - coming soo... euh no, not any idea of when it will be available, I still have some tasks to finish 💀!

Current last version is still this one.














Thursday, 25 August 2022

Drefsante_AI_v.0.4 won 'BotBowl IV' Competition!

Let's celebrate the title! 💪

Bot Bowl IV is the fourth AI competition in Blood Bowl and happened (virtually) at the IEEE Conference of Games 2022 - see this link for more information.

Here is the final ranking:

And a video about the result: here!

Don't have yet time to look in details at the results. And let's be honest, number of playing games during the competition is wayyyyy to low to be significant enough to see which AI/Bot is the better, but anyway the win for this year is for Drefsante_AI!

Only 'Human' team versus 'Human' team games. A competition with all teams would be better for my AI as it's taking all skills into account which is probably not the case of other bots. Except 'Leap'  which has been implemented only in v.0.5 - article about this will come soon.

Thanks to Niels Justesen for the tournament and to all those that have implemented the 'Bot Bowl' interface which is quite nice.

Last available version of Dresante_AI is still the v.0.4 - see this article. 

Sunday, 3 July 2022

v.0.4 is Released!

New version 0.4 available here - add comment if cannot be downloaded.

See this article to know how to install it. Practically, just unzip and type in a command prompt: java -jar bloodbowl-0.4.jar. Should be easy 😀

! Only bloodbowl-0.4.jar file is needed, all other files are used only for 'Bot Bowl' interface - see below.

To summarize: to be honest, I didn't work a lot on this project this year, and most of differences with 0.3 have been implemented end of last year and are mainly bug corrections. Notice that Skill 'Throw Team-Mate' (and all related skills) has been implemented (see details). Skill 'Bombardier' is also implemented - but AI will not yet used it. But if you throw bomb on an AI he will perfectly deal it. See this video:


Rules are still LRB6 rules, and only missing skill is 'Leap'!

Version contains also some fine UI improvements - like lots of tool tips about rules have been added.

And last minute dev (which means with lots of bugs and badly tested 😋), when creating a new tournament you can now load some (or all) teams of a previous tournament:

- Select old tournament you have saved;

- Click on Load Teams. This will add new teams and you can remove some of them, and eventually change coach (from AI to Human for example):

To those teams, you can still add new random team(s) or team of your choice. This will allow you to create different leagues, divisions, promoting teams to higher division, etc! Just save each tournament with meaningful name.

'Bot Bowl' AI is also available

A python interface has been developed to be able to use Drefsante_AI in Bot Bowl: see this project to know more about 'Bot Bowl'.

You simply need bloodbowl-0.4.jar and the python files drefsante_bot.py and drefsante_bot.cfg.

JAVA jdk-11 must be installed on the machine and system PATH must contain full path to:

- [...]/jdk/bin

- [...]/jdk/bin/server

Configuration file 'drefsante_bot.cfg' must be edited with parameters:

temporaryFolder = path to an existing folder where files can be created/deleted

jarPathName = path to the .jar file

See njustesen project to know how to use a bot. Practically you will have to import drefsante_bot, and name of the bot is 'Drefsante_AI_v.0.4'.

This version will participate to the Bot Bowl IV competition! Notice this version is much slower and all skills are not yet working.

Print screen of 'drefsante_ai' about to score against 'scripted' version of Bot Bowl - although team has been seriously injured!

Final change log:

Version 0.4

Still requires Java 11.

Rules Implementation

- Add skill 'Throw Team-Mate';

- Add skill 'Right Stuff';

- Add skill 'Always Hungry';

- Add skill 'Bombardier';

Bug correction

- Correct bug at kick-off where it was possible to give ball to a player with No-Hands skill if ball went out of pitch;

- Correct bad implementation of 'Really Stupid' skill;

- Correct bug for 'PassBlock' when used by AI;

- Bug where AI can have more than 16 players and didn't fire any player;

- Can happen that after failed blood lust, it is not asked to select a victim to bite - for example after block against player with 'Foul Appearance' skill;

- Was not possible to use 'Bribe' coming from 'Get the Ref' kick-off table;

- Bug when more than 16 players in one team (due to Necromancer who uses 'Raise the Dead');

- One bounce was missing when launching ball on an empty square (if pass was accurate);

- If a player was 'stunned' and suffered a 'knock-down' result (foul action for example), 'stunned' status was lost;

- Correct a bad error message if a collapsed player was set on pitch at kick-off;

- We can now use several bribes (if we have several) successively if first attempt(s) is (are) failing;

- 'Follow' Move is now done before setting defender knock down;

- When an injury was removed (apothecary or regeneration), player was still missing next match;

- Correct rare crash when ball&chain player on the pitch;

- Was not possible to rise up player with root activated;

- Take root roll could be done although player had root activated;

- Injured player with 'Secret Weapon' was not missing next game and injury was never removed;

- For Injury roll > 51, there were some errors in the injury obtained;

- Regeneration after Decay was not always healing both injuries;

- It was possible to use Igor on 'Star player';

- Players of the receiving team that were stunned during kickoff event (pitch invasion, blitz, etc) were not switched to prone with move done

 (so these players were missing 2 turns instead of one);

- Now if a player wants to stand up with MA lower than 3, a roll of 4 is needed;

- During Blizzard it was possible to do pass longer than SHORT;

AI improvements

- AI can use all new skills implemented in the version, except 'Bombardier' he will not yet used. But if he receives a bomb, he will throw it;

- Minor changes in skill selection;

- Improvements in move of player that will assist a block/blitz;

- Add new possible starting roster for 'Chaos', 'Chaos Dwarf', 'Elf', 'Goblin', 'Halfling', 'High Elf', 'Human', 'Khemri', 'Lizardman', 'Necromantic', 'Norse', 'Nurgle', 'Ogre', 'Orc', 'Skaven', 'Undead', 'Vampire', 'Wood Elf';

- Ball carrier was sometimes going back too fast if he cannot score before end of game (not good because it makes pass/hand-off in order to score more difficult);

- AI was still sometimes moving on a ball when not explicitly wished;

- Correct big error in probability to move where number of tackles at destination was not taken into account;

UI improvements

- Some checks are done before to create new tournament (like no team with same name, etc);

- Nothing was visible in the interface if a player uses 'DivingTackle';

- Apothecary icon is now not visible if he has been used during game;

- New information is available for each team (Team Value, FAME, inducements, etc.);

- Team logo is visible only if team can re-roll this turn;

- Add lots of tool tips (notably for skills);

- In player information window, skill is strikethrough if skill cannot be used anymore for the player;

- Status 'Collapsed From Heat' is now visible in the player information panel;

- Ball&chain: after first move, blue block dices were not visible;

- Icon visible when a player is victim of 'Foul Action';

- 'Move' value of a player with 'root' activated is now equal to 0 (so we see ;

- When creating new tournament, it is now possible to load teams from previous saved tournaments;

- Correct some problems when renaming a team;

- Pass issue: problem of display of players that can intercept;

Wednesday, 10 November 2021

v.0.4-dev - 'Throw Team-Mate' Implementation

 In v.0.4, Skill 'Throw Team-Mate' (and 'Right Stuff' and 'Always Hungry') has been implemented.

User Interface Implementation

This section explains how user can use the skill - for other existing rules see first release article.

1) Select (left click) the player with 'Throw Team-Mate' and click on the 'Pass' button

As usual, safe moving squares are displayed in green and risky in red.

2) Then move player next a player with 'Right Stuff' skill (right click on square to move).


Eligible players to be thrown are highlighted in blue - you still can move if you do not want to throw one of these players.

3) Select player to throw (left click).

Then you see all squares where players can be thrown:


4) Select square to throw (right click) and hope for the best! 🙏

Which is unlikely to happen 😁

AI Implementation

AI will use the skill for 2 different reasons:
- avoid opposite player to score - defensive use;
- try to score - offensive use.

Defensive use

Context: next team is about to score. No wizard remains, and there is no available player to blitz the ball carrier. Only way to stop ball carrier is to throw team-mate! Best would be to fall on him, but if thrown player can be moved to simply force a block/blitz or dodge, it's better than nothing!

How the AI uses skill in this case?

- It checks if opposite player can score in one turn without 'going for it';
- If yes different probabilities are calculated:

1) For each possible thrower (player with 'Throw Team-Mate), it checks if he can throw a 'right stuff' player next him on the ball carrier. If yes, we record the probability of success - PthrowPlayer.

We take into account:

- probability to activate player - PActivation (for 'Bone-Head' skill for example);
- probability to success 'Always Hungry' Roll (if relevant) - PAlwayshungry;
- probability to not fumble player - PFumble (tackle zones are taken into account);

Here we do not take into account probability of success landing - but it will be done in Offensive Use section. So probability to throw player is (for each pair Thrower/thrown player):

PThrow = PActivation * PAlwaysHungry * PFumble


2) Same calculation but taking into account that 'thrower' can move before to throw team-mate - all possible move probabilities are already known/calculated by the AI. We check all neighbor squares of thrower as it can impact probability (probability to move there and probability to throw player) due to possible tackling zones;

P = PMoveThrower * PThrow 

Best probability between 1) and 2) is selected - to be precise, best probability of all the possible combinations.

Notice that between 2 equal probabilities, the priority is to throw a player that has not yet moved: if landing is successful he will be able to bother ball carrier.

3) If previous points are not possible (because 'right stuff' player is too far from ball carrier), same calculation is done but taking into account that 'right stuff' player will first move - to enter into a square where he can be thrown on ball carrier. Final probability is then: 

P = PMoveThrown *  PMoveThrower * PThrow 

The thrown player will not be able to move after landing, so chances of success are low 😋

In the context of a League/Tournament, AI should not use this skill for defensive skill. Because potential gain (avoiding to receive a touchdown) probability is too low in comparison of probably to get a player injuried/dead!
Nevertheless because it's funny when it works, AI will use the skill for defensive skill  😁

Offensive use

This is the most useful use of the skill, but let's be honest: it rarely changes the result of a game! 
Actually, before each movement, AI calculates probability to score when he has the ball. It can be done:

- with a simple move;
- with a hand-off move then a move;
- with a pass move then a move;
- with a hand-off move then a pass move then a move;
- with a pass move then a hand-off move then a move;

All these probabilities were already calculated before this implementation. They take into account all possible player skills (dodge, pass, tackle, sure feet, sprint, hail mary pass, etc), and all possible combinations to keep at the end the highest one.

With this throw Team-mate skill, new probabilities have to be assessed:

- throw ball carrier (if he has not yet moved) then move ball carrier;
- move thrower then throw ball carrier player then move ball carrier;
- hand-off the ball to a player then throw him (with, again, eventually a move of the thrower), then move ball carrier;

Probability to throw a ball carrier that has already moved is not calculated - this has really too low change of success.

Practically, the attempt to score a touch down is done only if value is higher than a fixed value, or if it's the last turn of the half. From a probability point of view, we can see that throw team-mate will be used only if there is no other solution...

To score a touch down, this time it is necessary to assess probability to land and then probably to reach the TD, which is not guaranteed with the 3 'bounces'!
Probability to land 'on feet' (PLand) is not very precise as we are not sure of how many tackle zones we will have - well we can calculate the exact probability, but this is not needed and it has not been calculated.
What is important is to know if it will land (after bounces) 3 squares closer to the touch down, 2, 1, at same row as destination chosen by thrower, 1 square further, 2 or 3. It's important because player can land to a square where he's too far to touch down. Also to know if he will need to use 1, 2 or eventually 3 'going for it'. This probability to reach TD can be calculated as followed:

PMoveToTd = P+3 * PmoveToTd+3 + P+2 * PmoveToTd+2 + P+1 * PmoveToTd+1 + P0 * PmoveToTd + P-1 * PmoveToTd-1 + P-2 * PmoveToTd-2 + P-3 * PmoveToTd-3 

where:

- P3 is the probability that the ball bounces at the end on a square (pitch column) which is 3 squares closest to TD that initial destination;
- PmoveToTd+3 is the probability that if a player starts at this column, he will reach the TD. This takes into account player move value and number of 'going for it' needed (and skills like 'Sprint', 'Sure Feet', etc.), but we do suppose we will have no dodge. It's too complicated to assess the right probability, and this is not necessary. Notice this probability can be null.
- etc for other P;

Notice for 'Offensive Use' destination chosen is always far enough of the border - thrown player will never goes out of pitch. At equal probability, AI chooses also a destination where number of opposite players is low.

In the most complex case where player hand-off the ball to a player that will be thrown (with also a move of the thrower!), the probability to score is then: 

PTD = PHandOffMove * PMoveThrown *  PMoveThrower * PActivation * PAlwaysHungry * PFumble * ( P+3 * PmoveToTd+3 + P+2 * PmoveToTd+2 + P+1 * PmoveToTd+1 + P0 * PmoveToTd + P-1 * PmoveToTd-1 + P-2 * PmoveToTd-2 + P-3 * PmoveToTd-3 )

Quite simple, isn't it??? 😛

Let's watch small video where AI uses the skill!

Notice also that setup is modified for receiving Team if it's the last turn and if there are players to use the skill. If ball goes out of the pitch and must be given to a player, it will also be given to the 'good' player - player with 'Right Stuff' next a player with 'Throw Team-Mate'. This is visible in Part 3 of the video - ball has bounced out of pitch and ball has been given to the right player.



Sunday, 31 October 2021

v0.3 is Released!

New version 0.3 available here - add comment if cannot be downloaded.

To summarize: bug corrections + added some missing skills. At UI level, 'gif' are now working and lots of players have new icons when they gain one level! Ogre example:



(Reminder: I'm not author of all these icons, most are coming from other projects like SkiJunkie, AIBowl or Fumbll - to be honest I do not remember what is coming from where, I have downloaded them a loooong time ago)
Previous save should still be compatible. See change log below for the full list of changes.
In the 'not yet implement' side, are still missing:

- Skill 'Bombardier';

- Skill 'Throw Team-Mate' (and all related skills);

- Skill 'Leap';

Also it's is still not yet possible to select inducements before a game - but AI can, and can now use Wizard! UI for tournament/team creation has unfortunately not yet been improved.

Rules are still LRB6 rules - yes I'm some years in late 😀

Next release will (I hope) contain all the rules. After that this will highly increase time available for developing the AI itself, which has still a too low level in my opinion. Idea is also to be able to create some leagues with divisions instead of simple tournament.

A FFAI version (see https://github.com/njustesen/ffai) exists but is not yet enough tested and consequently is not released. You can see a video of v.0.3 versus v.0.2 using FFAI framework:

Some behaviors are strange and probably due to bug when interfacing Drefsante AI and FFAI - see for example last turn of red team at first half where player starts a Pass action (in order to score), picks-up the ball... and then does not do the pass! On the other hand some new AI features are visible (like Ball carrier can now stay several turns next Touchdown area without scoring if not threatened and if team is not loosing). But some strange player moves are also visible, it remains tough work! 💪
Just for fun, 100 matches have been played between 2 last releases (Human vs Human) with a result of 40 Wins (for new release), 26 Draws and 34 Losses. 100 is not significant, but trend is that AI level has not been increased a lot in this release. In comparison my last 20 games against Drefsante AI v.0.3: 20 Wins and 2 goals received 😕
Still some work needed before reaching human level !
Notice result versus FFAI scripted bot is good on last 100 matches (Human vs Human): 89 Wins, 9 Draws, 2 Loses.

Final change log:

Version 0.3

Requires now Java 11.

Rules Implementation

- Add skill 'Kick';

- Add skill 'Piling On';

- Add skill 'Hail Mary Pass';

- Add skill 'Blood Lust';

- Add skill 'Diving Catch';

- Add skill 'Kick-Off Return';

- Add skill 'Animosity';

- Add skill 'Multiple Block';

- Add skill 'Dump-Off';

- Add skill 'Pass Block';

- Add Wizard (for AI only);

Bug correction

- 'Diving Catch' skill was sometimes used as if it was skill 'Diving Tackle';

- Was not possible to correctly use 'Hypnotic gaz';

- Correct bug where ball can bounce too many times;

- Correct bug where failed block against player with skill 'Block' was not ending the team's turn;

- Correct bug where not relevant player (prone, bone-head, etc) could catch the ball from accurate pass;

- Correct bug where Stunned player (after pitch invasion) can keep the ball;

- Correct bug to avoid that player picks up the ball if ball is in the air (at quick snap of blitz event for example);

- Correct bug at kick-off if player selected to get the ball (if ball goes out of pitch) is stunned ('Pitch invasion') or Ko ('throw rock'): the ball was disappeared;

- Correct bug where kick-off set-up and kicking events were played twice at the start of second half if previous turn  ended with a Touchdown;

- Skill 'Pro' was not correctly implemented;

- With 'Jump up' skill it was possible to block while stunned. Now it's only possible if knock down;

- Was not possible to use re-roll when failing Jump Up on block;

AI improvements

- Avoid not needed catcher move;

- Improve move to bother ball carrier;

- Improve 'follow' behavior;

- Correction in pass probabilities - fumbble was not taken into account;

- Correction in pass probabilities: probability of moving of the thrower was not correctly taken into account;

- Correction in HandOff probability;

- Improve global defensive position;

- Improve Block/Blitz behavior;

- Correct bug where AI wanted to always move before to pass ball;

- Now AI is not moving on a ball if not explicitly wished;

- Better estimation of remaining turns needed for a player to move to touch down area;

- Tune selection of skill after a game;

- If AI is last to play during a half and cannot score, he will do the easiest pass in order to gain experience;

- When available, 'Pro' skill was always used when doing a block, whatever dice result;

- Better take into account 'Tackle' skill;

- Ball carrier can now stay several turns next Touchdown area without scoring if not threatened and if team is not loosing;

UI improvements

- When selecting ball position at kick-off: scatter directions are now visible;

- Correct loading of 'gif' that were not animated;

- Automatic path selected when moving can now never go on the ball square;

- Some players have now a new icon when they gain one level;

- It is now possible to get result of activation Roll without moving (for example Bone Head, Really Stupid or Blood Lust):

  Eventually select your action (it will be considered as Move action if none is selected) and then right click on the player. Activation  result will be visible. It's important because result can impact your planned move (mainly for blood lust). If you right click again on same player, his move is finished. For player without these kills, right click on him end player's action;

- Do not display apothecary icon if team has none apothecary;


Wednesday, 15 September 2021

V0.3-dev Current state of the version

 V0.3-dev Current state of the version

Next version will be 0.3 (one digit has been removed in version number). Below is the status of the change log. Still some improvements are expected before the release. In parallel a proxy version has been developed for FFAI.

Version 0.3
===========
Requires now Java 11.

Rules Implementation
--------------------
- Add skill 'Kick';
- Add skill 'Piling On';
- Add skill 'Hail Mary Pass';
- Add skill 'Blood Lust';
- Add skill 'Diving Catch';
- Add skill 'Kick-Off Return';

Bug correction
--------------
- 'Diving Catch' skill was sometimes used as if it was skill 'Diving Tackle';
- Was not possible to correctly use 'Hypnotic gaz';
- Correct bug where ball can bounce too many times;
- Correct bug where failed block against player with skill 'Block' was not ending the team's turn;

AI improvements
---------------
- Avoid not needed catcher move;
- Improve move to bother ball carrier;
- Improve 'follow' behavior;
- Correction in pass probabilities - fumbble was not taken into account;
- Correction in pass probabilities: probability of moving of the thrower was not correctly taken into account;
- Correction in HandOff probability;
- Improve global defensive position;
- Improve Block/Blitz behavior;
- Correct bug where AI wanted to always move before to pass ball;
- Now AI is not moving on a ball if not explicitly wished;
- Better estimation of remaining turns needed for a player to move to touch down area;
- Tune selection of skill after a game;

UI improvements
---------------
- When selecting ball position at kick-off: scatter directions are now visible;
- Correct loading of 'gif' that were not animated;
- Automatic path selected when moving can now never go on the ball square;

Saturday, 7 August 2021

Blood Bowl AI - First Release

 Blood Bowl AI - First Release

Here it is, a new Blood Bowl AI implementation (using Blood Bowl Living Rulebook 6.0): BloodBowl_0_0_2.jar.

Requires Java 1.8.
Tested only on Windows.

Small tutorial

Download .jar file and type in a command prompt: java -jar bloodbowl-0.0.2.jar.
Click on File → New to create a new Tournament.

You get following options:

Number of Rounds: indicate number of times each team plays against same team.
Number of Human Teams (random): number of user team, race will be selected randomly.
Number of AI (random): number of AI teams, race selected randomly.
Create All: create the 24 available teams (controlled by AI). It is added to the other team created by the other options. Probably not a good idea to create a tournament with so many teams.
Add Team: each click on the button will add a new line where you can fully control the team creation - select if team is controlled by AI or Human, select race and team name. Ensure each team name is unique, there is no check for that.

Total number of teams in the tournament will be the sum of each option selected. Avoid to have a odd number: in this case some games with teams with not same number of played games can occur.

Click on 'Ok' to create the tournament.

As you can see interface is very simple and minimum time has been spent on it :-)


You can see the current team ranking, the schedule of the tournament, what will be the next game and results of already played games.

Team in bold are controlled by Human. Others by AI. 

Before starting any match, select your team and click on 'View Selected Team'. The Team Editor will be visible:


A roster has been selected, but while any match has not been started, you can remove each player and change your roster as you want - button 'Exit' will be unavailable if you do not have 11 players to start.
Once you're done, click on 'Exit', you're back to the ranking table. In the 'Options' menu, you have:


Animation Speed can be changed: by default it's set to 200. It's a delay in ms between two animation steps. I strongly suggest to let the default value. Put it at 0 to have the maximum speed. You can also deactivate AI Game visibility if you do not want to watch AI playing against AI. By default game is visible.

Click on 'Play Next Match' and first match will start. Just enjoy the game if it's an AI vs AI game.
If user team is in the game, you will have to play :-) 
If you close an AI vs AI game while not finished, it will resume without the UI at the maximum speed. If you close a game where you're playing, it will not be possible to resume the tournament - you will have to load your last saved file.
When user is starting a drive, by default a pre set-up is done for you, but you can still modify the positions (left click button) and click on button 'End Turn' when you're done:

If you're the kicking team - as in this example - wait AI set up and then select ball position and then click on 'End Turn'.

How to move your players?

Select the player (left click) and move the cursor:

In this example mouse is at square '69': if player wants to go there, it has 69% of chance to success. Not 100% because he has to do 2 'Going for it'. Square where probability is 100% are displayed in green (note: skills that do not produce turn over if failed like 'Bone Head', 'Take Root' etc are not taken into account here), other in red. The highlighted squares are the squares the player will follow - notice sometimes they are different paths with same probability to go to a square, if you really want to follow one path move your player square by square, mainly if you want to be sure to not pass over a square with the ball.
Right click on a square to move the player.

How to blitz?

If you move the mouse on an opposite player (here the left bottom red player), you will have:


A suggested path for the blitz is given: highlighted squares and final square where blitz occurs contains 2 numbers - probability to reach the square and probability to put the other KO (defender has neither block or dodge → 'Defender Down', 'Defender Stumbles' and 'Both Down' faces make him bite the dust, which is one chance over two). One small blue square means we will throw one dice if blitz is done from this square. Two blue: we will throw two dices and select the result. Two red: we will throw two dices and opposite player will select the result.
If you do not want to follow suggested path for blitz, left click on buttonand then select another path - eventually square by square - before to finally select (right click) the opposite player. It's important to click on this button before to move if you do not click on an opposite player: if not, blitz will not be available, your action will be considered as an action move.

After right click on the opposite payer, dice(s) is (are) rolled:

You have to select the dice (here only one) or click on 'Team Re-Roll' - if available. Then eventually you'll have to select to follow or not the player, or to select a skill or not (like stab).
After that you select square where to push player (left click on a blue square):

If player has remaining move points, you can move it.

How to throw ball?

Select a player (left click). If player has not yet moved and has not yet the ball, click on button:
Then move on the ball (hoping to get it) with right click. If you pick it then put mouse over player with ball and you'll see:

The different colors correspond to the difficulty to pass the ball. Not possible to launch ball further than red squares.
If you move your cursor on a friendly unit and right click on it, an attempt to pass is done.
As for blitz, if you simply move the player with the ball without clicking on the 'pass' button, it will not be allowed to pass the ball - it's considered as a move action.

How to hand off the ball?

Same as for throwing, except you have to use button:

and that you need to be just next player you want to give the ball.

How to make a foul?

Same as blitzing, except you have to use button:

and move on a player on the ground. If you select a player (that has not yet moved) and right click on an opposite player on ground, the best path will be automatically chosen and foul will be done on player. Do not forget your unit can be excluded.

How to make a block?

Select a player next opposite players. As for blitz, you will see small 'red' or 'blue' squares to indicates number of dices for the block. Just right click on unit you want to block.

Notice that after selecting the player (here blue guy with white hair), you see the 'block' dices on player you can block, and all squares where you can move are in 'red' has you will have to dodge if you want to move. If you click on the 'block' button:

you do not see these 'red' square as your action is considered as a block action. Notice practically there is no really need to use the button, just right click on the opponent unit.

Post Match sequence

After the match you come back to the ranking table. Notice an AutoSave file has been created, in the folder 'Save' created in the directory where you have launched the game.

It will not be possible to play next match while all user teams have not upgraded their players (if needed) and select at least 11 players in the roster - with eventually the help of journeymen. To do that, select your team and click on 'View Selected Team'. Next each player that can be upgraded, you will have a button that will allow to upgrade it. You can also enroll free journeyman, or buy journeymen that have played last match. Notice there is no reason to keep some money in your treasury (and not in the bank) as for a user, it is not yet possible to buy inducements before the match.
Be careful before to buy/fire a player, once it's done, it's done...

Loading/Saving Tournament

This is possible when no match is running. Notice there is no save mechanism for a match you are currently playing. Like the 'AutoSave' file, save files are located in the folder 'Save' created in the directory where you have launched the game.

Missing functionalities

- Following skills are not implemented: Piling On, Pass Block, Multiple Block, Kick Off Return, Kick, Hail Mary Pass, Diving Tackle, Blood Lust, Animosity, Bombardier, Throw Team-Mate (and consequently Right Stuff and Always Hungry), Leap, Dump-Off
- Pre-match sequence: AI can do the selection, but not human player - wizard is not yet implemented at all
- Special play cards - it's not intended to implement this
- Mercenary - it's not intended to implement this

Before to improve current AI level, next step will be to add the missing skills - although the most important are implemented.