Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

How to initialise player technologies, buildings, base type effects, determine victory (win/lose) conditions and send situation reports to players...

 

rules.js

Each human player in a game will have an associated rules.js script assigned to them. It runs for the duration of the game.

The rules.js script is responsible for applying and monitoring game rules, and providing in-game situation reporting (SitRep) to the human player.

Game Rules

There are three key parts to the game rules as follows:

You should make yourself familiar with all of them, even if you have no intention of modding them.

Situation Reporting (SitRep)

In Warzone, games can get pretty hectic. A player can't watch the whole map at the same time, especially when they're micromanaging units or sorting out their research labs, etc.

That's where SitRep comes in – the game needs to give the player some audio and visual cues to make them aware of what's happening around the map. Done properly, SitRep can add a lot to the game play by making it more engaging.

Because each player has an associated rules.js, it's the logical and ideal place to code SitRep.

There are three primary ways to report situations to the user:

  • Audio – this is the most engaging and effective mechanism
  • Beacons – flashing beacons on the mini map to indicate where an event took place
  • Messages – sending messages to the console with additional information

You should avoid spamming the user with SitRep - that means you'll need throttling code to limit the amount of information being sent to the user.

The best example of SitRep can be found in the Enhanced SitRep Mod (that link explains how it works in quite some detail). It performs its job really effectively and makes the game much more engaging without spamming the user, so be sure to check it out!See:

  • Situation Reporting (SitRep)
Div
classbox suggest

The game rules scripting lives in rules.js.

Check out Enhanced SitRep Mod for an example of a heavily customised rules.js. 

Div
classbox

Contents

Assimilate:

Table of Contents
excludeContents

Div
classbox

Related documentation: