patchFreeciv - Patches: patch #3768, [RFC] client side lua script for...

Show feedback again

patch #3768: [RFC] client side lua script for unit actions

Submitted by:  Matthias Pfafferodt <syntron>
Submitted on:  Fri Mar 1 20:58:04 2013  
Votes:  10  
Category: clientPriority: 3 - Low
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Planned Release: Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Fri Mar 1 20:58:04 2013, original submission:

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 message).

- 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 side

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, ...)

Matthias Pfafferodt <syntron>
Project Member


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by gorb (Voted in favor of this item)
  • -unavailable- added by syntron (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 10 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat Mar 2 07:46:05 2013gorbCarbon-Copy-=>Added gorb
    Fri Mar 1 20:58:24 2013syntronSummary[RFC]=>[RFC] client side lua script for unit actions
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup