AI ... editing question/help.

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

AI ... editing question/help.

Post by Merr »

Pip,

Can you split off the function that calls the AI_UNIT(me) ???

What I'd like to do is have the AI go through all it's units once (with a lower "gAttempt" value), and then go through all the units again (or several times). Currrently, the AI only considers each unit once, then moves along. I want the AI to move the units "peicemeal" to better choreograph it's teams.

I looked at your current flow with these three functions ;

Code: Select all

//**************************************************************************
//	REQUIRED FUNCTION:  Called before anything else to rebuild any global AI data
//**************************************************************************
FUNCTION AI_REBUILD(side)

//**************************************************************************
// REQUIRED FUNCTION : this is called for each team after the AI Rebuild is called each Ai turn 
//**************************************************************************
FUNCTION AI_TEAM(side, team)

//**************************************************************************
//	REQUIRED FUNCTION : This is called by the AI until it returns -1
//**************************************************************************
FUNCTION AI_UNIT(me)
I was thinking about this kind of flow ...

1st Move
:arrow: AI_Rebuild
:arrow: AI_Team
:arrow: AI_Unit

2nd Move
:arrow: AI_Rebuild
:arrow: AI_Team
:arrow: AI_Unit

When you get a chance ... Would there be a better approach to this?

Thanks,

Rob
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

The calls to the AI functions are part of the core code in the AI update loop. It goes through each unit once. I guess we could do it multiple times, to try and allow for reactions to things that other units have seen, etc, but to be honest I wanted to try and both mimic the 'usual' user, who will tend to look at each unit once, and prevent the AI turn taking too long by going to each unit multiple times.

I will add this kind of flow control to the wishlist.

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

pipfromslitherine wrote:The calls to the AI functions are part of the core code in the AI update loop. It goes through each unit once. I guess we could do it multiple times, to try and allow for reactions to things that other units have seen, etc, but to be honest I wanted to try and both mimic the 'usual' user, who will tend to look at each unit once, and prevent the AI turn taking too long by going to each unit multiple times.

I will add this kind of flow control to the wishlist.
I was hoping you could split off that core code for the AI loop. It might allow for some more advanced AI functionality ... I dunno :? .

wrt : mimicing the user ... That was my thinking as well but it's difficult for me to justify my thinking. I figured with two seperate runs, along with more conditions in the MoveAIunit, it could skip over a unit in the first run (for whatever reason) and then come back to it in the second run. The best way to explain this is for you to put your personality into the AI ... When you play, do you always more the same unit first until it's exhausted?

In the meantime, I've looked at work arounds by making changes to AI_UNIT and MoveAIunit. I might be able to run a seperate loop but I fear, if I don't do it right, it could be an infinite loop ... I'm good at that :arrow: I open task manager and read, "BA not responding" ... You think? :lol:

Thanks for your time to respond ... always appreciate a professional look to a problem.

Rob
Post Reply

Return to “Battle Academy : Modders Corner ”