OldUnreal / UnrealTournamentPatches

Other
991 stars 29 forks source link

[469a] bots not performing Godlike in Server #85

Closed no0nehere closed 3 years ago

no0nehere commented 4 years ago

Hi there , Iam trying to setup a server with 4 Godlike Bots , however they never seem to go past average/skilled level even though I set the Difficulty in User.ini to 7 when I go online to play I get the following; image001 image002 image003 Bots are average skill level even though set to maximum difficulty.

no0nehere commented 4 years ago

@gargul03 nah doesn't work unfortunately;

Browse: DM-Tutorial?Team=0?game=Botpack.DeathMatchPlus?mutator=MapVoteX106k.MapVoteX?Difficulty=7

ucc.init if [ -z "$MYMODS" ]; then TMP="$MYMAP""\?game=$MYGAME" else TMP="$MYMAP""\?game=$MYGAME""\?mutator=$MYMODS\?Difficulty=7"

no0nehere commented 4 years ago

I run a 469a Server and have never been able to get bots to perform at any other level then skilled/average its as if , its preset. perhaps in 469a we could address this problem and be able to freely set bots skill-levels to anything between 1~7 we have a MultiServer type setup where Bots are supposedly adjusted depending on GameType being played. for example InstaGib / ComboGib they should be lower Difficulty then say CTF/DM

no0nehere commented 4 years ago

Could you check in your server browser that they are indeed GodLike? This time round by browser reports that they are GodLike. Godlike I dont have a Server setup with 451b unfortunately.

an-eternity commented 4 years ago

server-test_bot-difficulty_ What was the solution?

garry-ut99 commented 4 years ago

Setting difficulty in User.ini doesn't work for me, what works for me is to add ?Difficulty=7 to a server command line bat, it works both in 451b & 469a.

https://github.com/OldUnreal/UnrealTournamentPatches/issues/85#issuecomment-705304707 : no0nehere : Could you check in your server browser that they are indeed GodLike?

I've checked and it shows "Skilled".

SeriousBuggie commented 3 years ago

I can't understand what exactly the problem is.

  1. Bots do not play like godlike, while in the settings is godlike?

  2. Bots play like godlike, but the server list says they are not godlike?

You are relying on the information from the browser as correct, but the information from the server console is incorrect.

While everything can be the other way around. So first you need to find out how bots actually play in order to understand what the problem is.

SeriousBuggie commented 3 years ago

I make small test. Improved DM-Deck16][ for bots started as multiplayer server. 4 min players (1 human + 3 bots). One try with Godlike bots. Second with Skilled bots. Before start match I checked Browser for LAN games. Both say me "Skilled" in Bots skills. Godlike setup: scr_1615152098 Skilled Setup: scr_1615152134 First be not easy. Second be easy. So I can say no any problem with bots skills. Exists problem for report properly value to clients.

an-eternity commented 3 years ago

To get it "Godlike", Difficulty in 'ChallengeBotInfo' must be 11...

SeriousBuggie commented 3 years ago

Look at this code https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/DeathMatchPlus.uc#L240

    if ( Difficulty >= 4 )
    {
        bNoviceMode = false;
        Difficulty = Difficulty - 4;
    }
    else
    {
        if ( Difficulty > 3 )
        {
            Difficulty = 3;
            bThreePlus = true;
        }
        bNoviceMode = true;
    }

And on this: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/DeathMatchPlus.uc#L816

    if ( Difficulty >= 4 )
    {
        bNoviceMode = false;
        Difficulty = Difficulty - 4;
    }
    else
    {
        if ( Difficulty > 3 )
        {
            Difficulty = 3;
            bThreePlus = true;
        }
        bNoviceMode = true;
    }

But report skill very straight: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/DeathMatchPlus.uc#L1512

    if(MinPlayers > 0)
        Resultset = ResultSet$"\\botskill\\"$class'ChallengeBotInfo'.default.Skills[Difficulty];

First thing about "Ladder" so it about UT played in campaign. Not our case. Second thing about servers. Our case.

As we see Difficulty prepared and changed for internal use. So for proper send to clients need reassemble it back from pieces, or (better) use original value. Original values before transformations: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/DeathMatchPlus.uc#L814

Difficulty = BotConfig.Difficulty;

So for fix need change line: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/DeathMatchPlus.uc#L1512

Resultset = ResultSet$"\\botskill\\"$class'ChallengeBotInfo'.default.Skills[Difficulty];

to

Resultset = ResultSet$"\\botskill\\"$class'ChallengeBotInfo'.default.Skills[BotConfig.Difficulty];

In best tradition of UT code stuff duplicated so you need also change line: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/TeamGamePlus.uc#L887

        Resultset = ResultSet$"\\botskill\\"$class'ChallengeBotInfo'.default.Skills[Difficulty];

to

        Resultset = ResultSet$"\\botskill\\"$class'ChallengeBotInfo'.default.Skills[BotConfig.Difficulty];

Fix tested locally. All fine. scr_1615157140 Debug show expected things:

    if(MinPlayers > 0)
        Resultset = ResultSet$"\\botskill\\"$class'ChallengeBotInfo'.default.Skills[BotConfig.Difficulty];
Log("GetRules: " $ ResultSet);
Log("Difficulty: " $ Difficulty);
Log("BotConfig.Difficulty: " $ BotConfig.Difficulty);
    return ResultSet;
ScriptLog: GetRules: \listenserver\True\password\False\timelimit\0\fraglimit\15\minplayers\4\changelevels\False\tournament\False\gamestyle\Hardcore\botskill\Godlike
ScriptLog: Difficulty: 3
ScriptLog: BotConfig.Difficulty: 7
an-eternity commented 3 years ago

Yes... Also, i wonder what was an idea of the lines 823..827, and how that code should normally look like...

Probably, those 5 lines have to be moved upward under the condition "if (Difficulty>=4)" and after "Difficulty-=4". In that case 'GameInfo' Difficulty stays within the valid range of 0..3, and bThreePlus indicates whether 'ChallengeBotInfo' Difficulty is above 7.

SeriousBuggie commented 3 years ago

Look like this Code written when Difficulty be float, not a byte. So 3.5 is be legal value. But with time it changed to byte and code copied. It can be rewritten as:

    bNoviceMode = Difficulty < 4;
    if ( !bNoviceMode )
        Difficulty -= 4;

But, in general, original code work same but look more cryptic ans contain unused parts. Also this code appear here: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/Bot.uc#L2115 Same as I write above.

About bThreePlus read comment here: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/Bot.uc#L48

var     bool        bThreePlus;     // high skill novice

Only one usage: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/Bot.uc#L779

        if ( bThreePlus )
            MaxDesiredSpeed = 1;
        else
            MaxDesiredSpeed = 0.5 + 0.1 * skill;

Currently bThreePlus never can be true, but this is does not matter because line above located inside if ( bNovice ) block.

I think code is inherited from Unreal: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Engine/GameInfo.uc#L14

var byte  Difficulty;                                   // 0=easy, 1=medium, 2=hard, 3=very hard.

4 levels for Difficulty, which later transformed into 8 by add special flag bNovice.

Also here some clues about float Difficulty: https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/RatedMatchInfo.uc#L12

var() float                     ModifiedDifficulty; // how much to modify base difficulty for this match (0 to 5)

https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/RatedMatchInfo.uc#L293

        NewBot.InitializeSkill(LadderObj.TournamentDifficulty + ModifiedDifficulty + BotSkills[n]);

https://github.com/Slipyx/UT99/blob/f2ebd703845075a2d667e8e3f2f71a5e7f187610/Botpack/Bot.uc#L2111

function InitializeSkill(float InSkill)
{
    Skill = InSkill;
    bNovice = ( Skill < 4 );
    if ( !bNovice )
        Skill -= 4;
    Skill = FClamp(Skill, 0, 3);
    ReSetSkill();
}
an-eternity commented 3 years ago

Understood, everything is clear now.

Good that it is easy for GameType devs to fix this. Maybe it also worth to add Clamp in 0..7 for array index (i can't find out where in the scripts are the range checks for this ini value...).

stijn-volckaert commented 3 years ago

Merged Buggie's fixes for 469c.

an-eternity commented 3 years ago

Admins that run XServerQuery will also have to update it to version 2.04 fixed by Deaod, since it was a copy-pasted bug in XServerQuery.