So.... does leaving the game unattended for a while make the AI tougher?

Just a question. When I walk away for 30 minutes, is the AI cleverly analyzing all of the possibilities and trying to find innovative ways to crush me, or am I safe?
6,455 views 9 replies
Reply #1 Top
I beleive all the calculations are made when the turn is ended. It's not like the timed computer chess games.The AI responds to what you did after each "end turn" ...I believe.

-Wade
Reply #2 Top
I thought that during the turn the AI calculates how to play the game? So he's asking if he leaves for 30 minutes..will the AI take 30 minutes to think out its move?

I remember reading somewhere that the AI in GC2 is multithreaded, when you're making your moves during your turn, it's calculating it's turn as well...so yes i do believe it will use those 30 minutes but i've never had any problems leaving the pc on for 30 mins while i eat or something..
Reply #3 Top
remember reading somewhere that the AI in GC2 is multithreaded, when you're making your moves during your turn, it's calculating it's turn as well...


Yes. So that The end turn procces does not take a long time. But the AI "thinks" each time you move a ship , for example, but not if you let the game "sit" all night...I believe.

-Wade
Reply #4 Top
well, there is only so much it can "think" about... it can probably calculate everything it needs in a relatively short amount of time...
Reply #5 Top
That seems a little creepy. "The AI is thinking. It's calculating how it can defeat you and rule the galaxy. Don't people write stories about that kind of thing?
Reply #6 Top
It's not really thinking like that. It would be something like:

An Altarian fighter is sitting in a sector. The human player moves a ship into the same sector, within sensor range of the Alatarian ship. A series of if statements are run:
If it's a foe:
Can the fighter defeat it in battle?
If yes:
Can the fighter "out run" the enemy ship?
If yes:
The computer will designate the Altarian ship to move on its turn to attack the ship.
If it's a friend:
Continue with auto explore/auto survey/sentry/guard.

The decision is set as soon as the human player ship moves into range of any ship, starbase, or planet. Once the human player makes a change, such as move that ship out of sensor range, the computer might determine where it went, and opt for a pursuit. If it notices that it's transports, and the direction the transports are going are towards a planet, it will ready that planet for defense.

If that Altarian fighter pursues, and winds up in sensor range of a Drengin fighter, the process for the Drengin continues. The computer would already know the outcome when you move a ship, as to what the Drengin and the Altarians are going to do in the situation.

Say you're at war with the Altarians, but are allied with the Drengin. The above scenario occurs, you have an unarmed construction ship moving to a position to setup a forward base to help you push into Altarian territory. The constructor ship moves out of sensor range of the Altarian fighter, but passes into (or thorugh) the sensor range of a Drengin fighter fleet. The computer decides that the Altarians will pursue, and wind up passing through the Drengin fleet sensor range in the process. The computer then decides that the Drengin will attack the Altarian fighter when it passes through. So, it plays out, you move, the Altarians move in pursuit, and the Drengin follow and attack the Altarian fighter.

If you walk away for 30 minutes, the outcome will still be the same. The Altarian process might keep running to see if it's the appropriate course of action, and the Drengin process will keep running to see if it's the appropriate course of action as well. But, the outcome will likely stay the same.
Reply #7 Top
copied from a Frogboy post here.

We just released Galactic Civilizations II v1.1 yesterday and things seem to be going pretty well. It's just as well that I'm going because I've already thought of some new things for the AI that I think could make a difference in how it plays. And the engine team got my new option in -- "Allow AI to use extra CPU time" that people who are willing to wait (or have really powerful CPUs) can set the AI to use algorithms that are more time intensive.

I don't think most people sit and and realize the restrictions on writing computer AI code is. You can't do things like do a for loop of all the tiles that are uncovered by the FOW that a ship might travel on in its turn or the following several turns along with nearby tiles to see what might happen. Each ship has to decide its move in less than a milisecond. Each planet has about a milisecond to decide what it's going to build. And this is on typical hardware mind you, not state of the art machines. The trick to writing good computer AI isn't just sittin gthere putting together clever algorithms, it's also being able to create algorithms that do their thing without using much time.

For example, one of the most intensive things that the AI does is design ships. Part of that reason has to do with the actual graphical assemblage which I don't fully understand what's involved on that part. But I only allow the AI to design ships once per year right now. If I tweaked it to even 3 times a year I think you'd notice a significant difference, especially early on when human players have better ships because in 2226 the human player has gotten plasma weapons and the AI is still running around with laser 1 or something when it has actually researched Plasma weapons as well. But I digress.
Reply #8 Top
If the AIs were doing any "thinking" while the player was taking a break, you would see continuous processor usage to a high degree. The AIs only do their thinking in response to player actions. One question I would ask the developers is, "How many threads of execution are permitted when the AI is 'thinking' about its moves?" If too many threads are allowed, this may be a part of the reason for the memory leak, especially if the code is not written with the latest deconstruction methods, to make it automatic rather than having to be specifically coded for.

Reply #9 Top
If too many threads are allowed, this may be a part of the reason for the memory leak


Read the memory link issue. It's a problem with reading the files, not threads.