Difference between revisions of "SoC Ideas Lua AI"
m (→Description) |
(fix heading level) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
{{Template:SoC2010Idea}} | {{Template:SoC2010Idea}} | ||
− | =Description= | + | ==Description== |
<h2>Extend Wesnoth Lua AI Support</h2> | <h2>Extend Wesnoth Lua AI Support</h2> | ||
+ | Page for the idea: [[SoC_Ideas_Lua_AI]] | ||
+ | |||
Lua AI support was recently added to wesnoth. Expose c++ AI support functions that Wesnoth has, to Lua. | Lua AI support was recently added to wesnoth. Expose c++ AI support functions that Wesnoth has, to Lua. | ||
{{#dpl: | {{#dpl: | ||
− | |resultsheader=''There are %PAGES% student proposals for this idea'' | + | |resultsheader=''There are %PAGES% submitted student proposals for this idea'' |
+ | |oneresultheader=''There is 1 submitted student proposal for this idea'' | ||
+ | |notcategory=SoC 2010 Not Submitted To Google | ||
+ | |suppresserrors=true | ||
+ | |noresultsheader=''There are no submitted student proposals for this idea'' | ||
|category=Summer of Code 2010 Student Page&SoC Ideas Lua AI | |category=Summer of Code 2010 Student Page&SoC Ideas Lua AI | ||
|include=#Description | |include=#Description | ||
Line 12: | Line 18: | ||
}} | }} | ||
− | =Additional information= | + | ==Additional information== |
It is very important for Wesnoth to have a way of scripting AI without modifying the c++ source code. Some time ago, it was possible to use Python to code AIs, but it was removed due to security issues. Now, we're adding Lua as a new way to script AI. The core capabilities were already added, but we need to integrate Lua AI scripts better. | It is very important for Wesnoth to have a way of scripting AI without modifying the c++ source code. Some time ago, it was possible to use Python to code AIs, but it was removed due to security issues. Now, we're adding Lua as a new way to script AI. The core capabilities were already added, but we need to integrate Lua AI scripts better. | ||
Wesnoth AI consists of different components. each component is a c++ object, which provides an interface to allow the ai to delegate part of the turn sequence to that c++ object. but, that c++ object can be a proxy for code written in different language, such as formula_ai or lua. So, we have a lua engine - a c++ class which is responsible with creating c++ proxies for lua code snippets. this lua engine must provide access to all the information that the c++ AI knows - caches like 'attacks' and 'possible moves', values of aspects such as 'aggression' and 'caution', etc. So, there's a large number of AI support functions which we need to expose to lua code. | Wesnoth AI consists of different components. each component is a c++ object, which provides an interface to allow the ai to delegate part of the turn sequence to that c++ object. but, that c++ object can be a proxy for code written in different language, such as formula_ai or lua. So, we have a lua engine - a c++ class which is responsible with creating c++ proxies for lua code snippets. this lua engine must provide access to all the information that the c++ AI knows - caches like 'attacks' and 'possible moves', values of aspects such as 'aggression' and 'caution', etc. So, there's a large number of AI support functions which we need to expose to lua code. | ||
− | =Implementation plan= | + | ==Implementation plan== |
To quote from Alpha Centauri, "Technological advance is an inherently iterative process. One does not simply take sand from the beach and produce a Dataprobe. We use crude tools to fashion better tools, and then our better tools to fashion more precise tools, and so on. Each minor refinement is a step in the process, and all of the steps must be taken. ". | To quote from Alpha Centauri, "Technological advance is an inherently iterative process. One does not simply take sand from the beach and produce a Dataprobe. We use crude tools to fashion better tools, and then our better tools to fashion more precise tools, and so on. Each minor refinement is a step in the process, and all of the steps must be taken. ". | ||
* So, we firstly want to expose existing c++ things to lua. | * So, we firstly want to expose existing c++ things to lua. | ||
Line 26: | Line 32: | ||
* then, we want to make sure that multiple ais can coordinate between themselves, and stick to a certain strategy in battle,as determined by situation and whims of scenario creator | * then, we want to make sure that multiple ais can coordinate between themselves, and stick to a certain strategy in battle,as determined by situation and whims of scenario creator | ||
− | =Useful links= | + | ==Useful links== |
* [[Customizing_AI_in_Wesnoth_1.8]] | * [[Customizing_AI_in_Wesnoth_1.8]] | ||
Line 33: | Line 39: | ||
* [[LuaWML]] | * [[LuaWML]] | ||
− | =Definition of Done= | + | ==Definition of Done== |
all information that is possible to use in c++ AI, is possible to use in Lua AI with relatively same level of complexity for AI author. | all information that is possible to use in c++ AI, is possible to use in Lua AI with relatively same level of complexity for AI author. | ||
− | =Whom to ask about this= | + | ==Whom to ask about this== |
Ask Crab_ on #wesnoth-dev | Ask Crab_ on #wesnoth-dev | ||
− | =Possible pre-gsoc tasks= | + | ==Possible pre-gsoc tasks== |
We want to make it easy to write Lua AI. the best way to ensure that is to try to write some AI components, and see what's easy, what's hard, and what's missing. So, here are a few things that can be done to get you started and to allow to code some useful lua/c++ code which can be included in wesnoth lua ai standard library. | We want to make it easy to write Lua AI. the best way to ensure that is to try to write some AI components, and see what's easy, what's hard, and what's missing. So, here are a few things that can be done to get you started and to allow to code some useful lua/c++ code which can be included in wesnoth lua ai standard library. | ||
Latest revision as of 16:09, 17 April 2023
This page is related to Summer of Code 2010 |
See the list of Summer of Code 2010 Ideas |
This is a Summer of Code 2010 Idea |
Contents
Description
Extend Wesnoth Lua AI Support
Page for the idea: SoC_Ideas_Lua_AI
Lua AI support was recently added to wesnoth. Expose c++ AI support functions that Wesnoth has, to Lua.
There are 4 submitted student proposals for this idea
xxx - Extend Wesnoth Lua AI Support
I would like to make a simple but efficient interface in which Lua scripts can be easily integrated/edited/removed from the existing C++ core AI system, without effecting existing code. This would allow me to code the AI scripts faster and allow other developers to continue the modification of the AI system later as well.
See SummerOfCodeProposal Achilles Lua for more information.
Darkas - Extend Wesnoth Lua AI Support and write a "defend" AI
The first part of the proposal is described at SoC_Ideas_Lua_AI. So if the AI is exposed to lua and works, the AI should get 2 more features: defend effectively (shield wounded units, line up to get less attacks if there are more enemies, etc.), and decide when it's time to defend (this is per unit, so if there's a group of units that gets attacked, they'll be defenders now, but other unit may remain attacker). If that's done, the AI should also be able to do some missions better, if they should protect something for example, then they'll defend this special place or unit, instead of attacking the others and hoping they won't get there.
See SummerOfCodeProposal Darkas for more information.
Luca Moller - Make the c++ AI functions avaiable through the lua engine
Working with lua and C++ bindings and with the already existing core functions, the idea of the project is to expose the remaining AI functions avaiable in C++. Everything that can be seen by the AI through C++ should also be seen by an AI implemented through a lua script. The final result would also include higher level AI functions to make it easier to scenario developers to set how they want the units in the scenario to act.
See SummerOfCodeProposal LucaMoller for more information.
Truongan - extend wesnoth lua ai support
Extend Wesnoth Lua AI Support
See SummerOfCodeProposal Truongan for more information.
Additional information
It is very important for Wesnoth to have a way of scripting AI without modifying the c++ source code. Some time ago, it was possible to use Python to code AIs, but it was removed due to security issues. Now, we're adding Lua as a new way to script AI. The core capabilities were already added, but we need to integrate Lua AI scripts better.
Wesnoth AI consists of different components. each component is a c++ object, which provides an interface to allow the ai to delegate part of the turn sequence to that c++ object. but, that c++ object can be a proxy for code written in different language, such as formula_ai or lua. So, we have a lua engine - a c++ class which is responsible with creating c++ proxies for lua code snippets. this lua engine must provide access to all the information that the c++ AI knows - caches like 'attacks' and 'possible moves', values of aspects such as 'aggression' and 'caution', etc. So, there's a large number of AI support functions which we need to expose to lua code.
Implementation plan
To quote from Alpha Centauri, "Technological advance is an inherently iterative process. One does not simply take sand from the beach and produce a Dataprobe. We use crude tools to fashion better tools, and then our better tools to fashion more precise tools, and so on. Each minor refinement is a step in the process, and all of the steps must be taken. ".
- So, we firstly want to expose existing c++ things to lua.
- Then, we want to build a lua-based 'wesnoth lua ai standard library', a library of functions useful to ai developer.
- Then, we want to build a library of high-level functions which will be directly usable by scenario developer, with the level of complexity like 'drop this 1-line macro here, set this unit variable there, and voila - the unit is now controlled by lua ai according to your wishes'
- example of such behavior are 'patrol', 'retreat', and 'guard' behaviors
- then, we want to improve the ai directly, areas like recruiting with multiple leaders, actually defending something, handling concepts like leadership,skirmish, illuminate, and other, even, created-from-WML, concepts
- then, we want to make sure that multiple ais can coordinate between themselves, and stick to a certain strategy in battle,as determined by situation and whims of scenario creator
Useful links
Definition of Done
all information that is possible to use in c++ AI, is possible to use in Lua AI with relatively same level of complexity for AI author.
Whom to ask about this
Ask Crab_ on #wesnoth-dev
Possible pre-gsoc tasks
We want to make it easy to write Lua AI. the best way to ensure that is to try to write some AI components, and see what's easy, what's hard, and what's missing. So, here are a few things that can be done to get you started and to allow to code some useful lua/c++ code which can be included in wesnoth lua ai standard library.
- Write the AI which can complete Scenario 1 of the Heir to the Throne campaign on easy difficulty.
- Write the AI which can complete Scenario 1 of Legend of Wesmere campaign on easy difficulty.
- Write the AI which can complete Scenario 1 of The Hammer of Thursagan campaign on easy difficulty.
- Write a recruitment procedure for the AI which uses with multiple leaders intelligently
- Write a system to attach 'behavior instructions written in lua' to specific units
- Write a patrol formula in Lua
- Write a basic attack routine in Lua, make it possible to inject the 'rate attack combination' function into it.
- Re-implement useful formula ai functions in lua.