Skip to content

Posts from We are propping up the AI with workarounds.

No ratings yet — be the first to rate!
User Avatar
Auto-translated
Hello everyone!
While creating a Multiplayer map, I encountered a pressing issue: how the AI behaves in artificially created conditions.
The map features numerous activities implemented through scripts, resulting in the player gaining certain advantages: resources, experience, and other benefits.
Naturally, the AI cannot utilize this functionality, hence (based on some tests), it starts losing badly at any difficulty level below Hero.
I understand that not everyone is interested in playing on "Hero" difficulty, as often the game is meant to be relaxing, not challenging. But playing a game where you simply "beat up the AI" is also very boring.
Therefore, I ask everyone who is willing to share their gaming experience (or purely analytical reasoning) on how to replace or enhance the AI on a map with many scripts,
without directly influencing the AI (i.e., without assigning priorities or similar, as is done by the authors of Single-player scenarios, which my map is not).
Here are the main ideas and conditions within which you should think:
1) No AI mods are used due to their incompatibility with most important, irreplaceable scripts.
2) The scripts (their fundamental part) are based on the player's decisions, choices, and preferences.
3) Currently, there is an "Auto-Selection" system that chooses for the AI.
For example:
For a price of 50 resource units, get 5000 experience or 10000 gold? -> The average level of all heroes on the map is calculated; if the AI is behind, experience is chosen; if the AI is not behind and does not have a leading amount of gold, gold is chosen.
This system works, but it is extremely unbalanced. Why? Because the AI, as is known, has an advantage in resources, and it also fights in a "peculiar" way. As a result, now, with this approach, the player suffers,
and it's not an interesting or fair defeat, but simply due to the enemy's overwhelming numbers.

I look forward to any thoughts you may have, as I will draw some rational ideas (or perhaps several) from them. I will be very grateful to everyone for their opinion.
Important: please also respond if you think you are a very bad player. It is very important for me to have a comprehensive opinion from at least 1 5 people.


Не уходи безропотно во тьму,
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!

Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.


                                                                                       
User Avatar
Auto-translated
Jewill

The map features a sufficient number of activities implemented through scripts, the result of which is the player gaining a certain advantage: resources, experience, and other benefits.
Naturally, the AI will not be able to use this functionality, hence (based on some tests), it starts to lose badly at any difficulty level below Hero.

If you mean new buildings (dwellings, treasuries, etc.), you can assign a priority for the AI to visit these buildings using the SetAIHeroAttractor and SetAIPlayerAttractor functions. For example, if it's a treasury, there should logically be a check to see if the visiting hero belongs to the player or the AI. If the player is human, a QuestionBoxForPlayers is displayed with an offer to fight, etc. If the player is AI, then a simple reward and experience are given without pop-up windows or a battle. Let's say an experienced human player can take this treasury on day 20. And if the goal is a strong AI, you can set a priority for a hero of maximum level to visit this treasury on day 20+ using the SetAIHeroAttractor function, where he will come and simulate clearing it (but in reality, he will get the reward for free).

Added 10 minutes later
If priorities are not an option, you can always write a function to simply give n units of army to a hero of maximum level.
In reply to Долгий
User Avatar
Auto-translated
Long

If you mean new buildings (dwellings, treasuries, etc.), you can set the AI to prioritize visiting these buildings using the SetAIHeroAttractor and SetAIPlayerAttractor functions. For example, if it's a treasury, the logic should include a check to see if the visiting hero belongs to the player or the AI. If it's a human player, a QuestionBoxForPlayers should appear, offering them to fight, etc. If it's an AI player, the reward and experience should be given without any pop-up windows or battles. Let's say an experienced human player can take this treasury on day 20. And if the goal is a strong AI, you can set a priority for the AI to visit this treasury on day 20+ with a hero of maximum level using the SetAIHeroAttractor function, where it will come and simulate clearing it (but in reality, it will get the reward for free).
Your idea is interesting, in terms of prioritizing at the right moment. Another question is how to determine these infamous 20 days? Technically, I know enough ways to handle the AI and its interactions (as I wrote above, I have a system that works quite well on test objects). Of course, you can do it through testing, but then most people who will be subjected to the difficult task of playing the first version of the map will experience pain in various places.
Question: Does the bot react to QuestionBoxForPlayers if it is sent to it? Or is there an exception when calling it on the bot? If the game automatically clicks "Ok" for it, that would be a good help. There must be a way to resolve this problem; the bot won't just stop because of a message.


Не уходи безропотно во тьму,
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!

Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.


                                                                                       
User Avatar
Auto-translated
Author
Therefore, I ask everyone who isn't too lazy to share their gaming experience (or purely analytical reasoning) on how to replace or enhance the AI on a map with many scripts,
without directly affecting the AI (i.e., without setting priorities or similar, as the authors of Single-player scenarios do, which my map is not).
It seemed to me that a relatively good tactic would be to give the AI heroes increased experience from the start (and maybe a few extra troops as well). Although I don't play much myself and haven't tested it extensively, the idea is that it should increase the speed of development and aggressiveness.
It might also be good to use MakeHeroReturnToTavernAfterDeath, or something like that. So that after losing the main hero, the AI doesn't become an easy target, but remains some kind of threat. Although this function can be a bit annoying if it happens several times.
Author
For the price of 50 resource units, get 5000 experience or 10000 gold? -> The average level of all heroes on the map is calculated; if the AI is behind, it gets experience; if the AI is not behind and does not have a leading amount of gold, it gets gold.
I think all of this is going in the wrong direction, as it's an obvious overcomplication. It's easier to create a trigger for a new day and gradually add to the AI's resources – the same experience, if it's needed. And gold, as I understand it, is completely useless to the AI – in the fifth game, the AI is a cheater and buys units/builds buildings almost for free.
That is, I'm saying that for a human opponent, there is no difference whether the AI actually levels up on quests or simply has a head start.
 

К А
Стикеры GBF в Telegram
In reply to Jewily
User Avatar
Auto-translated
Jewill
Of course, you can use testing, but then most people who will be subjected to a difficult test while playing the first version of the map will experience pain in various places.

You can set the priority of visiting locations relative to the difficulty. The lower the difficulty, the later the priority is given.

Added 3 minutes later
Jewill
Does the bot somehow react to QuestionBoxForPlayers if it was sent to it? Or is there an exception when calling it on the bot? If the game presses "Ok" for it, that would be a good help. There must be a way to resolve this problem; the bot won't just stop because of a message.

I just checked the operation of QuestionBoxForPlayers. It seems that it is simply ignored by the AI player. And the functions that are activated when the "OK" or "Cancel" buttons are pressed are simply not executed.
User Avatar
Auto-translated
The QuestionBoxForPlayers item is given to a specific player (hence the name)... and if it's given to player 1, it won't be given to any other player.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
QuestionBoxForPlayers is given to a specific player (hence the name)... and if it's given to player 1, it won't be given to anyone else.
I specifically tested giving the QuestionBox to a computer player. The result was a complete disregard for the function.
In reply to Долгий
User Avatar
Auto-translated
Dolgy

You can set a priority for visiting based on difficulty. The lower the difficulty, the later the priority is given.

Added 3 minutes ago

I just checked the QuestionBoxForPlayers function. It seems that the AI player simply ignores it. And the functions that are activated when the "OK" or "Cancel" buttons are pressed are simply not executed.
Thank you, Dolgy, for checking. In this case, it probably isn't even necessary to check if the player is a bot.
I will definitely keep the priority system in mind, because I have objects on the map that work on the principle of a mine, and it would be very unfair to leave all of them for the player.

Added 5 minutes ago
Ment
It seemed to me that it would be a relatively good tactic to give AI heroes increased experience from the start (and a few extra troops as well).
Thank you very much for your detailed thoughts. Yes, overcomplicating things, I agree with you. I often do this; it's the dark side of perfectionism.
I have repeatedly looked at the inner workings of your maps, and I can't remember on which one, maybe even on all of them, I saw the principle you described. I think giving a small bonus is a quite reasonable idea; I think I'll try giving the bot small bonuses every week, and then I'll see how it behaves.
Ment
It would also be good to use MakeHeroReturnToTavernAfterDeath, or something like that.
That's also a good idea, but the map is large, and you can level up well there, even if you're a weakling.
Therefore, I might make a limited number of deaths for the bot, and then this ability will be disabled. We need to take care of the players' nerves! :)


Не уходи безропотно во тьму,
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!

Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.


                                                                                       
In reply to Jewily
User Avatar
Auto-translated
Jewill
In that case, it probably wouldn't even be necessary to implement checks to ensure that the player isn't a bot.

It is necessary. As mentioned above, the functions for clicking the "OK" and "Cancel" buttons cannot be performed by the computer. You will have to implement a check to determine if the hero belongs to the AI, and if it does, immediately direct it to the "OK" button function.

Added 10 minutes later
Or a special function for the AI.
In reply to Долгий
User Avatar
Auto-translated
Long

Definitely. As mentioned above, the functions triggered by clicking the "OK" and "Cancel" buttons are not executed by the computer. You'll have to implement a check to determine if the hero belongs to the AI, and if so, immediately direct them to the function associated with the "OK" button.

Added 10 minutes later
Or a special function for the AI.
I am referring to what Ment wrote, about the possibility of not giving the bot anything at all. And if nothing is given, then it generally doesn't matter that it ignores the message, because its actions are not of interest to us anyway.
Of course, if you are processing the bot's interaction, then checks are definitely needed.


Не уходи безропотно во тьму,
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!

Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.


                                                                                       
User Avatar
Auto-translated
In conclusion, thank you to everyone who participated.
I'm rolling out the "final" system for rewarding the bot for its bravery and heroism. If anyone is interested, click here. If no one clicks, I'll do it this way:
1) I'll limit the number of heroes for the bot to 4. If there are more, it will start intensely dividing its army into integral sums, resulting in it just defeating weak opponents.
But four are enough for it to create "trains" and harass all sorts of directions.
2) Every week, the bot will receive one-eighth of the experience accumulated by the player during the week. If there are several players, it will be the maximum number from all of them. This way, even if the bot is somehow weak in terms of units (which won't happen), it will still have enough stats. This will ensure that the bot is always a serious opponent.
3) In order not to discourage those who play 3 players against 1 bot and go to easily defeat the computer, all interactive scripted activities will still be available, so to speak, to rehabilitate the player after the battle and give them an incentive to attack first.
4) All important objects will receive priority when the bot enters a region, meaning that if it is near a necessary location, it will definitely want to enter it.
5) When the map is released, the following statement will be highlighted in red in the topic: Play with anyone, but not with the computer - it's much more interesting. After all, it's not a scripted scenario.


Не уходи безропотно во тьму,
Будь яростней пред ночью всех ночей,
Не дай погаснуть свету своему!

Хоть мудрый знает – не осилишь тьму
Во мгле словами не зажжёшь лучей –
Не уходи безропотно во тьму.


                                                                                       

Statistics

Welcome our newest member: Emil