Jump to page: 1 2
Thread overview
The computer has no special advantages - yeah right!
Jul 25, 2006
Stewart Gordon
Jul 25, 2006
Sean Kelly
Jul 26, 2006
Stewart Gordon
Jul 27, 2006
Sean Kelly
Jul 27, 2006
Stewart Gordon
Jul 27, 2006
Walter Bright
Jul 27, 2006
Sean Kelly
Jul 27, 2006
Stewart Gordon
Jul 27, 2006
Walter Bright
Jul 27, 2006
Sean Kelly
Jul 27, 2006
Walter Bright
Jul 28, 2006
Stewart Gordon
Jul 29, 2006
Walter Bright
Jul 28, 2006
Stewart Gordon
Jul 29, 2006
Walter Bright
July 25, 2006
From the help file:

"The computer operated players play by the same rules and under the same conditions that you do. It has no special advantages, though it may appear otherwise at times."

This doesn't seem right.  Firstly, because computers are much faster than humans at processing information, the computer can often complete several turns in the time it takes the human player to make one move. This can be seen by observing that human player is almost constantly ten or eleven turns behind the computer-controlled players.  (One improvement in my current working version is to bring the turn counters properly into view, as they were presumably meant to be.)

Secondly, to add to this effect, it appears that a computer player's timeslice corresponds to the time it takes the computer to think of a move to make.  On the other hand, the human's timeslices consist merely of looking to see if the player has pressed a key and then processing it, and are therefore much smaller than the computer's timeslices.

Moreover, am I imagining it, or does the same computer opponent sometimes attack two of my units before my move is accepted?  I can't see why this would be happening - it would appear on looking at the code that in one timeslice, the program receives no more than one move, be it from human or computer.

There ought to be a way of making the game fairer from this point of view.  MFH claims to have made the improvement "avoiding 100% CPU load".  It would be interesting to see how this is implemented, and whether it is any step towards this.

I guess a possible approach is to use threads to implement the AI, and thereby do away with timeslices.  Of course, it would be necessary to design the mechanism for processing the moves to avoid collisions between players' moves.  One possibility, on Windows at least, is to use a custom message to post the computer's moves to the message queue along with the keystrokes that constitute the human's moves.  And so that it plays at a more humanistic speed, the AI threads could pause briefly before making each move.  Of course, it would take some thinking to decide how long the delay should be....

This isn't something I plan to implement right now.  I suppose it would be worth seeing MFH's work before coming to any decision on what to do.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
July 25, 2006
Stewart Gordon wrote:
>  From the help file:
> 
> "The computer operated players play by the same rules and under the same conditions that you do. It has no special advantages, though it may appear otherwise at times."
> 
> This doesn't seem right.  Firstly, because computers are much faster than humans at processing information, the computer can often complete several turns in the time it takes the human player to make one move. This can be seen by observing that human player is almost constantly ten or eleven turns behind the computer-controlled players.  (One improvement in my current working version is to bring the turn counters properly into view, as they were presumably meant to be.)

But this is a turn-based game.  How can the computer opponents (of which there are several) possibly get more turns than the player?

> Secondly, to add to this effect, it appears that a computer player's timeslice corresponds to the time it takes the computer to think of a move to make.  On the other hand, the human's timeslices consist merely of looking to see if the player has pressed a key and then processing it, and are therefore much smaller than the computer's timeslices.

I'm not sure I understand.  Do turns automatically expire if you take too long to press a button?  I've never seen this happen.

> I guess a possible approach is to use threads to implement the AI, and thereby do away with timeslices.

I suppose if you want the computer to constantly 'think' in the background this might make sense.  Though it's worth mentioning that modern versions of this game such as Civilization still use timeslices.


Sean
July 26, 2006
Sean Kelly wrote:
<snip>
> But this is a turn-based game.  How can the computer opponents (of which there are several) possibly get more turns than the player?

Read the code and the documentation.  It's a cross between a turn-based game and a real-time strategy game.  It took me a while to make sense of it too.

>> Secondly, to add to this effect, it appears that a computer player's timeslice corresponds to the time it takes the computer to think of a move to make.  On the other hand, the human's timeslices consist merely of looking to see if the player has pressed a key and then processing it, and are therefore much smaller than the computer's timeslices.
> 
> I'm not sure I understand.  Do turns automatically expire if you take too long to press a button?  I've never seen this happen.

No.  Look at the unusual message loop and the functions it calls. You'll see that it polls each player in turn to see if a move has been entered.  Each player has his/her/its own turn counter.  When any player is 11 turns ahead of any other, it simply stops giving the ahead player timeslices for the time being.  When I bring out my latest version, you will be able to see this for yourself more clearly.  And you will see that, because the computer can play much faster, your turn number will usually be 10 or 11 behind that of your opponents.

>> I guess a possible approach is to use threads to implement the AI, and thereby do away with timeslices.
> 
> I suppose if you want the computer to constantly 'think' in the background this might make sense.  Though it's worth mentioning that modern versions of this game such as Civilization still use timeslices.

You mean think while waiting for the opponent to move?  I'm surprised if even the newer Civ incarnations implement this by timeslices.  Is this why even turn-based games often stipulate a minimum processor speed - so that the AI can keep up with the human brain?

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
July 27, 2006
Stewart Gordon wrote:
> Sean Kelly wrote:
> <snip>
>> But this is a turn-based game.  How can the computer opponents (of which there are several) possibly get more turns than the player?
> 
> Read the code and the documentation.  It's a cross between a turn-based game and a real-time strategy game.  It took me a while to make sense of it too.

Crazy.

>>> I guess a possible approach is to use threads to implement the AI, and thereby do away with timeslices.
>>
>> I suppose if you want the computer to constantly 'think' in the background this might make sense.  Though it's worth mentioning that modern versions of this game such as Civilization still use timeslices.
> 
> You mean think while waiting for the opponent to move?  I'm surprised if even the newer Civ incarnations implement this by timeslices.  Is this why even turn-based games often stipulate a minimum processor speed - so that the AI can keep up with the human brain?

I'm not actually certain how Civ works at a code level, but the player and all computer opponents are given an actual turn in which to do whatever.  Late in the game the computer turns tend to take at least a few seconds to complete so I suspect much of the work occurs then.


Sean
July 27, 2006
Sean Kelly wrote:
> Stewart Gordon wrote:
<snip>
>> You mean think while waiting for the opponent to move?  I'm surprised if even the newer Civ incarnations implement this by timeslices.  Is this why even turn-based games often stipulate a minimum processor speed - so that the AI can keep up with the human brain?
> 
> I'm not actually certain how Civ works at a code level, but the player and all computer opponents are given an actual turn in which to do whatever.  Late in the game the computer turns tend to take at least a few seconds to complete so I suspect much of the work occurs then.

Indeed.  I'd never had any impression that in Civ the computer thinks ahead, but I suppose it's easily possible.  I imagine that most modern games would use threads to implement it.  Indeed, most modern strategy games probably have the computer's thinking always in a thread separate from the main execution thread, so that the program doesn't go into a "not responding" state for seconds or minutes at a time.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
July 27, 2006
While debugging, I stumbled upon another bug that might give the computer an unfair advantage.  At the beginning of the game, before the first unit has been built, computer players advance one turn per timeslice, and the human player advances one turn every two timeslices.  This could be just what I can see at the moment of yet another cause of the computer's turns advancing more quickly.  OK, so the significance of this will lessen as the game progresses and there are more units to manoeuvre, but it's still there.

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on the 'group where everyone may benefit.
July 27, 2006
Stewart Gordon wrote:
>  From the help file:
> 
> "The computer operated players play by the same rules and under the same conditions that you do. It has no special advantages, though it may appear otherwise at times."
> 
> This doesn't seem right.  Firstly, because computers are much faster than humans at processing information, the computer can often complete several turns in the time it takes the human player to make one move. This can be seen by observing that human player is almost constantly ten or eleven turns behind the computer-controlled players.  (One improvement in my current working version is to bring the turn counters properly into view, as they were presumably meant to be.)

The fact that the computer is smarter than you is a perfectly fair advantage!
July 27, 2006
Sean Kelly wrote:
> But this is a turn-based game.  How can the computer opponents (of which there are several) possibly get more turns than the player?

Empire was designed to run on a PDP-10, which ran like molasses relative to today's PC. Allowing some "hysteresis" on the turns made for a smoother playing experience.
July 27, 2006
Walter Bright wrote:
> Stewart Gordon wrote:
>>  From the help file:
>>
>> "The computer operated players play by the same rules and under the same conditions that you do. It has no special advantages, though it may appear otherwise at times."
>>
>> This doesn't seem right.  Firstly, because computers are much faster than humans at processing information, the computer can often complete several turns in the time it takes the human player to make one move. This can be seen by observing that human player is almost constantly ten or eleven turns behind the computer-controlled players.  (One improvement in my current working version is to bring the turn counters properly into view, as they were presumably meant to be.)
> 
> The fact that the computer is smarter than you is a perfectly fair advantage!

The most difficult aspect of AI programming isn't making one that can soundly beat a human opponent, but making one that will be engaging and challenging and make "realistic" mistakes.  But this rule is just one more that the player must adapt to, and I suspect a seasoned player could play quickly enough to keep up with the computer, given realistic timeslices.


Sean
July 27, 2006
Walter Bright wrote:
> Sean Kelly wrote:
>> But this is a turn-based game.  How can the computer opponents (of which there are several) possibly get more turns than the player?
> 
> Empire was designed to run on a PDP-10, which ran like molasses relative to today's PC. Allowing some "hysteresis" on the turns made for a smoother playing experience.

Makes sense.  I'll admit I do remember people playing Empire on Sun or perhaps DEC machines ages ago, but I somehow dodged the addiction until only recently ;-)


Sean
« First   ‹ Prev
1 2