Other great resources: Official JS API docs, Scripting Forum
Useful Links
- Aubergine
Official JS API guide
The JS API guide that's provided by the development team is generated from comments in the game's source code. While it's more basic than the guide you'll find on this site, it will usually be more up-to-date so it's worth checking from time to time:
- Online docs either: single page or linked series of pages – this will always contain the very latest documentation from the developers (updated every night)
- Javascript API discussion – this is where it all started, and there's lots of useful info here
I've compiled some information about how the JS API has changed over time that you may find useful: Compatibility Matrix
Forums
The scripting forum is the primary home of all things relating to Warzone scripting – almost everything on this site is based on discussions in that forum.
Per is the authority on the JS API, because he wrote most of it!
Useful reference scripts
There's already a bunch of JS scripts out in the wild – you'll be able to learn all sorts of tips and tricks by reading through their code:
- scavfact.js – this script controls scavenger players in the game and is a great place to start because it's quite basic
- Ultimate Scavenger AI Mod – a game mod that replaces the normal scavfact.js with a massively improved version, and also adds new units, etc.
- rules.js – this script defines the Game Rules & SitRep, Player Initialisation, and win/lose conditions, etc.
- Enhanced Situation Reporting Mod – an enhanced rules.js by Shadow Wolf TJC that provides additional audio messages in-game
- semperfi.js – the Semperfi JS AI bundled with Warzone 2100 (and associated .ai file that tells WZ about it)
- NullBot AI (discuss, wiki, source) – made by NoQ, this is a great AI for low-oil maps that can usually beat two competing conventional AIs.
Useful data files
There's a bunch of files that contain references to features, structures and so on - you'll probably need to refer to them while scripting as some function parameters are based on them:
- research.txt – lots of data about research / technologies
- features.txt – lots of data about features
- structures.txt – lots of data about structures
- names.txt – useful for working out what reserach/feature/structure IDs are
- loads more data files – there's dozens of other really useful data files here
- Txt editing – explains the fields in some of the more useful text files
C++ Source files
The following Warzone C++ source files are associated with the JS API – it's really useful to read through them to get an idea of what goes on "behind the scenes":
- qtscriptfuncs.cpp – Defines all game Objects, almost all of the Functions and Constants, and a few Globals such as playerData[], derrickPositions[] and startPositions[].
- qtscript.cpp – Deals with saving/loading games, and defines some of the core Functions like include(), most of the Events & Timers and most of the Globals.
If, like me, you've not worked with C++ before or don't know how QtScript stuff works, I recommend reading through QtScriptValue documentation to get a better idea about what the source files are doing.
Useful Libraries
If you're working on meaty scripts, here's some libraries that might make life a bit easier:
- util.js – classic prototypal inheritance model, attach multiple event handlers to WZ events, and a bunch of other tasty wholesome goodness
- Backports project – scripts that smooth over the cracks in the JS API
- The NEXUS Project – task-driven scripting for Warzone 2100.
Modding Guides
Almost everything in Warzone can be modded:
- 3D Models
- AIs (Bots)
- Audio (Sound) — Directory of all audio files bundled with the game, tutorials on adding, editing and configuring audio...
- Campaigns — Some info on customising campaigns...
- Challenge Games — Challenges are predefined game set-ups for Skirmish games that can be access via the Challenges menu.
- Command line options — A list of command-line options for Warzone 2100...
- Config files (Stats) — Warzone contains numerous config files that allow almost every aspect of the game to be modified...
- Dissected Mods — Perhaps the easiest way to learn modding is to take a look at some existing mods...
- Faction, Team & Player Colours — Warzone defines colours for up to 16 factions / teams / players...
- Fast Play Games — A guide to customising the "Fast Play" game mode...
- Game Rules & SitRep — How to initialise player technologies, buildings, base type effects, determine victory (win/lose) conditions and send situation reports to players...
- Images, Icons & Cursors — Icons, flags and various other UI elements can be modded...
- Licensing Mods — Choose an open source license for your mods to be compatible with Warzone's open source license.
- Maps (Levels) — Create custom warzone maps in a variety of design and gameplay styles...
- Menus & Screens — Directory of all menus & screens, guides for changing background images, notes on where config settings are changed...
- Scripting (JS & WZScript) — Create AI bots, campaigns and more by including scripts in your mods...
- Tilesets and Textures — tilesets - under construction
- Translate / Localise — Stub page regarding translations / localisations
- Units (Droids) — Units (or "Droids" as they are known in Warzone) can be created and customised in many ways.
- Video (Cinematics) — Directory of all videos bundled with the game, tutorials on making cinematics, cutscenes and more...
- Warzone Filesystem — How does the Warzone file system work?
- Weapons (Turrets)