Multiplayer/Singleplayer AI

Modding, patches, etc., for anyone who speaks neither Polish nor Czech.
User avatar
Heike Steyer
Soldier level 2
Soldier level 2
Posts: 47
Joined: Tue Oct 16, 2007 2:58 pm
Location: Kildare, Ireland

Re: Multiplayer/Singleplayer AI

Post by Heike Steyer »

-I put {} around the sib_mechanic code, so that is fixed

-I removed the last part of the defend area so that is now working

-the ai_bases + 0 is also fixed and base 2 now attacks

-base_in_area_map I now have under the group of initializing code

however regarding the behemoths, I did out a knew path for them making sure it was fully accessible and new attack hex's for the vehicles aswel but for some reason when they go to attack for strategy 1, I get runtime errors and a list of the temp_list of attacking hexs for the behemoths but I don't understand what is going wrong. This is the only big part of this skirmish AI that is still not working so hopefully you know whats up :)

Just a few little misc. things aswel, I want to name the 3 AI bases but to keep the MP players names on their bases. I tried this but at 30 seconds, it refreshes and the AI bases are just named after their sides. Should i use 'enable' to just loop the command?
And the nation_awards for getting a new person after 10 kills has been disabled somehow aswel.

I attached the whole map this time so you can try out everything in full.
Thanks again
Attachments
Showdown (AI).rar
(340.89 KiB) Downloaded 205 times
Experience is the teacher of all things. - Julius Caesar
User avatar
McBenn
ArCamp Developer
Posts: 509
Joined: Tue Sep 04, 2012 4:30 pm

Re: Multiplayer/Singleplayer AI

Post by McBenn »

I found a minor bug in the attack control code relating to the situation where only behemoths attacked but that's not the source of your problem (I included the fix in your code as well). I wasn't able to reproduce a runtime error but you have a problem with "nonbehemoth_wait_for_behemoth_hexes" and "behemoth_wait_for_nonbehemoth_hexes". Those are the hexes where nonbehemoth hexes wait for behemoths to get into position, and the hexes a nonbehemoth vehicle must get to before behemoths proceed, respectively. These hexes must be contained in "attack_hexes".

In module "Basenames" the names of all bases are whenever a building is started, completed or captured (actually I think "started" is redundant but never mind). So your base name changes would get overwritten. Just moved your naming to that module.

Hm I received a guy from another nation after having scored 10 kills.

And now some other stuff:
Your bases are quite tight so the crane can't reach all buildings in the base. Consider specifying "crane_not_allowed_to_repair_area" in the enigneer control code. Else you will keep getting "destination unreachable" errors which also causes these pseudo-laggs we discussed before.

In the same neighbourhood you should also constrain the cargo bay crate gathering areas to areas the cargo bay can actually reach (again to prevent "destination unreachable"). Actually I noticed not even engineers can reach some crates spawned in the very lower left corner of the American base.

All right, the Americans use two factories. I know the code indicates this is possible but it's not a fully supported feature and factory extension rebuilds Iøm almost sure doesn't support it. But somehow it seems to work out relatively fine anyway. What do you know :P But at least consider only having the rebuildable factory extensions specified for one factory.

"base_in_area_map" is initialized nicely. But now it's never used.

About the attack hexes in the attack control code: Some hexes are a little too far apart. There should be at maximum 15 hexes distance between each attack hex to avoid the pseudo-lagging. And this includes letting the attack path end just outside the originating base since the vehicles are simply told to move to the human pullback hex when they reach the last attack hex.
Attachments
Showdown (AI).rar
(341.61 KiB) Downloaded 195 times
User avatar
Heike Steyer
Soldier level 2
Soldier level 2
Posts: 47
Joined: Tue Oct 16, 2007 2:58 pm
Location: Kildare, Ireland

Re: Multiplayer/Singleplayer AI

Post by Heike Steyer »

