Re: [Freeciv-Dev] [PATCH] Agent calls are never equal if they are to different agents

2009-06-17 Thread Bernd Jendrissek
On Wed, Jun 17, 2009 at 5:35 AM, Madeline Bookmadeline.b...@gmail.com wrote:
 For cma in particular: it is slow (no CPU computation should take
 longer than a second; the algorithm does not scale), inefficient (too
 much client-server communication making it unwieldy in online
 games), does not adapt well to non-default game rules (the ugly
 cross-dependence of common/ files and untested behavior for other
 rulesets), and fails to accomodate even basic game situations that
 occur again and again (no way to prevent greedy tile grabbing, no
 way to fix tile usage, recomputation right at the very moment when
 client needs to be responsive, etc., etc.).

I'm not sure that the _start_ of the turn is the right time to run the
CMA.  So many times I've forgotten to check all my cities after
founding my 14th, and the next turn all hell breaks loose, because the
CMA never had the opportunity to fix the civ-size unhappiness.  I'd
rather pretend I didn't just consider multithreading.

I'm not too fussed about problems with other agents though; really
only with agents-in-general.

 (I mention in passing that the entire attribute system should be
 removed, and probably would have been long ago, were it not for
 the single annoying dependence of the cma on it.)

Would you suggest that client-side code should rather keep state in a
section file?  (Or even in .civclientrc itself.)  If all goes to plan
I'll want to remember things like The Georgians have stabbed me in
the back 7 times, but the Sami have always been there to help me.
Things that cannot, even in principle, be calculated from the game
state.

 Every potential agent implementation must consider whether it fails
 in the above mentioned respects at least.

Oh, my agent will almost certainly fail here.  Epic fail.

 In general there is also the
 question whether client side automation afforded by agents is even
 desirable for freeciv, as then it may degenerate in to battle of computer
 programs rather than players.

FWIW I'm working for the machines to hasten this battle of computer
programs to defeat the humans.  I just want to see how credible a
client-side AI I can make.  (Apropos, I seem to recall someone else
having gone this way, but I can't find the announcement.  Anybody else
remember who / better search terms?)

But I do understand: as a human player I also dislike the idea of
twitch-like AI reaction times.

 For example in the case of the city worker twiddling problem that
 cma tries to alleviate (player does not have to micro-manage citizens,
 in theory), one should also consider fixing the design of the game
 itself. That is, instead of throwing AI at the game problem, consider
 finding and proposing better game mechanics that would not suffer
 the same player annoyances.

Some of the proposals I've seen would also make it easier for an AI to
accurately value a site for building a city.  I'm finding it hard to
analyze even how I choose places myself.

 Then there is the current problem of agent implementations almost
 always requiring to keep track of some form of state between
 activations, but the design of freeciv packets makes this quite
 cumbersome at best (cf. the request id hacks used by cma). In brief,
 there is poor support for stateful client side programming (other
 parts of freeciv suffer from this too, and I have a solution in mind,
 but have not yet had time to make a test implementation).

This reminds me of another obstacle to easy agent programming: by the
time the agent gets its callback, the entity causing the event might
be gone.  This manifested in a segfault when my unit-changed callback
tried to print a killed unit's name.

What is the intellectual status quo in freeciv regarding reference
counting things like units, cities (tiles don't die)?  I'd like it if
the client-side unit/city objects hung around a little bit longer, at
least until the agents are done using them.

I can also foresee problems in trying to correlate consequences with
actions.  My agent will eventually have to know that a particular
unit-changed callback relates to a dsend_packet_unit_move() that it
issued earlier.

 Finally I would just like to mention lua as a much better candidate
 for work than the agents framework. Extending and implementing
 all non-resource intensive code in a lua engine would do wonders
 for AI programming, both on the server and the client side. At
 least so my dream goes, assuming that the lua integration is done
 right. ;)

I like the idea of a scripting language hooked in, but for my code I
think it might suck.  I have to compensate for my Artificial Stupidity
with zillions of CPU cycles.  If my AS ever has to wait for a human
player, it isn't doing enough number crunching!

Thanks for your comprehensive reply.

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


Re: [Freeciv-Dev] [PATCH] Agent calls are never equal if they are to different agents

2009-06-17 Thread Michael Kaufman
Just to throw in a couple cents here... I don't fundamentally disagree with
what Per is saying here, but I don't think that it's all gloom and doom.
Take AI government choice for example. To make the 'correct' choice of a
government, a server-side AI can actually change the government, recompute
all the cities and check against other choices. A client-side AI can't do
that, or at least can't do that in a way which loads down the server (and a
client-side AI is what we're talking about here).

The CMA on the other hand can load down the server (if I recall; it's been
awhile) because the client can keep asking for cma_results from the server
to see if they're ok to do. Perhaps throttling these requests is a
solution.

I wholeheartedly agree that generalized rulesets have made it hard on AI,
and doing a lot of the heavy-lifting pregame, after the rulesets have been
received by the client, but before the game begins is probably the only way
to go without your supercomputer.  Despite this, humans can do pretty well
with the amount of game state that the server sends their clients, so I
expect that client-side AI can do the same with just as much information
and more attention to detail.

-mike

