SoC2012 Tyrannodogg Make lua AI developement easier

From The Battle for Wesnoth Wiki
Revision as of 19:35, 29 April 2012 by Tyrannodogg (talk | contribs) (Questionnaire)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This page is related to Summer of Code 2012
See the list of Summer of Code 2012 Ideas



This is a Summer of Code 2012 student page



Description

Tyrannodogg - Make lua AI development and usage easier

At the moment the parts, which make a lua AI, are scattered around several WML Entities, resulting in a load of boilerplate code.

My approach is to shift more parts of the functionality into lua code, in a way that simple scripts can handle all steps necessary.

This includes wrapping the current default AI for lua usage.

I will also provide scripts for logging and further debugging.


IRC

Tyrannodogg,tyrannodogg

SoC Application

Submitted to google

gna.org

tyrannodogg

In order to get familiar with the codebase i am working on the following patch: https://gna.org/patch/?3240

Further explanation

In the end I'd like to have a luaAI look like the following example and have at least the described capabilities or similar ones

  [ai]
  engine = "lua"
  code = <<
  -- make all print calls chat messages instead
  require("wesnoth_debug.chatting_ai")
  --could also be default_ai.no_actions
  ai = require("default_ai.all_actions")
  
  --add a new action
  ai.beserk = {}
  function ai.beserk.evaluation() return 50000 end
  ai.beserk.execution = require("my_clever_script")
  
  --delete a action
  ai.ca_villages=nil
  
  --modify an action
  local move_eval = ai.ca_move.evaluation
  function ai.ca_move.evaluation(...) 
      --make move less important
      local result = move_eval(...)
      return result / 2
  end
  
  --for a whole new ai approach even the main loop may be interchangeable
  ai:register_main_loop(require("default_ai.default_main_loop"))
  >>
  [/ai]
This page was last edited on 29 April 2012, at 19:35.