Map Database  •  FAQ  •  RSS  •  Login

AI attack changes in the upcoming release

<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 06 Jun 2014, 15:28

AI attack changes in the upcoming release

For the next KaM Remake release the way AI attacks work has been changed to be more like it was in the original game. The Dark Lord noticed that we had implemented AI attacks incorrectly in the KaM Remake, so hopefully this will make the original campaigns work better. But unfortunately it means that any maps with AI that were designed/tested for the KaM Remake might work incorrectly now.

1. Previously AI attacks had a parameter "Soldiers required", which meant the attack would occur when the AI had that many available soldiers. The parameter now means "Number of soldiers to attack" and has been renamed as such. So now this parameter tells the AI how many soldiers in total should go on the attack (before it was only used to trigger it). But the AI won't split groups so even if you set it to 1 the AI will still take a full group.

2. The parameter "Take all" previously meant the AI would attack with his entire available army (backline defence positions and idle soldiers). Now it means the AI will attack with the "Number of soldiers to attack" (see above) and choose that number of soldiers randomly from the available groups. The parameter has been renamed to "choose randomly"

So basically you only need to worry if:
1. You set "Soldiers required" (now "Number of soldiers to attack") to be different than the number of soldiers you actually want to attack (because previously it was only a trigger not the actual number to attack)
2. You used "take all" (now "choose randomly") and expected the AI to send its entire army rather than sending "Number of soldiers to attack" worth of groups

For those who are interested I made a description of AI attacks here, since it's kind of confusing:
https://code.google.com/p/castlesand/wiki/AI
I can add explanations of other AI things to that page if requested.

CASE STUDY: Invasion (aka Zombie Apocalypse) by Skypper

The dynamic script spawns groups around the map, and an AI attack causes them to immediately attack the player. The AI attack looks like this:
Type: Repeating
Soldiers required: 0
Groups: Take all

This worked in the past because "soldiers required" was just the trigger. Also "take all" meant every group would be ordered to attack. The change I would suggest is:
Type: Repeating
Number of soldiers to attack: 1
Groups: Choose randomly

The attack will be triggered whenever the AI has at least 1 idle soldier. The AI will send a group to attack every time the attack is launched (every 1.2 seconds), because it won't split groups in order to have 1 soldier. If Skypper requires the attack to be faster than 1 group every 1.2 seconds he could add the same attack multiple times.

For more information about the upcoming release (and a nightly build to test your changes in) please check this topic:
viewtopic.php?f=5&t=2229

If you have any questions please ask :)
<<

Skypper

Knight

Posts: 436

Joined: 28 Jun 2013, 09:37

KaM Skill Level: Fair

Location: Dutch :D

Post 06 Jun 2014, 17:09

Re: AI attack changes in the upcoming release

I edited Invasion like you said.
It worked good, most players will be happy if they get 1.2 extra time, in the later waves ;)

I have also added a description
You do not have the required permissions to view the files attached to this post.
Greets Skypper (Totally Insane)

- Beginning map maker -
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 06 Jun 2014, 19:25

Re: AI attack changes in the upcoming release

If Skypper requires the attack to be faster than 1 group every 1.2 seconds he could add the same attack multiple times.
As far as I know, Skypper's script is timed and in that sense not dynamic - the troops need to be created by dynamic script obviously, but it is possible to do the attacks with static scripts. I assume he uses some static scripted attacks to a certain degree; but since he knows when and how many new troops will be spawned, he could easily use a TYPE 1 attack, adjust the 'number of soldiers to attack' parameter to the exact number and add a timer.
Then again, I guess 1.2 seconds delay is not that bad and it will probably prevent lag.

In other words, you can ignore the text above. :P
A question though: why is it 1.2 seconds?
<<

cmowla

User avatar

Knight

Posts: 446

Joined: 04 Aug 2013, 19:59

KaM Skill Level: Expert

Location: United States

Post 07 Jun 2014, 00:00

Re: AI attack changes in the upcoming release

I edited Invasion like you said.
It worked good, most players will be happy if they get 1.2 extra time, in the later waves ;)
I can't tell the difference. However, the replay seemed to run faster (maybe it's just me).
Invasion (r6157).zip
What a terrible finish! I guess I let my guard down too early this time, considering that Invasion is easier in this version than r5503! :$
You do not have the required permissions to view the files attached to this post.
Invasion won: with 0 losses and without save reloads|TSK 20 in 4.47 minutes|Border of Life Co-op Won in 1h33m55s|The Official KaM Speedrun Page
What makes me an Expert isn't my skill in of itself but my desire to win big.
<<

Skypper

Knight

Posts: 436

Joined: 28 Jun 2013, 09:37

KaM Skill Level: Fair

Location: Dutch :D

Post 07 Jun 2014, 07:10

Re: AI attack changes in the upcoming release

It definitly runs smoother :D
I could watch your whole replay 10x speed.

later today I will edit the MP version to, forget that one yesterday

Apparently it works in the Beta Winter version to
Greets Skypper (Totally Insane)

- Beginning map maker -
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 07 Jun 2014, 07:39

Re: AI attack changes in the upcoming release

A question though: why is it 1.2 seconds?
Good question. The game can have a maximum of 12 players. Every tick we run the AI update on one player, in order to spread out the load. So each player gets updated on a different tick, every 1.2 seconds.
<<

Skypper

Knight

Posts: 436

Joined: 28 Jun 2013, 09:37

KaM Skill Level: Fair

Location: Dutch :D

Post 07 Jun 2014, 07:51

Re: AI attack changes in the upcoming release

And that was also the reason that previously 8 players was the maximum, because you didn't want it to be slower?
Greets Skypper (Totally Insane)

- Beginning map maker -
<<

The Dark Lord

User avatar

King Karolus Servant

Posts: 2154

Joined: 29 Aug 2007, 22:00

KaM Skill Level: Veteran

Location: In his dark thunderstormy castle

Post 07 Jun 2014, 09:39

Re: AI attack changes in the upcoming release

A question though: why is it 1.2 seconds?
Good question. The game can have a maximum of 12 players. Every tick we run the AI update on one player, in order to spread out the load. So each player gets updated on a different tick, every 1.2 seconds.
Ahh that makes sense. However, does that mean that some players 'see everything' one second earlier than some other players? How is it still in synch if everyone gets updated on a different tick? (this might be off-topic but I want to know :P).
<<

Lewin

User avatar

KaM Remake Developer

Posts: 3822

Joined: 16 Sep 2007, 22:00

KaM Skill Level: Skilled

ICQ: 269127056

Website: http://lewin.hodgman.id.au

Yahoo Messenger: lewinlewinhodgman

Location: Australia

Post 07 Jun 2014, 10:32

Re: AI attack changes in the upcoming release

And that was also the reason that previously 8 players was the maximum, because you didn't want it to be slower?
No, 0.8 seconds vs 1.2 seconds doesn't matter for AI updates, and we could have changed it anyway if we wanted it to update more often. The only real reason for the limit of 8 before was that it was the limit from the original game. Also it's impractical to fit more players into interfaces like the map editor (player selector and alliances for example).
A question though: why is it 1.2 seconds?
Good question. The game can have a maximum of 12 players. Every tick we run the AI update on one player, in order to spread out the load. So each player gets updated on a different tick, every 1.2 seconds.
Ahh that makes sense. However, does that mean that some players 'see everything' one second earlier than some other players? How is it still in synch if everyone gets updated on a different tick? (this might be off-topic but I want to know :P).
We're only talking about the AI update remember. I'm not sure what you mean about players seeing everything. Yes AI's make decisions on different ticks. If you put 12 AIs near each other then their first update (when they place the school) will occur one tick after each other and you should be able to observe that.

Return to “Map Design”

Who is online

Users browsing this forum: No registered users and 3 guests