GameRules Concepts

Introduction to GameRules

GameRules provides a unified development extension for building all scripts for your games inside Unity. Traditional game development focus on manually creating individual scripts that must then be integrated with each other. For example, a game may need to have different tanks, firing different shells, explosing and causing damages to different players in scene. Each tank and shell have its own different behaviour.

Existing games require hundreds to thousands of scripts to manage overall game logic.

Or a game might have a rules engine to provide this logic, a development environment to visually define behaviour flow and state machines for designers and create complex logic for developers, and a powerful system to assemble all these rules to automatically generate individual scripts to be used by game objects. Unifying all game logics might be unobtainable without outside help. As a result, sharing and reusing components when building game is difficult.

The GameRules extension is unified. This means that all the functionality needed for game logic is configured using a consistent set of components that are defined and stored together in an embedded database in Unity Editor. Each game built using GameRules extension uses a common set of tools, a common vocabulary, and a consistent model to implement requirements and game logic. Behaviour flows and state machines, UI, interactions and all other aspects of development are all defined using a consistent, rule-based game development approach. This makes sharing and reusing artifacts easier when building games.

Rule-based game design and development

The GameRules extension uses a rule-based approach to game development.

_images/modelbased.png

You use visual definitions of game object logic through monobehaviour flow and state machine components in a rule-based approach. No coding is required. Game developers can see where game logic components are placed and how each piece is leveraged by the rest of the game. By improving the visibility developers have to the overall game design, all team members can communicate more effectively about the impact of new or modified requirements or logics. Team members can also identify potential gaps. As a result, updating scripts, user interfaces, and other game rules is easier.

Rule resolution and rule assembly

Rule resolution is a search algorithm used to find the most appropriate instance of a rule during rule assembly. Rule assembly is the compilation of different rules used to generate scripts in Unity. It occurs on demand through product build.

_images/productbuild.png

The key inputs to the rule resolution algorithm are the:

  • Key parts of a rule, such as the class, rule name, and rule type
  • Application ruleset list
  • Class hierarchy of the primary flow or state machine to assemble
  • Availability of the rule

The output of the resolution process is the first rule found that matches all of the key input criteria.

During product build, the rule assembler recursively assemble different rules called, using rule resolution mechanism, to generate C# scripts inside Unity. These scripts can then be attached ‘as is’ to game objects or prefabs as any other manually crafted scripts. Flow and State Machine rules generate ‘ready to use’ Monobehaviour scripts. Animation Flow rules generate StateMachineBehaviour scripts to be used inside Animators.

_images/generatedscript.png

GameRules Studio

GameRules Studio is a robust development environment inside Unity which provides artists and developers with the tools and information they need to build and extend game logics.

GameRules studio consists of:
  1. Work area
  2. Top bar
  3. Navigation area
  4. Bottom bar
_images/gamerulesstudio.png

It executes inside Unity Editor and interacts with SQLite, a powerful database embedded inside GameRules package in Unity Editor space.

_images/sqlitefolder.png