I'm sorry, I know this may seem a bit trivial to you but I am still getting runtime errors and I think it is for the behemoths. I even isolated the russians to only using a single strategy and on the first attack, it goes perfect but on the second attack I always get the errors and then the behemoths appear to not move back to their pullback hex's. The runtime errors consist of 3 things, '[]', [0]' and another '[]'. I am not too upset about having the behemoths attacking so if it would be less hassle to use them primarily as defense, then that is fine too.
I thought it would have just been the strategy but now I have no clue :( Any ideas?

Oh and thanks for the extras, I updated them all
Experience is the teacher of all things. - Julius Caesar
User avatar
McBenn
ArCamp Developer
Posts: 509
Joined: Tue Sep 04, 2012 4:30 pm

Re: Multiplayer/Singleplayer AI

Post by McBenn »

Ah, my bad my bad. Again I was careless when stripping the AI for mission specific stuff. When a new Russian attack commences "behemoth_attack_hexes" has to be reset. Else the attack hexes for the new behemoths will never get initialized. I intentionally made the behemoth control code brittle because it also made it simpler. I never thought I would reuse that code anywhere. So in the attack control code you just have to add an if statement:

Code: Select all

if ai_new_attack_commencing[base] then
                         begin
                              all_are_ready = Replace(all_are_ready,base,false);
                              behemoths_in_position = Replace(behemoths_in_position,base,0);
                              nonbehemoths_in_position = Replace(nonbehemoths_in_position,base,0);
                              in_position_target = Replace(in_position_target,base,1);
                              behemoth_lineup_hexes_indexes = Replace(behemoth_lineup_hexes_indexes,base,[]);
                              nonbehemoth_wait_for_behemoth_hexes = Replace(nonbehemoth_wait_for_behemoth_hexes,base,[]);
                              behemoth_wait_for_nonbehemoth_hexes = Replace(behemoth_wait_for_nonbehemoth_hexes,base,[]);

                              if base = 1 then  //HERE - if Russians then reset behemoth attack hexes
                                   begin
                                        behemoth_attack_hexes = [];
                                   end;

                              ai_new_attack_commencing = Replace(ai_new_attack_commencing,base,false);
                         end;
P.S. runtime errors are never trivial. Especially in SAIL where you aren't even told directly where the error occurs they can be a nightmare.
User avatar
Heike Steyer
Soldier level 2
Soldier level 2
Posts: 47
Joined: Tue Oct 16, 2007 2:58 pm
Location: Kildare, Ireland

Re: Multiplayer/Singleplayer AI

Post by Heike Steyer »

Woop Woop!! That worked like a charm! :D Everything seems to be working perfectly now including the basenames as well. Finally the skirmish AI is completed! Thanks a million and I hope others can enjoy using it as well

Cheers :)
Experience is the teacher of all things. - Julius Caesar
User avatar
McBenn
ArCamp Developer
Posts: 509
Joined: Tue Sep 04, 2012 4:30 pm

Re: Multiplayer/Singleplayer AI

Post by McBenn »

I finally fixed what caused laggs when the AI was attacked. You may be interested in implementing this fix in your maps. The culprit was function "BaseUnderAttack". You can just copy-paste the new version (+ the helper function "AnyNearBaseArea").
User avatar
Heike Steyer
Soldier level 2
Soldier level 2
Posts: 47
Joined: Tue Oct 16, 2007 2:58 pm
Location: Kildare, Ireland

Re: Multiplayer/Singleplayer AI

Post by Heike Steyer »

Ah yes thanks for fixing that! But what new version do you mean?
Experience is the teacher of all things. - Julius Caesar
User avatar
McBenn
ArCamp Developer
Posts: 509
Joined: Tue Sep 04, 2012 4:30 pm

Re: Multiplayer/Singleplayer AI

Post by McBenn »

The new version of the Arabian Campaign mod on bitbucket.
User avatar
Heike Steyer
Soldier level 2
Soldier level 2
Posts: 47
Joined: Tue Oct 16, 2007 2:58 pm
Location: Kildare, Ireland

Re: Multiplayer/Singleplayer AI

Post by Heike Steyer »

Oh take the AI from the new missions and use the new piece of code for the "BaseUnderAttack" along with the helper one?
Experience is the teacher of all things. - Julius Caesar
User avatar
McBenn
ArCamp Developer
Posts: 509
Joined: Tue Sep 04, 2012 4:30 pm

Re: Multiplayer/Singleplayer AI

Post by McBenn »

Yes just steal the new version of function "BaseUnderAttack" from Ar15a_cont. It won't compile without the new function "AnyNearBaseArea" (which is just below it).
Post Reply