Follow-up Comment #2, patch #1432 (project wesnoth):

>  "Instead of calling the compiler each time the snippet is executed, this
approach requires it to be a global symbol, that is, a precompiled
function."
Yes, performance matters and I will rework the code to avoid recompilation on
each access. I think that I'll use 'precompiled functions' approach. How can I
garbage collect these ? (e.g. if a candidate action is changed by [modify_ai]
each turn, I no longer need to keep old precompiled code around)

>The ai_execute_move function seems to have a rather complicated interface.
This interface will be simplified, but I've kept implementation as simple as
possible for my 1st proof-of-concept check.

> I guess that, most of the times, a unit will consume its movement points,
so it should be "!keep_movement" rather than "remove_movement". 
'remove_movement=true' means 'set MP to 0 after move' and it's  just a way to
say 'i'm done with movement of this unit'. if it's false, normal MP
consumption happens (unit's MP is reduced outside of the ai, by game engine).
You think that for such boolean-parameters-which-come-last, 'false' is a
better default than 'true' ? This can be changed ai-wide (stopunit_action
being similar).

> Also, the "side" argument is quite redundant; it has to be the side of the
unit at location "from", doesn't it?'
'side' is the current side. This is not a problem, because later it will be
taken from 'context' and be hidden from the lua ai developer (as the ai is
supposed to know which side it is). It is kinda redundant for movement and
attack, as we can only move own units and attack with our own units, but it
is always a first argument of ai actions, for consistency - some other ai
actions need it.

> 'Also, it would make sense to allow to pass the unit directly rather than
its coordinates; see intf_find_path for an example of how it is done.'
Yes, it might be better.

>"But, in fact, I'm not even sure to understand why one would need an
ai_execute_move function. Don't we expect the move chosen by the "evaluate"
part to be performed in the "execute" part? I don't see why the AI is allowed
to move a completely unrelated unit."
If the candidate action is selected for execution, it is allowed to do any
amount of actions, related or not. For example, 'movement and targeting
phase' generally comes last in priority, and in evaluate it only checks for
unit with MP>0 available. and in execute it actually does the moves
one-by-one until all good moves are done or until something unexpected
happens. Also, in [stage], we can write any amount of unrelated actions, if
we want.

Thanks,

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1432>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to