Summary: [RFC]
                 Project: Freeciv
            Submitted by: syntron
            Submitted on: Fri 01 Mar 2013 09:58:04 PM CET
                Category: client
                Priority: 3 - Low
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 



In bug #20489 the possibilities of client side lua script is discussed (auto
exploring). I through about this. Given the current state I could image the
following algorithm:

- for each unit there is the possibility to assign a lua script controlling
the unit. It could be accessed / changed via a keyboard shortcut which in turn
proposes possible lua functions in the client lua script. The script name is
saved in the unit structure (first only in the client)

- after turn change the client iterates over all units and, if a lua script is
set, executes it with option 'turn change'. This would execute _one_ command
for the unit (i.e. go left)

- if the unit data changes due to a server response, the client calls the lua
script again at the end of the handling of the server data (in the example
with option 'moved'). If move points are left, the next command can be
requested by the lua script.

- on a later step, the lua function could be send to the server at the time it
is set. Thus, it could be saved if the game is saved and restored on game load
(if the lua function is still available; else there should be an error

- within the client lua environment, the function could save data about the
job for the unit. But this information would be lost if the client is closed.
Thus, a small data packet (32 byte?) could be allowed to be transferred to the
server to save some data in the savegame (i.e the current job of the unit or
the goto tile)

- using this things like exploring or connect by road could be done on client

For this to work, several things are to be done:

- lua functions to request all possible (simple) (player) commands for a unit
(move, settler actions, ...)

- hocks back to the lua code at the end of all possible unit action send by
the server (wakeup, moved, successful attack, ...)


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to