3.2 JS API Wishlist :)
- Shadow Wolf TJC
- Regular
- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: 3.2 JS API Wishlist :)
Although I was originally thinking that an AI designer could use pickStructLocation() twice to return two different position objects for the same structure rotated differently (with one not rotated, and the other rotated 90 degrees), and then pick whichever position is closest to the desired location, adding a direction parameter to the position object that pickStructLocation() returns may work better.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Re: 3.2 JS API Wishlist :)
It would be nice if we could say which way we want the building facing - eg. to make all buildings face nearest enemy or the player start position, etc.
So perhaps an optional direction param on pickStructLocation() to indicate the preferred direction and, as Per suggests, pickStructLocation() returns an additional .direction property in it's position object indicating what direction the building should be built in.
So perhaps an optional direction param on pickStructLocation() to indicate the preferred direction and, as Per suggests, pickStructLocation() returns an additional .direction property in it's position object indicating what direction the building should be built in.
"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
- Shadow Wolf TJC
- Regular
- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: 3.2 JS API Wishlist :)
Could we add a .target property for droid objects, so that we could find out which object they're ordered to attack or protect, or where they're ordered to move or build at (in the form of a position object)? Also, could we add a .construct property to droids to find out what they're ordered to build at said target location (that could return null if absent, or if no such build order is given)?
By the way, while I'm willing to bet that we can't change existing object properties directly, are we allowed to give game objects (such as droid, structure, feature, player, or position objects) custom properties, like, say, the aforementioned .target and .construct properties?
By the way, while I'm willing to bet that we can't change existing object properties directly, are we allowed to give game objects (such as droid, structure, feature, player, or position objects) custom properties, like, say, the aforementioned .target and .construct properties?
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Re: 3.2 JS API Wishlist :)
+1 for .target property
For construct droids, could the .target not be a fake structure object? We can see from their order that they are going to construct something, and then look at .target fake struct obj to see what/where they are constructing.
@Shadow: You can add any properties you want to the game objects, but they will be transient and only exist so long as you have a reference to that specific instance of the game object. The properties won't be stored by the JS API, so next time you do an enumDroid() for example, you'll get vanilla objects back. It's better to just build arrays or hashmaps to keep track of additional properties.
For construct droids, could the .target not be a fake structure object? We can see from their order that they are going to construct something, and then look at .target fake struct obj to see what/where they are constructing.
@Shadow: You can add any properties you want to the game objects, but they will be transient and only exist so long as you have a reference to that specific instance of the game object. The properties won't be stored by the JS API, so next time you do an enumDroid() for example, you'll get vanilla objects back. It's better to just build arrays or hashmaps to keep track of additional properties.
"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: 3.2 JS API Wishlist :)
enumGroup() -- allow a sensor/command droid as argument
There is currently no way to ask WZ which droids are assigned to a command or sensor droid.
If enumGroup() could take a command/sensor droid as it's parameter and return a list of droids attached to that droid, it would be most useful.
The object could also be a sensor structure, eg. if arty droids have been assigned to a stationary CB tower, or VTOLs to a strike tower, etc.
This would not apply to transporters, as their 'cargo' is not on the battle field, hence the separate approach to dealing with cargo (already implemented in 3.2).
There is currently no way to ask WZ which droids are assigned to a command or sensor droid.
If enumGroup() could take a command/sensor droid as it's parameter and return a list of droids attached to that droid, it would be most useful.
Code: Select all
var list = enumGroup( < groupID | object > );
This would not apply to transporters, as their 'cargo' is not on the battle field, hence the separate approach to dealing with cargo (already implemented in 3.2).
"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
- Shadow Wolf TJC
- Regular
- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: 3.2 JS API Wishlist :)
Say, could eventAttacked() be changed to trigger whenever ANY player's units or structures come under attack? I know that we'd then have to specify who the attacked object's controller is, but it would allow me to add in some code to rules.js that could inform the player when an ally's units or structures come under attack.
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Re: 3.2 JS API Wishlist :)
Use hackChangeMe() to set the player ID to -1 for your script, then events should receive notifications from all players not just the player the script was originally associated with.
"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
- Shadow Wolf TJC
- Regular
- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: 3.2 JS API Wishlist :)
What is hackChangeMe()? It's currently not documented on your wiki. Is it only available on version 3.2?
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Re: 3.2 JS API Wishlist :)
Not to disparage the excellent wiki, but you know there is an official doc for the javascript API, right? It is documented there.Shadow Wolf TJC wrote:What is hackChangeMe()? It's currently not documented on your wiki. Is it only available on version 3.2?
http://buildbot.wz2100.net/files/javasc ... cript.html
(And yes, it is 3.2 only.)
Re: 3.2 JS API Wishlist :)
I wasn't sure how long the hackChangeMe() function is going to be around for so not documented that one yet. Always refer to the official docs linked by Per if in doubt.
"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
- Shadow Wolf TJC
- Regular
- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: 3.2 JS API Wishlist :)
I was never aware that such a thing existed. Thanks.Per wrote:Not to disparage the excellent wiki, but you know there is an official doc for the javascript API, right? It is documented there.Shadow Wolf TJC wrote:What is hackChangeMe()? It's currently not documented on your wiki. Is it only available on version 3.2?
http://buildbot.wz2100.net/files/javasc ... cript.html
(And yes, it is 3.2 only.)
Edit: Perhaps droid objects, and maybe structure objects as well, could be given a new .target property, which is the object (either a game object or a position object) that the droid or structure is supposed to perform its order on (such as attack this, repair this, move to this position, etc.). Note that this isn't necessarily the same as what its weapons are currently targeting (since droids could be shooting nearby enemies while they're ordered to move or scout to a particular position).
Creator of Warzone 2100: Contingency!
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Founder of Wikizone 2100: http://wikizone2100.wikia.com/wiki/Wikizone_2100
Re: 3.2 JS API Wishlist :)
Is it possible to add some code coverage for javascript?
http://addons.wz2100.net/ developer
Re: 3.2 JS API Wishlist :)
Hmm. We're still not having API to support "Allow Alliances" mode. That is, to make an AI offer alliance, break alliance, or detect an alliance offer from other player.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: 3.2 JS API Wishlist :)
Since we have zero unit tests for the javascript code, surely it would be easy to calculate a 0% code coverage for it? (Or am I misunderstanding the question?)Duha wrote:Is it possible to add some code coverage for javascript?
I think that is pretty much a waste of time. You cannot have dynamic alliances without diplomacy, and if there is anything an AI useless at, then it is diplomacy. I spent a lot of time trying to write a good diplomacy AI for another game once... It will either be abused horribly by players or it will be annoyingly paranoid. Either way it won't be fun.NoQ wrote:Hmm. We're still not having API to support "Allow Alliances" mode. That is, to make an AI offer alliance, break alliance, or detect an alliance offer from other player.
Re: 3.2 JS API Wishlist :)
Hmm. I'd report if i come up with any "better than nothing" pseudo code.It will either be abused horribly by players or it will be annoyingly paranoid.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam