[Freeciv-Dev] Re: Threads!!??
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, Feb 06, 2001 at 08:41:25AM -0700, Jordan Crouse wrote:
> 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
AFAIK there is already code like this in the server. Just grep for
"ai.control".
> 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.
If you exchange thread with process you get client side AI which I
consider the way to go.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"I was dead ... but I'm better now."
-- Capitain Sheridan in Babylon 5
|
|