3.2 JS API Wishlist :)
Re: 3.2 JS API Wishlist :)
Expose player mp ranking to scripts
I noticed that there were some bug fixes with player mp ranks...
Could human player ranking stats be exposed to scripts via player objects in playerData?
.unitsKilled
.gamesPlayed
.gamesWon
Also, human player .difficulty could be set based on win ratio:
EASY: <4 games (pacifier)
MEDIUM: silver chevron
HARD: double chevron
INSANE: gold star
This info would allow AIs to better adapt to their human counterparts. For example, if an AI sees their opponent is a n00b in sp skirmish it could break them in gently. When deciding who to ally with in dynamic ally games, the AI could choose to favour strongest players.
And store AI mp stats?
Also, would there be any merit in storing AI script rankings? Based on the name of the .ai file, keep track of .unitsKilled, .gamesPlayed, .gamesWon. The .difficulty would still be defined by user or .ini as part of game setup, but this would at least let different AIs get some idea about the capabilites of other AIs installed. (the documentation would note that in mp games the AI stats are coming from the host player's local AIs)
How to offer/accept/decline alliance?
In dynamic alliances mode, how does an AI offer an alliance? And how does an AI player get notified about an offer and accept or decline it?
offerAlliance(toPlayer[, fromPlayer]) // fromPlayer defaults to 'me'
eventAllianceOffered(fromPlayer)
replyAllianceOffer(fromPlayer, choice) // choice = true to accept, false to decline
Note: I know we now have setAlliance() which is a very useful function and should be retained, but it doesn't seem to specifically deal with accepting or rejecting an alliance offer in dynamic alliances mode, hence the need for replyAllianceOffer() in addition to setAlliance()
I noticed that there were some bug fixes with player mp ranks...
Could human player ranking stats be exposed to scripts via player objects in playerData?
.unitsKilled
.gamesPlayed
.gamesWon
Also, human player .difficulty could be set based on win ratio:
EASY: <4 games (pacifier)
MEDIUM: silver chevron
HARD: double chevron
INSANE: gold star
This info would allow AIs to better adapt to their human counterparts. For example, if an AI sees their opponent is a n00b in sp skirmish it could break them in gently. When deciding who to ally with in dynamic ally games, the AI could choose to favour strongest players.
And store AI mp stats?
Also, would there be any merit in storing AI script rankings? Based on the name of the .ai file, keep track of .unitsKilled, .gamesPlayed, .gamesWon. The .difficulty would still be defined by user or .ini as part of game setup, but this would at least let different AIs get some idea about the capabilites of other AIs installed. (the documentation would note that in mp games the AI stats are coming from the host player's local AIs)
How to offer/accept/decline alliance?
In dynamic alliances mode, how does an AI offer an alliance? And how does an AI player get notified about an offer and accept or decline it?
offerAlliance(toPlayer[, fromPlayer]) // fromPlayer defaults to 'me'
eventAllianceOffered(fromPlayer)
replyAllianceOffer(fromPlayer, choice) // choice = true to accept, false to decline
Note: I know we now have setAlliance() which is a very useful function and should be retained, but it doesn't seem to specifically deal with accepting or rejecting an alliance offer in dynamic alliances mode, hence the need for replyAllianceOffer() in addition to setAlliance()
"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 :)
fireWeaponAtLoc() and fireWeaponAtObj()
I've been looking at some old .vlo and .slo scripts and noticed this intriguing function, and wonder if it can be exposed to JS API?
That taken from NTW where they'd implemented mines and used a radar blip to show the mine location to player that owned the mine. (Now at least I know where these strange things came from!)
I imagine there are all sorts of weapon effects already in existence. I'd love the ability to play around with doing such effects on the map to see what I can come up with.
With the mouse events described here, and knowing if a unit is selected, I bet I could recreate the a rough version of the mines mod (mainly for experimentation and learning purposes, I'm not sure mines would add much to the game).
Also, I noticed the fireWeaponAtLoc() was also used in the mod that implemented a nuclear reactor so that if there weren't enough cooling towers linked to it the reactor would catch fire or even explode. That would be another interesting thing to investigate. I know that in Contingency there are already some attempts to create alternate power sources.
The fireWeaponAtLoc() could possibly be used to implement different explosion effects for existing buildings (and even droids?) during eventDestroyed()... Lots of possibilities!
EDIT: Just noticed fireWeaponAtObj(weapon, obj) as well
I've been looking at some old .vlo and .slo scripts and noticed this intriguing function, and wonder if it can be exposed to JS API?
Code: Select all
fireWeaponAtLoc(Blip, mine.x, mine.y);
I imagine there are all sorts of weapon effects already in existence. I'd love the ability to play around with doing such effects on the map to see what I can come up with.
With the mouse events described here, and knowing if a unit is selected, I bet I could recreate the a rough version of the mines mod (mainly for experimentation and learning purposes, I'm not sure mines would add much to the game).
Also, I noticed the fireWeaponAtLoc() was also used in the mod that implemented a nuclear reactor so that if there weren't enough cooling towers linked to it the reactor would catch fire or even explode. That would be another interesting thing to investigate. I know that in Contingency there are already some attempts to create alternate power sources.
The fireWeaponAtLoc() could possibly be used to implement different explosion effects for existing buildings (and even droids?) during eventDestroyed()... Lots of possibilities!
EDIT: Just noticed fireWeaponAtObj(weapon, obj) as well
"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 :)
Perhaps there should be an eventAllianceReplied(fromPlayer, choice) in addition to those? It would trigger if an alliance is accepted or declined. I assume that replyAllianceOffer() is a function that tells an AI to accept or decline an alliance with another player, right?aubergine wrote:In dynamic alliances mode, how does an AI offer an alliance? And how does an AI player get notified about an offer and accept or decline it?
offerAlliance(toPlayer[, fromPlayer]) // fromPlayer defaults to 'me'
eventAllianceOffered(fromPlayer)
replyAllianceOffer(fromPlayer, choice) // choice = true to accept, false to decline
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 :)
@Shadow: A more generic eventAllianceChange(playerA, playerB, state) event would be better - triggered whenever an alliance is created or broken between two players. This would allow scripts to act swiftly, without the need for the script to constantly keep polling allianceExistsBetween() for all player combinations.
And yes, replyAllianceOffer() allows an AI to accept an ally offer.
Example workflow:
1. Human offers ally to an AI via intel screen by clicking
2. eventAllianceOffered(fromPlayer) triggered to let AI know it has an open offer
3. Script decides whether to accept, and then uses replyAllianceOffer(fromPlayer, choice) to send response to player:
choice == true
choice == false
Note: I assume this does something in the UI to let the player who made the offer know whether their offer was accepted or not. Hence needing the replyAllianceOffer() rather than just using setAlliance().
Alternatively, the AI can be the one that initiates the offer, using offerAlliance(toPlayer[, fromPlayer]), the equivalent of the AI pressing on the intel screen.
And yes, replyAllianceOffer() allows an AI to accept an ally offer.
Example workflow:
1. Human offers ally to an AI via intel screen by clicking
2. eventAllianceOffered(fromPlayer) triggered to let AI know it has an open offer
3. Script decides whether to accept, and then uses replyAllianceOffer(fromPlayer, choice) to send response to player:
choice == true
choice == false
Note: I assume this does something in the UI to let the player who made the offer know whether their offer was accepted or not. Hence needing the replyAllianceOffer() rather than just using setAlliance().
Alternatively, the AI can be the one that initiates the offer, using offerAlliance(toPlayer[, fromPlayer]), the equivalent of the AI pressing on the intel screen.
"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
- garantiertnicht
- Greenhorn
- Posts: 13
- Joined: 16 Sep 2010, 18:44
- Location: Deutschland (Germany)
Re: 3.2 JS API Wishlist :)
I'm wish a more dynamical Aliance too (as described by you ).
I have some other suggestion:
Please set a new global (like 'me' for the script player) wish gives the Host/Game leader of a Multiplayer or Skirmish game.
This could may good for Administration for the AI. Some AI makers try to make some commands that could make changes on the AI's personality. In this Case some if case where good to make sure that not every Player change the state.
Some Quote from viewtopic.php?f=49&t=8826
garantiertnicht
PS: Sorry for my bad english.
I have some other suggestion:
Please set a new global (like 'me' for the script player) wish gives the Host/Game leader of a Multiplayer or Skirmish game.
This could may good for Administration for the AI. Some AI makers try to make some commands that could make changes on the AI's personality. In this Case some if case where good to make sure that not every Player change the state.
Some Quote from viewtopic.php?f=49&t=8826
I hope this will be possible and some developer have some interest to code and compile it.!nb set
Tell this to set NullBot's subpersonality. For instance, "!nb set mc" sets him to machineguns-cannons. Simply say "!nb set" to see a list of possible personalities. Should be supported by the NullBot personality to work.
!nb res
Tell this to set NullBot's research paths. For instance, "!nb res mg" makes him prioritize machinegun research. Simply say "!nb res" to see a list of possible research path commands. Say !nb res 0 to make him stop researching completely. Say !nb res clear to make him proceed.
garantiertnicht
PS: Sorry for my bad english.
Last edited by garantiertnicht on 15 Jan 2013, 16:43, edited 1 time in total.
Player Name: "garantiertnichtDE"
You can talk to me DEUTSCH.
You can talk to me DEUTSCH.
Re: 3.2 JS API Wishlist :)
@garantiertnicht: The game host, in every game mode, is always player 0.
I'm already working on something like you suggest, where the AI will make additional commands available to game host, and also send reports to game host. However, it will only do this in WZ 3.2 where I can confirm that it's a single-player game (in multiplayer, having AI do that stuff would be far too much like cheating). My AI, EggPlant, won't be released any time soon though.
In NullBot, only your allies will respond to commands, and any human player can issue the commands to their allied NullBots.
I'm already working on something like you suggest, where the AI will make additional commands available to game host, and also send reports to game host. However, it will only do this in WZ 3.2 where I can confirm that it's a single-player game (in multiplayer, having AI do that stuff would be far too much like cheating). My AI, EggPlant, won't be released any time soon though.
In NullBot, only your allies will respond to commands, and any human player can issue the commands to their allied NullBots.
"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
- garantiertnicht
- Greenhorn
- Posts: 13
- Joined: 16 Sep 2010, 18:44
- Location: Deutschland (Germany)
Re: 3.2 JS API Wishlist :)
Oh. I thought if the Player moves to an difficult location (move to another Base) this is the Player-Number, but If you say i'll believe you .
Then waiting. (I don't code anythink that i don't can test now, so I must.) But in some Months are the ability, that first Alpha will be coming . The releases of 3.1 came all 3 months, but a new Version may need some more ideas and time.
I thank all developers that work(ed) on this game and will work on it in future.
Then waiting. (I don't code anythink that i don't can test now, so I must.) But in some Months are the ability, that first Alpha will be coming . The releases of 3.1 came all 3 months, but a new Version may need some more ideas and time.
I thank all developers that work(ed) on this game and will work on it in future.
Player Name: "garantiertnichtDE"
You can talk to me DEUTSCH.
You can talk to me DEUTSCH.
- Shadow Wolf TJC
- Regular
- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: 3.2 JS API Wishlist :)
I noticed that there was an eventSelectionChange() function being developed for 3.2, so I thought that the following events would go well with it:
eventOrderGiven(player,order,droids): Triggers whenever a player gives a new order to an array of droids.
eventOrderGivenLoc(player,order,droids,x,y): Triggers whenever a player orders an array of droids to do something at the target coordinates.
eventOrderGivenObj(player,order,droids,target): Triggers whenever a player orders an array of droids to do something to the target (such as attacking or defending it).
eventOrderGivenBuild(player,order,droids,structure): Triggers whenever a player orders an array of droids to build a structure.
From the top of my head, I'd imagine that this could be used to define custom voice sets for units, as seen in games like Command & Conquer, WarCraft, and StarCraft to name a few.
Speaking of, I was wondering if playSound() could optionally be made unthrottled, or add sounds to more than 1 queue? I'd like for the SitRep to not only remain throttled, but to take priority over, and not be interrupted by, unit chatter.
Oh, and one more idea that's related to this bunch:
eventGroupSelected(group): Triggers whenever groups 0-9 are selected. Would allow us to unhardcode and port group selection sound code to rules.js.
eventOrderGiven(player,order,droids): Triggers whenever a player gives a new order to an array of droids.
eventOrderGivenLoc(player,order,droids,x,y): Triggers whenever a player orders an array of droids to do something at the target coordinates.
eventOrderGivenObj(player,order,droids,target): Triggers whenever a player orders an array of droids to do something to the target (such as attacking or defending it).
eventOrderGivenBuild(player,order,droids,structure): Triggers whenever a player orders an array of droids to build a structure.
From the top of my head, I'd imagine that this could be used to define custom voice sets for units, as seen in games like Command & Conquer, WarCraft, and StarCraft to name a few.
Speaking of, I was wondering if playSound() could optionally be made unthrottled, or add sounds to more than 1 queue? I'd like for the SitRep to not only remain throttled, but to take priority over, and not be interrupted by, unit chatter.
Oh, and one more idea that's related to this bunch:
eventGroupSelected(group): Triggers whenever groups 0-9 are selected. Would allow us to unhardcode and port group selection sound code to rules.js.
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 :)
I'd change those events somewhat...
Instead of eventOrderGiven() / evnetOrderGivenLoc() / evnetOrderGivenObj() / eventOrderGivenBuild(), what about eventOrder(objects, order[, target[, info]])?
* 'objects' is array of objects that were given the order (even if only one object was given the order)
* 'order' is a DORDER constant
* 'target' is either a POSITION, DROID, STRUCTURE or FEATURE object, or null if not applicable (eg. orderDroid() function doesn't have target)
* 'info' is any other applicable info, mainly in the case of orderDroidBuild(), you want to know what the droid(s) are told to build (ie. which structure).
Also, it's not just droids that can be given orders - the LAS_SAT can be ordered to attack something (via activateStructure() function).
Anyway, knowing when orders are given would mean that we could do custom sit rep and all sorts of other cool stuff. It would also allow most of the Tutorial to be ported to JS (as currently there are many missing events for that task).
I'd personally prefer to keep playSound() as it is, so it queues the sounds. For ambient sounds, it would be nice to have a soundEffect() function, basically the same as playSound() but non-blocking. Multiple sound effects could be played at the same time (not that we'd intend to do that, it's just something that will happen from time to time), even while playSound() audio is being played.
As for groupSelected, it's not required IMHO - eventSelectionChange() tells you when units are being selected, so if you select a group eventSelectionChange() will fire already. Also, groups in the JS API are separate from the groups humans use - JS API can't see human groups, only script groups (and even then only its own).
Instead of eventOrderGiven() / evnetOrderGivenLoc() / evnetOrderGivenObj() / eventOrderGivenBuild(), what about eventOrder(objects, order[, target[, info]])?
* 'objects' is array of objects that were given the order (even if only one object was given the order)
* 'order' is a DORDER constant
* 'target' is either a POSITION, DROID, STRUCTURE or FEATURE object, or null if not applicable (eg. orderDroid() function doesn't have target)
* 'info' is any other applicable info, mainly in the case of orderDroidBuild(), you want to know what the droid(s) are told to build (ie. which structure).
Also, it's not just droids that can be given orders - the LAS_SAT can be ordered to attack something (via activateStructure() function).
Anyway, knowing when orders are given would mean that we could do custom sit rep and all sorts of other cool stuff. It would also allow most of the Tutorial to be ported to JS (as currently there are many missing events for that task).
I'd personally prefer to keep playSound() as it is, so it queues the sounds. For ambient sounds, it would be nice to have a soundEffect() function, basically the same as playSound() but non-blocking. Multiple sound effects could be played at the same time (not that we'd intend to do that, it's just something that will happen from time to time), even while playSound() audio is being played.
As for groupSelected, it's not required IMHO - eventSelectionChange() tells you when units are being selected, so if you select a group eventSelectionChange() will fire already. Also, groups in the JS API are separate from the groups humans use - JS API can't see human groups, only script groups (and even then only its own).
"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 :)
Return game object for addDroid(), addStructure() and addFeature()
IMPLEMENTED: See Per's comment later in this topic.
IMPLEMENTED: See Per's comment later in this topic.
Last edited by aubergine on 16 Jan 2013, 19:03, edited 1 time 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
- Shadow Wolf TJC
- Regular
- Posts: 1047
- Joined: 16 Apr 2011, 05:12
- Location: Raleigh, NC
Re: 3.2 JS API Wishlist :)
I mentioned it in case a player used the 0-9 hotkeys to select a group of units instead of a selection box.aubergine wrote:As for groupSelected, it's not required IMHO - eventSelectionChange() tells you when units are being selected, so if you select a group eventSelectionChange() will fire already. Also, groups in the JS API are separate from the groups humans use - JS API can't see human groups, only script groups (and even then only its own).
Come to think of it, I may want to suggest the addition of an eventSelectionAdd() in case a player added an individual droid to the list of selected droids (using shift+click was it?).
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 :)
Why not just use enumSelected()?
Actually, both eventSelectionChange() and enumSelected() return the same array - a list of all selected objects.
Are you specifically looking to know what was just added or removed from the selection, or is having a list of all selected things sufficient?
Actually, both eventSelectionChange() and enumSelected() return the same array - a list of all selected objects.
Are you specifically looking to know what was just added or removed from the selection, or is having a list of all selected things sufficient?
"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 :)
removeTimer() -- allow it to be more specific
Currently removeTimer() kills all timers and queued calls associated with the named function.
Would it be possible to add an extra param, so that only calls associated with the function that have that 'object' or 'string' will be killed?
removeTimer(name[, filter]); // note: don't throw an error if not found
For example:
Same sort of thing would happen if I passed in a game object as second parameter to removeTimer() -- only timers to the stated function with that game obj as data would be removed.
This would be massively helpful, it's the last barrier to being able to have just a single handler function for multiple timers.
Because the 'filter' param is optional, this change would be backwards compatible
Currently removeTimer() kills all timers and queued calls associated with the named function.
Would it be possible to add an extra param, so that only calls associated with the function that have that 'object' or 'string' will be killed?
removeTimer(name[, filter]); // note: don't throw an error if not found
For example:
Code: Select all
queue("foo", 500, "fish");
queue("foo", 600, "nostril");
queue("foo", 600, "maromoset");
removeTimer("foo", "nostril"); // only the 'nostril' one is removed
removeTimer("foo"); // all others ('fish' and 'marmoset') are removed
This would be massively helpful, it's the last barrier to being able to have just a single handler function for multiple timers.
Because the 'filter' param is optional, this change would be backwards compatible
"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 :)
addFeature() already returns the created game object. I'll fix the others.
The droidType parameter is still necessary for addDroid() (but not for buildDroid, just to make it all more interesting...).
The droidType parameter is still necessary for addDroid() (but not for buildDroid, just to make it all more interesting...).
Re: 3.2 JS API Wishlist :)
Can we add something like that? I already tested that in my scripts, seems to work (:
- Attachments
-
- propulsionCanReach.patch
- (2.29 KiB) Downloaded 382 times
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam