Educational Scenarios

Installation

You need Eclipse Europa (3.3) for RCP/Plug-in developers. You can either download it from Eclipse Europa download site or use the copy provided on this CD. Extract the zip archive into a directory of your choice (e.g. C:\Program Files\eclipse).

Another requirement is Unreal Tournament 2004. Follow the instructions on the installation DVD. After that apply the 3369 patch from ut2004-winpatch3369.exe.

After these two are installed, run the es-setup.exe, select the directories and install it. Everything is ready now.

Running the scenario

1. Open Eclipse and select the workspace you provided during the Educational Scenarios installation.
2. Run UT2004 with lower priority. You can do that by running the UT2004LowerPriority.bat from the UT2004\System directory or by running the UT2004.exe and then manually setting the priority in Task Manager.
3. Select Host game, PogamutScenario (the bottommost in the select panel on the left). Now you can choose the map (the ExampleScenario is implemented for DM-UnreallVilleBig) and mutators - you will probably want the GBNoWeaponMutator removing the weapons from the game but other can be useful - e.g. Regeneration regenerates health when somebody gets injured (for example by falling from height).
4. Now press the Listen button on the bottom of screen and wait until the game starts.
5. Right click on the scenario you want to run and select Run as -> Java application

A second option is to start the game server with esserver.bat in the UT2004\System directory. This batch automatically starts the PogamutScenario on DM-UnrealVilleBig with appropriate mutators. Then run esjoin.bat - this automatically connects to the running UT server on localhost. You can also run the game manually - run the UT2004LowPriority.exe as in step 2 and join the game - press Join game, select the running server from the LAN tab and then press the JOIN button.

Creating your own scenario

Read the Step by step manual to create a scenario. For editing the map files you should read the Map Editor documentation.

Introduction to rules

For your comfort can be all commands and conditions formulated in simple bare sentences. This is called DSL - Domain Specific Language. These senetences are translated into Drools and Java commands.

The rule package consists of two parts: head and rules. In the head there are four important objects

The second part contains the rules. All of these have the form:


    rule "unique rule name"
        modifiers
        when
        conditions
        then
        commands
    end
    
Every 100 miliseconds are these rules tested; if are the conditions in LHS (left-hand section, the part of the rule between when and then keywords) for some rule satisfied the rule is going to be fired. This means that the commands in the RHS (right-hand section, the part of the rule between then and end keywords) are executed. The commands could change the situation and another rule can be fired. In one moment can the conditions of multiple rules be satisfied - all of them are fired then.

The LHS can contain multiple conditions, each condition on single row. The default meaning of this that all of the conditions must be satisfied at one moment to fire the rule. There is a default and relation between them. There is also a way how to say that only one condition from some of them must be satisfied. This is the or relation. You can write it this way:


    when
        condition 1
        or
        condition 2
    then
    
If you want to write more complex LHS, use parentheses:

    when
        condition 1
        (condition 2
        or
        condition 3)
        condition 4
    then
    
This means that the both condition 1 and condition 4 must be satisfied and also either condition 2 or condition 3 (or both of them). The order of conditions is not vital but it affects the performance. You should put the more computionaly difficult conditions on the bottom and the bottleneck conditions on the top. If you do not know which order is better, do not care.
Click
here for the complete list of currently supported conditions.

Unlike in the LHS, the order of commands in RHS is very important. Each command must be written in a single row and they are executed in a top-down order. The complete list of currently supported commands is here.

Modifiers alter the way how the rules are executed. For the complete list look into the Drools documentation but for you can be important these two:

If you want to write your own comments (what is strongly recommended) or remove some condition or command for debugging purposes (you want to add it again in the future), start the line with sharp character #. Everything between the sharp and the end of line is considered as comment and Drools ignore it.

And this is everything you need to know to start writing rules. Just a little advice: Do not try to write the whole scenario all at once. Start with one "Hello world" rule and after every one or two rules test if it works. You can also use debugging command log "message" to make sure the rule fires or does not.

Configuration file

The configuration file gathers general information about the scenario - mostly links to other files and general settings. It is a XML file where the top element is scenario with language attribute. Currently supported is only english. The scenario can contain these sections (tags):

Map files

It would be very uncomfortable to use commands as "if the player is in rectangle specified by coordinates 324, 5654, 756, 6544" and such. That is why all these coordinates are stored in a file called map file. More accurately, there can be more of such files but the information from them are merged during the loading.

The parts of space are called areas. There are two basic types of them: simple areas and complex areas. The simple areas are rectangles, circles and polygons and you usually do not assign a name (ID) to them. The complex areas do not have coordinates - they are specified by their subareas. These subareas can be also complex areas or simple ones. They form a tree-like structure: simple areas form streets, squares, parks and such, these form districts and districts form a city. This partitioning is up to you - nothing forces to have three levels, you can have two or fifty of them.

Sometimes you would like to have some point marked on the map or refer to the point in the scenario. These are called POIs - points of interest. You can also set their symbol, color and description.

Similar to marks are paths. These are broken lines displayed in the map. You can set their color and width. Unlike the POIs you cannot refer to them in rules because they have not a single position.

You do not have to edit the map manually, there is an editor provided. See the map editor documentation.

Deployment

Windows users are accustomed to have single executable file when they want to run some program. Educational Scenarios with the prepared scenario can be deployed in such way. This is called Rich Client Platform (RCP) product. The exact routine for deployment is beyond the scope of this documentation - see Eclipse Rich Client Tutorial if you are interested.

Contact and support

If you experience any problems with Educational Scenarios, do not hesitate to contact me:
e-mail: radim.vansa@matfyz.cz
jabber: flavius@jabber.cz
ICQ: 287 682 797