Javascript API documentation
Re: Javascript API documentation
Another ponder for the "WZ is the browser" concept: localStorage and sessionStorage objects.
* localStorage = stuff that will persist between games, eg. so an AI can store it's understanding of a human player
* sessionStorage = stuff that will persist for the session (game) eg. go in to the saved game file
* localStorage = stuff that will persist between games, eg. so an AI can store it's understanding of a human player
* sessionStorage = stuff that will persist for the session (game) eg. go in to the saved game file
"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: Javascript API documentation
I think what you want is http://developer.qt.nokia.com/doc/qt-4. ... cript.html.aubergine wrote:Also, out of interest, do you know what JS version (or ECMA-262 Edition) is used in WZ? (or what JS engine, eg. SpiderMonkey, Rhino, etc)
From my current dabbling it seems like Rhino or SpiderMonkey - eg. __proto__ exposed to JS scripts (which is awesome!)
You are on a mac right? Because the mac versions currently us the qt frameworks from version 4.7.2.
User:dak180
Keeper of the Mac Builds
Keeper of the Mac Builds
Re: Javascript API documentation
Qt currently uses the SquirrelFish engine from Webkit (made by Apple). Qt5 will use the v8 engine (made by Google), so we will probably change to that when we switch to Qt5 (one day... do not hold your breath).
As to the way game objects were implemented, this was a fundamental design decision that was made very early in the process. There are advantages and disadvantages to both methods (getters/setters vs snapshots). While you can in theory keep state more easily up to date with getters/setters, in practice this is very difficult, since the actual state underneath is more often than not merely queued up for sync and done later. You also need a lot more code to implement the same things. Snapshots keep the underlying code and concepts very simple. The snapshots are also in no way a "doubling the RAM usage" of the internal data, as the snapshot representation is far simpler. The initial cost of making a snapshot list is more expensive than making an initial list in a getter/setter approach, but access into that list is far cheaper.
As to the way game objects were implemented, this was a fundamental design decision that was made very early in the process. There are advantages and disadvantages to both methods (getters/setters vs snapshots). While you can in theory keep state more easily up to date with getters/setters, in practice this is very difficult, since the actual state underneath is more often than not merely queued up for sync and done later. You also need a lot more code to implement the same things. Snapshots keep the underlying code and concepts very simple. The snapshots are also in no way a "doubling the RAM usage" of the internal data, as the snapshot representation is far simpler. The initial cost of making a snapshot list is more expensive than making an initial list in a getter/setter approach, but access into that list is far cheaper.
Re: Javascript API documentation
Ok, one last thing. How are we supposed to use the laser satellite?
Once this is solved, i'll be satisfied enough to release a fully functionan "nullbot" version (:
Once this is solved, i'll be satisfied enough to release a fully functionan "nullbot" version (:
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
- lav_coyote25
- Professional

- Posts: 3434
- Joined: 08 Aug 2006, 23:18
Re: Javascript API documentation
well, i read somewhere it was not all that great, damaged electronics on the ground prevented it from being used as it was meant to be used. if i had my way, 1 shot per hour or two. very expensive research and time wise, make it unappetizing to use. just going by the game play.NoQ wrote:Ok, one last thing. How are we supposed to use the laser satellite?
Once this is solved, i'll be satisfied enough to release a fully functionan "nullbot" version (:
Re: Javascript API documentation
Then I better get on it!NoQ wrote:Ok, one last thing. How are we supposed to use the laser satellite?
Once this is solved, i'll be satisfied enough to release a fully functionan "nullbot" version (:
New event added: eventStructureReady(structure), for now it only triggers for the lassat being fully charged. It only triggers once, so if not ready, keep a timer to check for new opportunities.
New function added: activateStructure(structure, target), for now it only fires the lassat.
Re: Javascript API documentation
Does Nexus AI get selected automatically if no AI is specified in the challenge ini file? Is it possible to use old-style slo/vlo AIs for challenges?Per wrote:I've added the ability to add scripts to challenges now.
Also, i'm having a problem. I created the following ini file:
Code: Select all
[challenge]
Name = "Startup [Semperfi]"
Difficulty = "Medium"
Map = "Sk-Startup"
MaxPlayers = 2
Scavengers = false
Bases = 2
Power = 700
Description = "Defeat the Semperfi."
[player_1]
team = 1
[player_2]
name = "Enemy"
team = 2
difficulty = "Insane"
position = 1
ai = semperfi.js
Code: Select all
info |03:37:42: [openLoadFile] file semperfi.js could not be opened: File not found
info |03:37:42: [openLoadFile] Assert in Warzone: frame.cpp:166 (!"unable to open file"), last script event: '<none>'
error |03:37:42: [loadPlayerScript] Failed to read script file "semperfi.js"Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
Yes, Nexus is default. No, there is no way to specify any other non-javascript AI.
Your problem is due to a change made after I initially announced the feature. You need to provide a path to the AI. In this case, you should write "multiplay/skirmish/semperfi.js" (iirc). This allows you to distribute AI files along with the challenge, if you wish.
Your problem is due to a change made after I initially announced the feature. You need to provide a path to the AI. In this case, you should write "multiplay/skirmish/semperfi.js" (iirc). This allows you to distribute AI files along with the challenge, if you wish.
Re: Javascript API documentation
Thanks, it helped (:
Hmm, but the difficulty setting still doesn't work, even in the built-in challenges.
Hmm, but the difficulty setting still doesn't work, even in the built-in challenges.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
Right. Fixed.NoQ wrote:Hmm, but the difficulty setting still doesn't work, even in the built-in challenges.
Re: Javascript API documentation
Ok, so how do i make the AI react on chat messages and beacons (and also produce some)? All those "help me!!!", "bug off", etc (:
Also, i tried the challenges with custom AIs again, and i have a feeling that two AIs at once are running for the player for which an external AI is specified.
Also, i tried the challenges with custom AIs again, and i have a feeling that two AIs at once are running for the player for which an external AI is specified.
Maps | Tower Defense | NullBot AI | More NullBot AI | Scavs | More Scavs | Tilesets | Walkthrough | JSCam
Re: Javascript API documentation
What stattype is the Laser Satellite building?
"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: Javascript API documentation
Would structured clone algorithm be useful for persisting variables in savegame?
"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: Javascript API documentation
DEFENSE - for no good reason, other than this is what it is in the C++ code. I could change it into some special type when passing it to javascript...aubergine wrote:What stattype is the Laser Satellite building?


