Strategic Analysis

Introduction
There is plenty of games involving strategy. Tabletop, computer, miniatures, and so on, are used vastly to somehow reproduce conflicts. A large portion of wargames is made of tabletop miniatures games. Warhammer and Confrontatiòn are two of the probably most played games all over the world, in their category. And both has a thing in common: building an army is expensive. It can be fun to paint and try new units, but budget is often limited. Here comes Strategic. It's intended to be a customizable engine, able to reproduce the behaviour of any strategic game, from chess to Warhammer 40K. It should be something like a framework, more than a game itself. Initially the idea was to create an implementation of the rules of Warhammer 40K, allowing me to play-test armies without buying useless miniatures. Then, I thought that probably I were going to violate some trademark and/or copyright. So I decided to thing big, aiming to develop a configurable engine, able tu load and run a game described in something like an external package, independent from my software. I'm going now to describe the big picture I have in my mind.

Overview
We can see four main components: the Strategic Engine, the Command and Control interface, the Rule Engine and an Artefacts Engine. Strategic Engine: it's the core of the system. Command and Control: is the user interface, used to control the engines. Rule Engine: is able to read and apply a set of rules described for a certain game. Artefacts Engine: manage every artefact needed by a game, like units, buildings, pieces, parts of scenery, abstracts objects like bullets, and so on.

Strategic Engine
It has features to manage game sessions, load game packages, save games, validate game packages, manage users accounts, and so on. It's the core of the system, and other modules will rely on it.

Command and Control
The idea is to have a generic control interface, upon which we can plug any kind of interface, like web based front-end, client GUI, remote shell, plain text files or mails, everything based on a single interface. In this way we can choose the best interface for a given game, or even multiple interfaces for the same game. We also need to manage user privileges to recognize simple gamers from admins and developers.

Rule Engine
Based on a rule engine like Drools, it manages game rules. It can load them from a game package at runtime. A rule engine is a device which allow users to develop complex business logic using in human language, and then apply it in your software.

Artefacts Engine
Generates any kind of objects needed by a given game set, and manages persistence, ownership, state, and so on. System will load a game package, then ask this engine to generate entities described in it.

Strategic Engine
This is the core of the system, and it's functions are game sessions management, game packages validation and loading, user account and rights. It provide other basic services which can be used by other modules.

Game Session Management
The system exposes interfaces to core functionalities, allowing an administrator to manage the server, and users to play games. Configuration should be performed using files as a basic way, or using one or more of the interface implementations provided by the Command and Control module. A good idea would be to implement a command line interface as a basic choice. Permission management should be implemented at the interface level, providing a single point of access for all configurations. As an example, see FreeCIV server, where all admin operations can be performed using a built-in CLI, and clients are separated from the server.

Game Packages Validation and Loading
Another function of the core engine is to validate and load game packages, which will be described later. The system will load a package, verify it's correctness, compatibility, and if it passes validation will deploy it in the server.

User Accounts and Permissions Management
Different games can require to the engine a different behaviour about user management. It can be an anonymous system requiring simply a nick-name, or a complex role system allowing different privileges for multiple users, groups, different kind of authentication (certificates, password, etc.).

Persistence
Server should also provide services related to data persistence. File storage, user informations, game saves, statistics, etc. should be independent from the data source. The engine will provide an abstraction of the data source/storage system, allowing a more standardized way to implement modules. It should support both DBMS (using JDBC) and filesystem storage.

Command and Control
This module is the interface between the core and the user interfaces plugins. It's composed by an interface which expose services to the plugins. Services works using plain text messages, or XML messages. The interfaces whould be simple, and allow developers to build complex plugins upon them. Possible plugins can be a command line interface, web frontend, client applications, mails, plain text files.

Rules Engine
A rules engine is a piece of software which allows you to describe the logic of an application using a human readable language. It's separate from classes implementation, and can be written by non-technic people. Given a set of rules, the engine can take an object, test it against defined rules, and take the appropriate actions. The skeleton of a rule is:

if then

Artefacts Engine
Whenever a game package involves the use of some kind of object, this engine will carry on the job to generate, maintain, cache, update and save it. Game packages will come with files describing application objects they need, wich will be read by the engine. Then it will expose them to the core so that it can use them. It will also provide built-in artefacts that any game pakage will be able to use without define them (for example tiles, pieces, teams, units, and so on).