EggPlant AI ramblings
Re: EggPlant AI ramblings
Vault is game mode agnostic - it's just a way of storing objects (game objects and/or custom objects) and then accessing them with a jquery-like syntax. I'm making it compatible with a wide range of events and API features, so it should be usable in the campaign.
One of the reasons I started doing my own docu of the JS API is that I wanted to be sure I fully understood every nook and cranny of what the API currently provides, how it works, etc. Luckily Per has been very patient with my n00bish questions, of which there have been many, and I've got a great deal of detail on many of the API features - all of which have gone in to my documentation.
There's still a lot of campaign / tutorial specific API elements that I don't fully understand (and that don't make much sense to me yet as I'm thinking from an AI developer perspective). Any help/examples/etc. on these functions would be most useful:
* _() - I know what it does, but don't have any examples of it
* add/removeReticuleButton() - what are the valid values for "button type" param?
* applyLimitSet() - any examples of this in use?
* gameOverMessage() - any examples of this?
* hackNetOff/On() - no idea what these really do
* label() - any examples of this? how do I know what labels are present on a map?
* loadLevel() - any examples of this?
* playSound() - any examples of this? specifically how do I state where the sound file is? and where should sound files live?
* setDesign() - any examples of scenarios where this would be used?
* setMiniMap() - any examples of scenarios where this would be used?
* setMissionTime() - any examples of this?
* setNoGoArea() - any examples of this?
* setReinforcementTime() - any examples of this, and what scenarios would it be used in?
* setScrollParams() - not got any examples of this yet, but should be able to do this one on my own
* setStructureLimits() - any examples of this?
* setTutorialMode() - what exactly does this do? (it's not clear form JS API PDF)
Aside from those functions, I've documented everything else (constants, globals, functions, objects, events) in the JS API with detailed parameter guides, examples, etc. And then all that info is getting fed in to the VAULT library.
One of the reasons I started doing my own docu of the JS API is that I wanted to be sure I fully understood every nook and cranny of what the API currently provides, how it works, etc. Luckily Per has been very patient with my n00bish questions, of which there have been many, and I've got a great deal of detail on many of the API features - all of which have gone in to my documentation.
There's still a lot of campaign / tutorial specific API elements that I don't fully understand (and that don't make much sense to me yet as I'm thinking from an AI developer perspective). Any help/examples/etc. on these functions would be most useful:
* _() - I know what it does, but don't have any examples of it
* add/removeReticuleButton() - what are the valid values for "button type" param?
* applyLimitSet() - any examples of this in use?
* gameOverMessage() - any examples of this?
* hackNetOff/On() - no idea what these really do
* label() - any examples of this? how do I know what labels are present on a map?
* loadLevel() - any examples of this?
* playSound() - any examples of this? specifically how do I state where the sound file is? and where should sound files live?
* setDesign() - any examples of scenarios where this would be used?
* setMiniMap() - any examples of scenarios where this would be used?
* setMissionTime() - any examples of this?
* setNoGoArea() - any examples of this?
* setReinforcementTime() - any examples of this, and what scenarios would it be used in?
* setScrollParams() - not got any examples of this yet, but should be able to do this one on my own
* setStructureLimits() - any examples of this?
* setTutorialMode() - what exactly does this do? (it's not clear form JS API PDF)
Aside from those functions, I've documented everything else (constants, globals, functions, objects, events) in the JS API with detailed parameter guides, examples, etc. And then all that info is getting fed in to the VAULT library.
Last edited by aubergine on 09 Feb 2012, 20:14, edited 2 times in total.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: EggPlant AI ramblings
That could be good, fresh view is good idea, to replace weird codepaths of wzscript.aubergine wrote:There's still a lot of campaign / tutorial specific API elements that I don't fully understand (and that don't make much sense to me yet as I'm thinking from an AI developer perspective).
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
-
cybersphinx
- Inactive

- Posts: 1695
- Joined: 01 Sep 2006, 19:17
Re: EggPlant AI ramblings
To translate strings the user sees, like the tutorial messages. As long as you don't reuse strings already in the game/your script is included and so translated I guess you can ignore it.aubergine wrote:* _() - I know what it does, but don't have any examples of it
MANUFACTURE, RESEARCH, INTELMAP, DESIGN, BUILD, OPTIONS* add/removeReticuleButton() - what are the valid values for "button type" param?
You give it a filename of an ogg file somewhere in/below [data/base]/audio, looks like subdirectories don't matter.* playSound() - any examples of this? specifically how do I state where the sound file is? and where should sound files live?
https://github.com/Warzone2100/warzone2 ... t/rules.js* setDesign() - any examples of scenarios where this would be used?
* setMiniMap() - any examples of scenarios where this would be used?
It makes the game annoying. Disables saving, enables toggling the reticule buttons with the above functions.* setTutorialMode() - what exactly does this do? (it's not clear form JS API PDF)
We want information... information... information.
Re: EggPlant AI ramblings
>> MANUFACTURE, RESEARCH, INTELMAP, DESIGN, BUILD, OPTIONS
Are those exposed by the JS API yet? I've not seen them mentioned anywhere and on a cursory glance I couldn't see them defined in the qtscriptfuncs/etc .cpp files in master branch.
Also, what does OPTIONS refer to? The middle button or something else? Is there a constant for the Commanders button?
Are those exposed by the JS API yet? I've not seen them mentioned anywhere and on a cursory glance I couldn't see them defined in the qtscriptfuncs/etc .cpp files in master branch.
Also, what does OPTIONS refer to? The middle button or something else? Is there a constant for the Commanders button?
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
-
cybersphinx
- Inactive

- Posts: 1695
- Joined: 01 Sep 2006, 19:17
Re: EggPlant AI ramblings
https://github.com/Warzone2100/warzone2 ... .cpp#L2060 says OPTIONS is an alias for COMMAND, and there's also CANCEL for the middle button.aubergine wrote:>> MANUFACTURE, RESEARCH, INTELMAP, DESIGN, BUILD, OPTIONS
Are those exposed by the JS API yet? I've not seen them mentioned anywhere and on a cursory glance I couldn't see them defined in the qtscriptfuncs/etc .cpp files in master branch.
Also, what does OPTIONS refer to? The middle button or something else? Is there a constant for the Commanders button?
We want information... information... information.
Re: EggPlant AI ramblings
The campaign-related functions are poorly documented because I have not yet looked closely at what goes on beneath the upper crust of that code. These functions are also highly likely to change without much notice.
Note that if you use most campaign-related functions in AI code and it is used in multiplayer, it will cause a desync. I will try to fix / document these limitations as I start working more on the campaign side of things.
Note that if you use most campaign-related functions in AI code and it is used in multiplayer, it will cause a desync. I will try to fix / document these limitations as I start working more on the campaign side of things.
Re: EggPlant AI ramblings
Per, maybe there should be Campaign object or kind of prefix for them (at least capital letters warning in docs)?
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
Re: EggPlant AI ramblings
Warning in docs would suffice for now.
I don't think the JS API should focus too much on it's structure at the moment, let's just get the functions out there and documented, then once we can see the bigger picture we can start thinking about if and how to rearrange the API.
I don't think the JS API should focus too much on it's structure at the moment, let's just get the functions out there and documented, then once we can see the bigger picture we can start thinking about if and how to rearrange the API.
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: EggPlant AI ramblings
aubergine, yeah, I think the same, but only if developers will decide to cleanup.aubergine wrote:then once we can see the bigger picture we can start thinking about if and how to rearrange the API.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
Re: EggPlant AI ramblings
@Emdek - I think the whole point of the JS API is to start the cleanup process, compared to WZScript it's already a big step in the right direction. The clean-up will likely be a longer term iterative process, as I imagine work is needed in a great many areas.
For example, I'm currently wading through the tech tree and I'm finding lots of useless links between techs that, if removed, would make the tech tree *much* more readable without affecting it in any way.
It's the main reason I'm putting so much effort in to investigating every fine detail of the game that my AI will rely on and documenting it all as I progress. Lots of little oddities are being unearthed, it's somewhat like a forensic investigation in to WZ
For example, I'm currently wading through the tech tree and I'm finding lots of useless links between techs that, if removed, would make the tech tree *much* more readable without affecting it in any way.
It's the main reason I'm putting so much effort in to investigating every fine detail of the game that my AI will rely on and documenting it all as I progress. Lots of little oddities are being unearthed, it's somewhat like a forensic investigation in to WZ
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: EggPlant AI ramblings
Sure, this is really big step itself, but I'm perfectionist, I like things done as good as possible. 
And I've seen some projects which created APIs which become outdated / bloated after some time (for various reasons), and they later redo them from scratch (or are planning it currently).
So, I would like to see WZ JS API modularized, using prefixes or global objects, allowing to do much more that wzscript could and in much simpler way. On top of that there is place for projects as yours, maybe even fully or partially integrated into main "bundle" later.
And I've seen some projects which created APIs which become outdated / bloated after some time (for various reasons), and they later redo them from scratch (or are planning it currently).
So, I would like to see WZ JS API modularized, using prefixes or global objects, allowing to do much more that wzscript could and in much simpler way. On top of that there is place for projects as yours, maybe even fully or partially integrated into main "bundle" later.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
Re: EggPlant AI ramblings
Until the API matures, I don't think its productive to take that next step though. We don't know what the API will look like in future, so trying to modularise it now will actually make future improvements harder, not easier.
I think for now any modularisation attempts need to live in javascript land, because they are quick to prototype, try and refine, compared to rebuilding WZ source code for every little change.
Don't mistake activity for productivity
I think for now any modularisation attempts need to live in javascript land, because they are quick to prototype, try and refine, compared to rebuilding WZ source code for every little change.
Don't mistake activity for productivity
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO
Re: EggPlant AI ramblings
Well, actually gluing game API to JS (expose it) is not so hard, but for sure takes some time (not only planning phase).
And if there are things that clearly should live in own namespace (like for example API to access UI widgets, about which I'm currently thinking, but not as short term thing) then they should live there from start. So these could be cleanly done in separate branch without affecting others in any way.
And if there are things that clearly should live in own namespace (like for example API to access UI widgets, about which I'm currently thinking, but not as short term thing) then they should live there from start. So these could be cleanly done in separate branch without affecting others in any way.
Nadszedł już czas, najwyższy czas, nienawiść zniszczyć w sobie.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
The time has come, the high time, to destroy hatred in oneself.
Beware! Mad Qt Evangelist.
- milo christiansen
- Regular

- Posts: 749
- Joined: 02 Jun 2009, 21:23
- Location: Perrinton Michigan
Re: EggPlant AI ramblings
label()
I'm guessing it returns null or undefined if the label is non-existent but that's just a guess
I've been thinking about making functionality that depends on the existence of a switch label, something like "FooSupported" that then tells the script to look for labels like "FooActionArea" and act on the encoded information.
My initial proof-of-concept would/will probably be a treaty period set on a per-map basis that destroys units that leave the base area using the labels "TreatyPeriodSupported" and "BaseAreaX" where X is the player number. Just an idea
In any case labels will be invaluable for map specific information of which campaigns require a great deal.
One cool use would be for a multiplayer AI to look for occurrences of "BuildFortressHere_X" (with X being a index from 0) and use it as a hint to build heavy defenses on that spot. It would be kind of like a gateway but nicer to place in an open area or other spot that should be defended but wouldn't make sense to have a gateway.
I'm guessing it returns null or undefined if the label is non-existent but that's just a guess
I've been thinking about making functionality that depends on the existence of a switch label, something like "FooSupported" that then tells the script to look for labels like "FooActionArea" and act on the encoded information.
My initial proof-of-concept would/will probably be a treaty period set on a per-map basis that destroys units that leave the base area using the labels "TreatyPeriodSupported" and "BaseAreaX" where X is the player number. Just an idea
In any case labels will be invaluable for map specific information of which campaigns require a great deal.
One cool use would be for a multiplayer AI to look for occurrences of "BuildFortressHere_X" (with X being a index from 0) and use it as a hint to build heavy defenses on that spot. It would be kind of like a gateway but nicer to place in an open area or other spot that should be defended but wouldn't make sense to have a gateway.
In general, if you see glowing, pulsating things in the game, you should click on them.
- Demigod Game Ganual
- Demigod Game Ganual
Re: EggPlant AI ramblings
it would be very useful if there was a way to enumerate a list of labels, or if there was some agreed naming conventions for them. currently from an AI script I have no idea what labels might exist on a map and without trying lots of random things there's not much I can do with them
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
-- https://warzone.atlassian.net/wiki/display/GO

