1 |
Widgets are pieces of lua code which can be run locally on your machine, you don't have to distribute the AI code to use it against people when you are playing. Each player has some set of widgets running on their machine, a lot of widgets come with ZK by default and the ones which are enabled by default make up the default UI.
|
1 |
Widgets are pieces of lua code which can be run locally on your machine, you don't have to distribute the AI code to use it against people when you are playing. Each player has some set of widgets running on their machine, a lot of widgets come with ZK by default and the ones which are enabled by default make up the default UI.
|
2 |
\n
|
2 |
\n
|
3 |
Each widget has access to basically all the information that players have and they can give arbitrary order to your own units. In effect widgets can see and do anything a player could so any sort of AI could be written as a widget. If you write an AI this way it will be a 'helper AI' which is in the game alongside you and only controls your units. So you could program any unit. You should probably start here.
|
3 |
Each widget has access to basically all the information that players have and they can give arbitrary order to your own units. In effect widgets can see and do anything a player could so any sort of AI could be written as a widget. If you write an AI this way it will be a 'helper AI' which is in the game alongside you and only controls your units. So you could program any unit. You should probably start here.
|
4 |
\n
|
4 |
\n
|
5 |
Here are some examples of widget which implement some behaviour.
|
5 |
Here are some examples of widget which implement some behaviour.
|
6 |
http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/LuaUI/Widgets/unit_stockpile.lua
|
6 |
http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/LuaUI/Widgets/unit_stockpile.lua
|
7 |
http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/LuaUI/Widgets/unit_shield_guard.lua
|
7 |
http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/LuaUI/Widgets/unit_shield_guard.lua
|
8 |
The first widget is a simple widget demonstrating their structure. It automatically queues some stockpile for newly produced units as we assume that when you make something with stockpile you made it to use the stockpile. The second widget is a bit more complicated, it implement some AI for mobile shields which causes them to slow down and wait for units which are following it.
|
8 |
The first widget is a simple widget demonstrating their structure. It automatically queues some stockpile for newly produced units as we assume that when you make something with stockpile you made it to use the stockpile. The second widget is a bit more complicated, it implement some AI for mobile shields which causes them to slow down and wait for units which are following it.
|
9 |
The whole widgets folder is here found here
|
9 |
The whole widgets folder is here found here
|
10 |
http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/LuaUI/Widgets
|
10 |
http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/LuaUI/Widgets
|
11 |
that is a good source of examples. To get it in a more readable form you should do an svn checkout.
|
11 |
that is a good source of examples. To get it in a more readable form you should do an svn checkout.
|
12 |
\n
|
12 |
\n
|
13 |
I'm going to go with "widgets are not considered cheating".
|
13 |
I'm going to go with "widgets are not considered cheating".
|
14 |
\n
|
14 |
\n
|
15 |
CAI is a lua gadget. This means that it runs on every machine during a game (so has no latency issues) and it can control an AI team. If you want to play against your AI locally you should make a lua AI. It is reasonably straighforwards to turn a widget AI into a gadget AI which anyone can then play against. Gadget AIs require the game to be modified so I think you should start with widgets and see how you go.
|
15 |
CAI is a lua gadget. This means that it runs on every machine during a game (so has no latency issues) and it can control an AI team. If you want to play against your AI locally you should make a lua AI. It is reasonably straighforwards to turn a widget AI into a gadget AI which anyone can then play against. Gadget AIs require the game to be modified so I think you should start with widgets and see how you go.
|
16 |
\n
|
16 |
\n
|
17 |
|
17 |
I
don't
think
there
is
that
much
to
be
gained
by
messing
with
the
CAI
configs.
CAI
itself
needs
extension
if
it
is
to
be
improved.
|
18 |
\n
|
|
|
19 |
\n
|
|
|