Page 1 of 1

Custom campaigns and AI in Remake

PostPosted: 21 Aug 2012, 10:21
by The Dark Lord
As the new release is approaching and I'm trying to finish a multiplayer map before the moment is there, I intend to update The New Lands for a future release. However, I'm aware the AI isn't the same as in TPR/TSK. Could someone (Krom or Lewin probably) explain to me what is different? It would save me a lot of testing.
Also, I could come up with a list of desired new script commands and other campaign-related stuff but I won't bother you with that right now. :P

Re: Custom campaigns and AI in Remake

PostPosted: 21 Aug 2012, 13:11
by Krom
Lewin is in charge of scripted AI, I hope he is on-line tomorrow and will answer in detail :)
Would be nice to have that differences list sticked somewhere.

There are already some new commands you would like to take advantage of, again - Lewin knows better.

Re: Custom campaigns and AI in Remake

PostPosted: 22 Aug 2012, 01:36
by Lewin
Okay here we go:
1. AI will not command soldiers that are not in scripted defence positions. Even if the town right next to them is under attack they will just sit there. They WILL take part in scripted attacks however. I see this as a bug that should be fixed, in KaM troops would help out if something nearby was under attack.
2. You can control the rate at which the AI equips soldiers using !SET_AI_CHARACTER EQUIP_RATE <TICKS> where 1 tick = 1/10 of a second, so 1000 = 100 seconds.
3. AI will not train soldiers unless there is a need for it (i.e. there is a defence position that is empty/not full). This means if you make an AI with no defence positions, he will make a big village and start producing weapons but never train any soldiers because he doesn't see any need for them :P
4. AI will not move soldiers or attack during peacetime, he will feed them though (like a human player)
5. AI will pursue you mercilessly if you shoot at him, in KaM they would walk to where you used to be, then stop, then come after you again. This means archers can't outrun cavalry easily.
6. As soon as an attacking group of soldiers becomes "idle" they will be taken home and placed in a defence position if there is an available one, otherwise they will just sit there wondering what to do. This means if they are pursuing a group of archers, once they've made one strike and the archer moves out of range they will become "idle" and go home. (this should be fixed by making pursuing keep following the group even after hitting them once, because it's annoying for human players too)
7. If you have attacks over a long distance with lots of troops the game will lag noticeably when the attack is ordered because all the units have a path calculated at the same time. (also something we want to fix)

I could have missed something, if you have any questions please just ask. I know the AI behaviour in the Remake quite well.

Krom is working on a new AI system called the General which will interface with the old system by automatically placing defence positions as the village they build expands, and order attacks when they think they are strong enough. The goal of this is to have a completely independent AI in multiplayer that requires nothing special like AI script commands. Of course the General will only be used for AIs like this, the original campaigns will use the instructions in the script (except for maybe the builder AI in TSK 9, it doesn't have scripted defence/attacks as far as I know).

Unfortunately our AI is still changing a bit, as you can see I've listed some things above that should be improved. It would be awesome to see The New Lands in the Remake eventually, but I won't blame you if you decide to wait until it's more finalised :)
Cheers,
Lewin.

Re: Custom campaigns and AI in Remake

PostPosted: 22 Aug 2012, 14:37
by Guest
Krom is working on a new AI system called the General which will interface with the old system by automatically placing defence positions as the village they build expands, and order attacks when they think they are strong enough. The goal of this is to have a completely independent AI in multiplayer that requires nothing special like AI script commands. Of course the General will only be used for AIs like this, the original campaigns will use the instructions in the script (except for maybe the builder AI in TSK 9, it doesn't have scripted defence/attacks as far as I know).
Could you tell a bit more about the new AI system that you're working on? I'm interested in AI development in general and your project looks like a perfect place for it. May be there is an opportunity to help you?

Re: Custom campaigns and AI in Remake

PostPosted: 22 Aug 2012, 15:46
by Lewin
Could you tell a bit more about the new AI system that you're working on? I'm interested in AI development in general and your project looks like a perfect place for it. May be there is an opportunity to help you?
Krom wrote a bit about it here:
viewtopic.php?f=26&t=1060

What experience do you have? What things interest you most?

Re: Custom campaigns and AI in Remake

PostPosted: 22 Aug 2012, 16:14
by The Dark Lord
I have a question too - I could make 3 different scripts for every mission: easy, medium and hard. I could add or remove troops, attacks, or wares from storehouses, I could make players more or less agressive, I could make players train recruits faster or slower, there are endless possibilities; but would it be useful? Or are difficulty settings already planned (differences in AI behaviour)?

Re: Custom campaigns and AI in Remake

PostPosted: 23 Aug 2012, 10:25
by GreedyMex
Krom wrote a bit about it here:
viewtopic.php?f=26&t=1060
Thanks. I found it just right after I asked the question )
What experience do you have? What things interest you most?
I have about 5 years of professional programming experience. I was working as a web programmer for 3 years (php, javascript, actionscript, python). And now I'm a C/C++ programmer. I haven't programmed Pascal since studying in the university but I had used delphi and object pascal during this time. So I know the language.

Game AI is just my hobby for now. I have a lot of theoretical knowledge about it. I can not boast myself about having much practice with it. Can not tell you about the main interest because it's difficult to single out any specific thing. Designing and programming AI as a whole is the best answer that I could find :)

Re: Custom campaigns and AI in Remake

PostPosted: 23 Aug 2012, 11:39
by Krom
@GreedyMex: Feel free to contact me on ICQ (106696203)/Skype (kromster80) so we could start collaboration :)

Re: Custom campaigns and AI in Remake

PostPosted: 23 Aug 2012, 12:50
by Lewin
I have a question too - I could make 3 different scripts for every mission: easy, medium and hard. I could add or remove troops, attacks, or wares from storehouses, I could make players more or less agressive, I could make players train recruits faster or slower, there are endless possibilities; but would it be useful? Or are difficulty settings already planned (differences in AI behaviour)?
We haven't decided how difficulty could work. We could just scale factors like EQUIP_RATE and stuff, but obviously it's better if the person making the mission can choose those things for himself. But I really doubt many people will bother doing it like that unless the editor supports it, and I don't think we can make the editor support it in a user friendly WYSIWYG way which is what we are aiming for.

So I think we'll just make the difficulty changes somewhat automatic (scaling parameters like EQUIP_RATE), but we haven't put much thought into it. We're interested in your opinion of course :)

Re: Custom campaigns and AI in Remake

PostPosted: 23 Aug 2012, 13:20
by The Dark Lord
Hm yes, those are changes in the script, I could do that myself. What I was thinking of was different AI's (plural artificial intelligences? :P). For example, if you attack an AI player with an archer, an easy AI might not chase you at all, a medium AI chases you until the unit is dead or the pursuers are dead and a hard AI would maybe even do things like chasing and calculating enemy troops within a radius, and if there are too many troops he would retreat.
I do not know if it's possible in terms of CPU-use but I'm just throwing an example at you. Difficulty could be added by scripting but also by making 3 different AI's, one being as smart as possible, one being a little dumb and one between them. :P I can imagine that would be a lot of work but I guess it's needed for multiplayer AI's anyway (at least for building towns).
Then again, it would be no problem for me to make 3 scripts for every mission. But would that somehow be supported by Remake? Like when you select The New Lands from the campaign menu you can choose which difficulty you want to play on?