TR 2.0 Progress for April 18, 2010: Target Sets

April 18, 2010

Had a chance to sit down and code for a few hours today, for the first time in a few weeks. Nothing very exciting. Essentially, TR2.0 is, at the current moment, a test script that automates a fake campaign. Instead of players doing things, the test script does them, and I watch and see what happens. Before the public alpha, all the action was actually in the log files. Once the public alpha came out, I was able to start adding more code to the TR codebase, so that instead of/in addition to simple lines in the log (“New target spawned at 123.45, 45.233: IJN tank, tactical, 10 points, blah blah blah”), an actual object shows up on the game terrain.

Today I focused on replacing some temporary code used to place targets randomly in the game. All the targets had been called out in a single lua file. Today, I went through and created separate files for each target set. This makes it easier for anyone to add more target sets, and not worry about messing up the TR code. Here is an example of a TR target set file:

name = “airfield-3000ft-h-j”
waterGround = “ground”
targetType = TARGET_TYPE_AIRFIELD
staticDynamic = SD_STATIC
sidename = “Japan”
exclusionZone = {w = -500, e = 500, n = -125, s = 125}
placementVariance = {h = 2000, v = 1000}

targets = {
{
name = “Japanese Hangar Type 1″
modelpath = “/data/tr/objects/structures/j_hanger_1.model”
points = 100
location = 0.443,0.5782
heading = 180
},
{
name = “Japanese Steel Pillbox”
modelpath = “/data/tr/objects/structures/j_pillbox_steel.model”
points = 10
location = 0.879,0.5562
heading = 135
},
etc. etc. etc.

I also added code to let the target set designer specify an “exclusion zone” for each target set. This is a rectangle onto which no target can be placed. Think of an airfield runway, for example. You wouldn’t want a flak gun to be generated in the middle of the runway.

You can also now use the placementVariance line to specify the area into which targets will be placed, relative to the center of the target set. In our example above, targets will be placed between 0 and 2000 meters from the horizontal center of our target set, and between 0 and 1000 meters from the vertical center. As long as they don’t collide with the exclusion zone of course.

The location and heading lines are not yet handled by the TR campaign engine, so I’ll cover those and some of the other parts of the file in future posts.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.