On Wed, Jun 17, 2009 at 06:55:08PM +0200, Per Inge Mathisen wrote:
 Just to echo what was said earlier - the idea of client side agents is
 fundamentally a bad one because it requires too much information to be
 kept and sent to the clients. Only on the server can you access the
 amount of game state required for such agents without running head
 first into race conditions and then deadlocks when try to fix that
 because data has to be distributed over the network link and goes out
 of sync. It took CMA a very long time and a lot of work to reach its
 present state of stability. And CMA only does city tile management.
 
 I have also changed my mind about the desirability of a computational
 game AI. The amounts of CPU time required to compute best outcomes
 increases in such a dramatic fashion when the game rules are
 generalized, that it is simply not worth it. Good rules of thumb that
 can be written as AI scripts specifically for each ruleset will be
 faster, easier to write and maintain, and (therefore) probably even
 lead to better outcomes. This was not an easy conclusion for me to
 reach, because I spent a lot of time on the current computational AI.
 Hindsight is nice.
 
 If you want to throw computations at Freeciv AI problems, I recommend
 writing a program that analyses a ruleset then generating script rules
 that can be used later for a game AI. That way you can use as many CPU
 cycles as you want without anyone complaining.
 
   - Per
 
 ___
 Freeciv-dev mailing list
 Freeciv-dev@gna.org
 https://mail.gna.org/listinfo/freeciv-dev

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


Re: [Freeciv-Dev] [PATCH] Agent calls are never equal if they are to different agents

2009-06-16 Thread Madeline Book
On 15/06/2009, Bernd Jendrissek bernd.jendris...@gmail.com wrote:
 On Tue, Jun 9, 2009 at 3:44 AM, Madeline Bookmadeline.b...@gmail.com
 wrote:
 You should know that the agents framework suffers from
 a number of design problems and has not been actively
 maintained by anyone in a long time, the original author
 no longer begin involved in freeciv development and nobody
 else really interested in learning how it should work or how
 to fix it and make use of it.

 Could you elaborate please?  I haven't been subscribed in a few years
 so I'm not up-to-date with current memes.  You don't need to do my
 homework for me; I'm just looking for *what* to look for.  Design
 problems worries me, if I'm going to be depending on agent callbacks.

For cma in particular: it is slow (no CPU computation should take
longer than a second; the algorithm does not scale), inefficient (too
much client-server communication making it unwieldy in online
games), does not adapt well to non-default game rules (the ugly
cross-dependence of common/ files and untested behavior for other
rulesets), and fails to accomodate even basic game situations that
occur again and again (no way to prevent greedy tile grabbing, no
way to fix tile usage, recomputation right at the very moment when
client needs to be responsive, etc., etc.).

(I mention in passing that the entire attribute system should be
removed, and probably would have been long ago, were it not for
the single annoying dependence of the cma on it.)

Every potential agent implementation must consider whether it fails
in the above mentioned respects at least. In general there is also the
question whether client side automation afforded by agents is even
desirable for freeciv, as then it may degenerate in to battle of computer
programs rather than players.

For example in the case of the city worker twiddling problem that
cma tries to alleviate (player does not have to micro-manage citizens,
in theory), one should also consider fixing the design of the game
itself. That is, instead of throwing AI at the game problem, consider
finding and proposing better game mechanics that would not suffer
the same player annoyances.

Then there is the current problem of agent implementations almost
always requiring to keep track of some form of state between
activations, but the design of freeciv packets makes this quite
cumbersome at best (cf. the request id hacks used by cma). In brief,
there is poor support for stateful client side programming (other
parts of freeciv suffer from this too, and I have a solution in mind,
but have not yet had time to make a test implementation).

Finally I would just like to mention lua as a much better candidate
for work than the agents framework. Extending and implementing
all non-resource intensive code in a lua engine would do wonders
for AI programming, both on the server and the client side. At
least so my dream goes, assuming that the lua integration is done
right. ;)


All that said, if you are some programming wizard and have already
made some significant improvements to the agents system and
implemented some useful features, feel free to post your patches
for possible inclusion in the development version; at least we would
have something more fruitful and concrete to discuss rather than
past mistakes and vague generalities.



何かがモニターのピクセルを一つずつ食べてしまう。

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


Re: [Freeciv-Dev] [PATCH] Agent calls are never equal if they are to different agents

2009-06-15 Thread Bernd Jendrissek
On Tue, Jun 9, 2009 at 3:44 AM, Madeline Bookmadeline.b...@gmail.com wrote:
 You should know that the agents framework suffers from
 a number of design problems and has not been actively
 maintained by anyone in a long time, the original author
 no longer begin involved in freeciv development and nobody
 else really interested in learning how it should work or how
 to fix it and make use of it.

Could you elaborate please?  I haven't been subscribed in a few years
so I'm not up-to-date with current memes.  You don't need to do my
homework for me; I'm just looking for *what* to look for.  Design
problems worries me, if I'm going to be depending on agent callbacks.

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


Re: [Freeciv-Dev] [PATCH] Agent calls are never equal if they are to different agents

2009-06-08 Thread Madeline Book
On 08/06/2009, Bernd Jendrissek bernd.jendris...@gmail.com wrote:

 While trying to add an agent, I've found this patch necessary.  This is
 against 2.1.9, as I have nothing closer to HEAD available.

Your patch looks alright, as far as I can tell and as far as I
know about the intended behaviour of calls_are_equal()
(should it care if the agent serving the calls is different?).

Well, except for false which should be FALSE.

You should know that the agents framework suffers from
a number of design problems and has not been actively
maintained by anyone in a long time, the original author
no longer begin involved in freeciv development and nobody
else really interested in learning how it should work or how
to fix it and make use of it.

 BTW, does anyone maintain a (read-only) git mirror?  SVN just isn't an
 option for me.

I seem to be the only maintainer using git, and I would second
a notion to setup a git mirror. Maybe I will at repo.or.cz, if I feel
like it later. In the meantime I just use git-svn and I suggest you
do the same (I know it is kind of a pain to setup).

By the way, submit your patches to the new bug tracker:
https://gna.org/bugs/?func=additemgroup=freeciv



私はガス状惑星で生まれたんだよ。

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