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

[Freeciv-Dev] Re: Threads!!??

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Subject: [Freeciv-Dev] Re: Threads!!??
From: Reinier Post <rp@xxxxxxxxxx>
Date: Wed, 7 Feb 2001 00:31:22 +0100

On Tue, Feb 06, 2001 at 05:03:20PM +0100, Fabio Lopiano (ELN) wrote:
> What about having the AI players in separate client-like processes ?
> We could have something like an ai_civclient process which will
> run like any human client, getting all info from the network.

Yes, Raimar Falke, IQ and others are working on that.
See the recent archives.

[Jordan wrote:]

> 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);

The server itself isn't multithreaded.  The AI players really don't
participate in the asynchronicity of multiplayer mode.

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

Note if you put the AIs on localhost or even Unix sockets.
That way you don't have to maintain AI-specific interfacing code.

> 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

It will always be a hack, though.
 
> B) - Add AI players to their own thread, and set them up with a socket

If you're adding a socket, why not let them be full network connections?
(Unix sockets can be a generic option, also available for human players.)

I don't think programming with threads in C is feasible, you'll hurt
portability.

-- 
Reinier



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