Imhotep writes:
> Marko Lindqvist wrote:
>> As of 2.4 there *is* client side scripting support - or at least
>> framework for it. I still have found no time to properly test it
>> myself, but it's said to be quite limited at the moment.
> 
> Would it take much time for you to present us (me!) some kind of
> "hello world"-like script example,
> something like "take this unit and move it one tile to the north"?
> (With a hint on how to make it go.)

That's the thing -- the client-side scripting has no way to affect the
game world at the moment; that's its major limitation.
<http://www.freeciv.org/wiki/NEWS-2.4.0> sums it up:

| * (Gtk) The client now has a Lua scripting console. GNAPATCH#2515
| 
|   - This is currently something of a proof of concept rather than a
|     finished feature, as a comprehensive API suitable for the
|     client-side has not been provided. Notably, there are not yet any
|     signals from which client-side scripts can be triggered.
| 
|   - However, client scripts do have access to the client's view of
|     most of the same game data that server-side ruleset scripts do
|     (map, units, cities etc); see the Lua reference manual[*]. This
|     should be sufficient for some useful work. For example, it should
|     in principle be possible to implement an on-demand optimal trade
|     route calculator with these facilities (although we haven't
|     tried). 

[*] <http://www.freeciv.org/wiki/Lua_reference_manual>

David Lowe writes:
> That's an interesting idea, but i don't know who would have the time
> and talent to submit such a patch.  In order to be truly useful, it
> would have to enable the given unit to do almost anything the player
> could tell it to do - and prevent the script from having the unit do
> things the player couldn't tell it to do.  It seems like that would
> require lots of hooks to accomplish all that.

Permissions won't be a problem -- we already don't trust the client, so
a client-side script won't be able to do anything the player can't.

But, yes, there is a fair amount of work required to define the actions
for client-side scripting to affect the game world. They can't all be
straight copies of the server methods (e.g. 'edit' module), because the
client doesn't get instant feedback; e.g. on the server,
edit.unit_move() returns whether the unit died; on the client, it will
merely trigger the dispatch of a network packet requesting that the unit
move, and in the natural implementation, when that returns to the script
we won't know if the move was even allowed; if the script wants to know
what happened to the unit it will have to watch for a signal triggered
by news of the unit's fate from the server (and in any case can't know
for sure that e.g. the unit's death was triggered by the script's
action). So client-side scripts are going to have to be written in a
much more open-loop style.

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

Reply via email to