Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2001:
[Freeciv-Dev] Threads!!??
Home

[Freeciv-Dev] Threads!!??

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Threads!!??
From: Jordan Crouse <jordanc@xxxxxxxxxxx>
Date: Tue, 06 Feb 2001 08:41:25 -0700

Whilst deep in thought and exploration for AI diplomacy, it has become
apparent that the AI players will need to be informed of events and
diplomacy attempts.  I looked at it extensively the other night, and I
couldn't find any preexisting code and/or hooks for this, but I could be
wrong.  

If not, then I am looking for comments on a couple of different options
for the AI to receive and process event packets:

A) - Send the messages to the appropriate AI hooks as they come up in
the list, ie:

if (i_am_ai) ai_send_packet(blah); else send_to_network(boah);

This has the disadvantage of delaying the sending of packets to
legitimate players while we crunch the AI.

A2) - A slight variant on the above -- send all network packets first,
and then handle the hooks for all AI
This has the disadvantage of delaying the receiving of incoming packets
while we crunch the AI

B) - Add AI players to their own thread, and set them up with a socket
like the other players, so they can get messages and process them
on their own time.  This has the advantage of not slowing down the
server, but it will add many new layers of complexity to the server, and
limit the portability.


Does the infinitely slow response time of a human (at least in computer
terms) cancel out the processing time that we will spend considering
diplomacy and other factors, or is there enough of a timing issue that
threads would be the best way out. 

Comments, suggestions, flames and death threats will be accepted,
Jordan



[Prev in Thread] Current Thread [Next in Thread]