Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2000:
[Freeciv-Dev] Re: Working on client APIs
Home

[Freeciv-Dev] Re: Working on client APIs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Cc: rf13@xxxxxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Working on client APIs
From: Jed Davis <jldavis@xxxxxxxxxxxxxx>
Date: Mon, 17 Jul 2000 16:56:35 -0400

--On Saturday, 8 July 2000 2:24 PM +0200 Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

I have started on defining and implementing an API for client side AI. The
basic structure in my current design is a general layer, which does
caching and the network stuff. This layer exports an API to the upper
layer, which  I termed "control program". This part can be written in any
language. The interaction is quite simple throught callbacks: the lower
layer sniffs a packet from the network, updates the cache and calls a
notify callback in the upper layer. The upper layer then can use the
cached data to make a decision and call some set_* method in the lower
layer. My test control  program is now written in C and can at least call
turn_done() if it gets  a new_year_notify. This allows to get a whole
game from -4000 till the server-AI kills me in some minutes.

This would also be very useful for client-side scripting/automation/whatever. However I'm not quite clear what a callback would involve here: I first thought that it would involve calling a C function (which could dispatch the call to an embedded interpreter), but the "written in any language" implies that these callbacks involve some kind of IPC with the controller running as a separate process, which is probably a better idea in the long run. Since I'm sort of working on (read: planning and trying in vain to find time for) GUILE scripting, I'd appreciate any information on this.

There is no multithreading in this design. I'm not sure if there is a
situation where mutlithreading is needed. Since I don't know any thread
package for C can somebody recommend one?

I know of pthread (POSIX threads), which as far as I know is fairly widespread.

--Jed





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