Game Downloads - Twilight Games Signup For Free Newsletter Contact - Twilight Games Game Downloads - Twilight Games Game Downloads - Twilight Games Game Downloads - Twilight Games

Aargon Level Editing

Cuts

The "CUT" section is the hardest to one understand and I will try to describe it to you as best I can. First I should note that there is a bug in the code such that certain piece designs will require extra "CUT" sections that cannot be specified in the PCE file. Unfortunately I can't remember how to reproduce the problem but perhaps it will come up naturally as I go along. I should also say that the way the cut matrix works is somewhat of a hack and should be revised. But as it is, you should be able to make most pieces work.

The first thing to remember when designing a piece is that the DEFLECTION_LIST parameters ONLY apply to an un-rotated piece and that the first element refers to an incoming beam travelling NORTH. When a piece is rotated, basically you can think of the NORTH direction being rotated as well so that if north is "0" and you rotate a piece once clockwise, then "0" becomes "NORTH-EAST" and so on. So when you are designing your piece you should always work with it UNROTATED and move the beam around the piece to see that you have it working properly.

Now, the CUT section works together with the DEFLECTION_LIST section to tell the game how to trim both an incoming and an outgoing laser beam. It is required because the beam has a glowing effect around it. If there was no glow, no CUT would be necessary because we could make all beams stop and then restart (or not) at the center of the tile.

Now let's take a look at the mirror piece. The deflection list is defined as follows:

[DEFLECTION_LIST]
-1,-1,-1, 1, 8, 7,-1,-1
-1,-1,-1, 1, 8, 7,-1,-1
-1,-1,-1, 1, 8, 7,-1,-1


First, let's look at it without any cuts:

[CUT]
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024


We define the -1024 cut matrix above to specify NO-CUTTING for any direction. If we don't do this, the game will try to guess what the best cuts are and will often get it wrong. So the above is certainly the easiest starting point. Now, let's concentrate on the NORTH direction. Putting the beam below the mirror going NORTH, we see the following result:

mirror image

As we can see the incoming beam travels straight through the tile and stops at the top. Since the DEFLECTION_LIST entry defines -1 for all RGB travelling NORTH, there is NO OUTGOING beam for NORTH (as we can see in the picture). Now, what do we want here? We would like all light (including the glowing effect) to be cut off from the center of the tile to the top. In order to do this we must think of an imaginary beam travelling OUT of the mirror. If the imaginary outgoing beam were travelling NORTH and we define a cut such that it is trimmed below a horizontal line through the middle of the tile, then the Aargon engine will assume that the incoming beam will need to be cut off at the center of the tile above the same horizontal line. This is called "smart cutting" because we only define one cut for two beams (ie. for one of the beams, the cut is assumed). The number that specifies such a cut is "0". So, in our cut matrix, we can specify 0s for the NORTH cut (note that it does not matter that there is no actual outgoing beam, the Aargon engine does not care if it exists or not). To see it clearly, let's only specify "0" for the RED beam as follows:

[CUT]
0, -1024, -1024, -1024, -1024, -1024, -1024, -1024
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024


mirror image

We can see from the picture that the RED INCOMING beam has been cut off from every point north of the center of the tile for a beam that enters the tile from the SOUTH (ie. travelling NORTH). Now before continuing, let's try experimenting with this RED incoming beam. Let's give the RED beam a cut of "1" instead of "0" and see the result. I've blown up the picture so we can see the result better:

[CUT]
1, -1024, -1024, -1024, -1024, -1024, -1024, -1024
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024
-1024, -1024, -1024, -1024, -1024, -1024, -1024, -1024


mirror image

What we see here is the result of rotating the RED cut by 45/2 degrees (half of a half of a right angle). We can see that all RED from the incoming beam has been removed from a line rotated by 45/2 degrees from the original horizontal cut we defined as "0" before. Similarly if we specify 2, 3, 4 etc... the line will keep rotating by 45/2 degrees, but only up to a certain point (see below).

So, for a blocked beam it is quite easy to define the northern cut. Simply all 0s.

[CUT]
0, -1024, -1024, -1024, -1024, -1024, -1024, -1024
0, -1024, -1024, -1024, -1024, -1024, -1024, -1024
0, -1024, -1024, -1024, -1024, -1024, -1024, -1024


Now let's shoot the beam in from the SOUTH-WEST (ie. Travelling NORTH-EAST).

mirror image

Again, we have the same situation as before, except that everything is rotated by 45 degrees. So what cut should we define for this blocked beam? What we select depends on how we want the image to look. It turns out that another horizontal cut here looks pretty good (ie. imagine an outgoing beam going upwards) so we similarly define a cut of "0" for the NORTH-EAST beam:

[CUT]
0, 0, -1024, -1024, -1024, -1024, -1024, -1024
0, 0, -1024, -1024, -1024, -1024, -1024, -1024
0, 0, -1024, -1024, -1024, -1024, -1024, -1024

The next cut is also fairly straight forward. Again, we need to imagine an outgoing beam's cut as a vertical line where all light to the left of that line is cut-off. Then, the incoming beam will be cut along that same line such that all light for it is cut off to the right of the line. The number to specify then, is 4.

[CUT]
0, 0, 4, -1024, -1024, -1024, -1024, -1024
0, 0, 4, -1024, -1024, -1024, -1024, -1024
0, 0, 4, -1024, -1024, -1024, -1024, -1024

mirror image

Now the next laser position does not correspond to a blocked beam. Let's have a look at it without any cuts first:

mirror image

What we want to do here again is define our cut for the OUTGOING beam. In this case there really is an outgoing beam, and we can see that a good cut for it should be "0" (ie. remove the laser effect below a horizontal line through the middle). This is where "smart cutting" comes into play again. The Aargon engine will determine that the incoming beam also needs to be cut below the center horizontal line since both beams are on the same side of the cut line.

The result looks like this:

mirror image

Similar logic can be applied to the other directions.

The fact that "smart cutting" exists is what makes the whole cut matrix very confusing. A better solution would have been to have separate cuts for the incoming and outgoing beams, however what we had worked for all of our pieces so we never changed the original logic.