.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   SEV Modders Knowledge Base (http://forum.shrapnelgames.com/forumdisplay.php?f=154)
-   -   AI state changes (http://forum.shrapnelgames.com/showthread.php?t=31394)

aegisx October 28th, 2006 11:23 AM

AI state changes
 
I could be wrong, but I don't think the state change is working correctly. My test empire seems to go right to AI_STATE_INFRASTRUCTURE. the code tells it to start with EXPLORE, but if the following function returns false, go to AI_STATE_INFRASTRUCTURE. This function could use work anyways, as just meeting someone shouldn't stop the exploration. My Test empire, turn #2 is already out of the explore state, it has warp points and hasn't met anyone.

//------------------------------------------------------------------------
// Should_We_Continue_To_Explore
//------------------------------------------------------------------------
function Should_We_Continue_To_Explore returns boolean
params
vars
retval: boolean
begin
set retval := TRUE

// Do we know of other players?
if (Sys_Empire_Politics_Get_Number_Of_Known_Players(s ys_long_Player_ID) > 0) then
set retval := FALSE
endif

// No more unexplored systems?
if (retval) then
if (lst_AI_Explore_System.Count() = 0) then
set retval := FALSE
endif
endif

return retval
end

NullAshton October 28th, 2006 11:52 AM

Re: AI state changes
 
Hmmm, to speed it up any, shouldn't it end after the first if statement if the returnvalue is false?

aegisx October 28th, 2006 02:26 PM

Re: AI state changes
 
Maybe, depends on how it compiles though. It just does not seem to be working right. Is the a Debug print or something?

Raapys October 28th, 2006 02:44 PM

Re: AI state changes
 
It does end after the first if statement if the returnvalue is false, from what I can tell. Note the "if (retval) then".

From what I can see of the code, there doesn't appear to be anything immediately wrong.

Could there be something else triggering it? The empires in stock seem pretty messed up at any rate; they work far better in Kwok.

I believe the AI also keeps an explorer ship or two even in the other states, though?

<font class="small">Code:</font><hr /><pre> AI_STATE_EXPLORE_AND_EXPAND:
set lng_Max_Explorers := 3
AI_STATE_INFRASTRUCTURE:
set lng_Max_Explorers := 1
AI_STATE_ATTACK:
set lng_Max_Explorers := 1
AI_STATE_DEFEND:
set lng_Max_Explorers := 1
AI_STATE_NOT_CONNECTED:
set lng_Max_Explorers := 2</pre><hr />

aegisx October 28th, 2006 03:03 PM

Re: AI state changes
 
I think the issue is it doesn't stay in the Explore state. I'm away from the game, but I wonder what value Sys_Empire_Politics_Get_Number_Of_Known_Players(sy s_long_Player_ID) is returning during the first few turns. Not sure if theres a way to print it out.

Phoenix-D October 28th, 2006 03:10 PM

Re: AI state changes
 
It might start out at 1, counting the running empire. I was going to suggest calling it from a component but that doesn't actually work.

Raapys October 28th, 2006 03:13 PM

Re: AI state changes
 
Do you actually know for certain that it's out of explorer state?

You could force a returnvalue TRUE and see if it makes any difference in the AI's behaviour, i.e. keeps him in explorer more, to find out if that's really the function that kicks it out of explorer state in the first place. If it is, and you're certain he doesn't 'know' any other empires, then obviously we've a bug in the number of known empires function.

Kwok can probably tell if what Phoenix says is a fact. Sounds strange to me that it would list itself, though. An easy fix, at any rate.

It could also be the part which checks if there's no more unexplored systems.

Captain Kwok October 28th, 2006 04:36 PM

Re: AI state changes
 
In the balance mod the AI keeps 3-5 explorers and surveyors on hand and merely meeting 1 race will not kick if from exploration mode - it's set to &gt; 3. I also think another factor is that survey ships lag behind leaving undiscovered warp points uncovered so the AI thinks it doesn't have anymore systems to explore and the explorer ships just hang out at their target WP. Once the a new warp point is uncovered and it hasn't exited the expand and explore state it will keep going. At least this is my working hypothesis. http://forum.shrapnelgames.com/image...ies/tongue.gif

Raapys October 28th, 2006 04:44 PM

Re: AI state changes
 
The fog of war thing is really creating alot of Ai issues.

aegisx October 28th, 2006 04:52 PM

Re: AI state changes
 
It is not staying in the explore state even though it should. I have the Empires research allocations based on the state, and they are in the Infrastructure state pretty much immediatly.


All times are GMT -4. The time now is 06:11 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.