On 14 June 2014 15:56, Jacob Nevins
<0jacobnk.fc...@chiark.greenend.org.uk> wrote:
> Marko Lindqvist writes:
>> Usable threaded AI

 This should be read as: "one can create AI players that use
'threaded' AI, and the game should work". What it does not mean is
that
it's really threaded AI. Between S2_4 and S2_5 the major development
concerning AI modules was that default AI is no longer hardcoded to be
usable as part of classic AI only. Now other AI modules can also use
it (it allocates memory allocations in the context of correct AI
module), and threaded AI takes advantage of that to be something that
actually runs, but still almost completely in the main thread.
 The only thing running in the separate thread is that cities evaluate
needs to improve their tiles, and can then "order" workers for these
tasks - free workers will then do that in main thread. That's the only
functional difference between classic AI and threaded AI - in classic
AI workers are completely self-driven. (The implementation of
autosettlers is such that they first check for orders from cities and
then fallback to deciding themselves. Classic AI cities never give
orders, and threaded AI workers can end up deciding themselves if
cities have no orders in place)

>> r20457 / patch #3000
>> r20529 / patch #3033
>   [...]
>
> What should I say about threaded AI in the 2.5 release notes?
>
> Is it something we can now wholeheartedly recommend that server
> operators and single players can use, or is it believed-working-
> but-experimental, or is what's in 2.5 just an intermediate step to a
> long-term goal and not yet ready for play?

 Experimental intermediate step, I guess. No "real" game has been run
even with that implementation - we started one, but had to switch AIs
to classic mid-game for reasons since fixed. We'll retry in next game,
but that will not even begin in many months.

> <http://www.freeciv.org/wiki/Coding> claims the release target for
> threaded AI is "3.0 and beyond", which supports the last interpretation.
>
> If it's usable, I'm a bit surprised at the lack of pain. I'd have
> thought the AI needs access to all sorts of data structures and that by
> now I'd have been impacted by locking being needed in the bits of the
> codebase that I frequent. I know we've now got some basic facilities
> like MUTEXED_LIST_ITERATE but I was expecting stuff to be sprinkled all
> over the code, new coding guidelines, etc.

 It's probably more pain than you're aware of, and that's why it's
going forward so slowly - it's hard to find any part that can be
improved in this regard without rewriting most of the freeciv code at
once.

> Has it had autogame testing?

 Yes, one of my regularly run autogames has threaded ais created.



 - ML

_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to