Object - Drivable Tank



This tutorial is designed to show how create a drivable tank. It is best that you have section 4 of the ADVANCED.TXT handy while going over this turtorial. To view this map in Shadow Warrior download tank1.zip (Updated 24 March 1998).




Fig 1. Main Tank object sector.

1. First, create the sector that you plan to place your tank sector in. Next, create the outer most part of the tank (object) sector. The actual tank will be within this tank object sector (as shown in fig. 1). This I call the object sector, or main object sector. Before you create any sectors within the main object sector it is a good habit to tag one of the walls of this wall loop first (section 4.1.1). with a LoTag of 504. Make sure that you place the cursor on the outside of the wall (see fig. 1). Note: any wall of the object sector will work, but tag only one wall. It should also be noted that the floor and ceiling textures remain the same as the neighboring sector.


Fig 2. Creating the outer most part of the tank.

2. Now, we start to create the actual tank itself within the outer most sector (fig. 2). The front of the tank will face to the south (towards the bottom of the picture). Go into 3D mode and raise this sector up about 13 PgUps (not the outer most sector).


Fig 3. Adding the tank treads.

3. By inserting vertices and connecting them using the space bar create the tread sectors.


Fig 4. Dividing the treads and making the front sector.

4. Next, divide the tread sectors so the front and back tread sectors can be sloped. Also, create the front sector that will be sloped.


Fig 5. Outer part of turret.

5. As shown in fig. 5, use the space bar again and make the outer part of the turret. Granted this turret will not turn independently from the tank itself. I just call it the turret.


Fig 6. Creating the turret sector.

6. Create the turret sector (fig. 6). This is where the player will be when operating the tank.


Fig 7. Tagging the turret sector.

7. Since the player will operate the tank from the turret sector, place the cursor in this sector and give it a HiTag of 98 and a LoTag of 501. The LoTag of 501 will vary if it is not the first sector object on your map (see section 1.3 of the WALLTAGS.TXT file). Insert the gun barrel sprite (the bottom purple one). Use picnum 764 and a Flag value of 141 for the gun barrel sprite. Angle the sprite to the right for it to be in the correct position. The other two sprites shown in fig. 7 are control panel sprites that I used (not required). Make sure that you have the correct Flags for the 6 tread floor sectors (48 for non sloped and 4a for the sloped ones). This is also true for the top (floor texture) of the tank itself. Note: You can just copy them from my tank1.map using the TAB key and inserting them into yours using the Enter key (NOT the numeric pad Enter).


Fig 8. 3D view of our tank.

8. When all is said and done, your tank should look something like fig 8.


Fig 9. Inserting the main ST1 sprites for the tank to work.

9. Insert a ST1 sprite at the very end of the gun barrel sprite, and give it a HiTag of 62 (SHOOT_POINT). Point the angle towards the front, and give TAG3, TAG5, TAG6, and BOOL1 a value of 0 (zero). TAG3 = 0 is for a tank shell, and can be given another value if you want to (see HiTag 62 in the SPRITAGS.TXT file). We need to insert seven key ST1 sprites into the turret object sector (the one that we tagged in step 7 above). If you place these ST1 sprites in a non-tagged sector the sprite(s) will have no effect. Give the first ST1 spirte a HiTag of 1 (SECT_OPERATIONAL). Give the second ST1 sprite a HiTag of 16 (SO_ANGLE) and point the angle towards the front. The third ST1 sprite is given a HiTag of 76 (SO_MAX_DAMAGE) and a LoTag value for it's health (I gave it 400). Also, set TAG3 and TAG5 to 0 (zero), and point the angle towards the front. This sprite is for the amount of damage it can take (400 in our case) from an exploding type weapon before it breaks down. We will add a spawn sprite shortly to show that it is broken. The forth ST1 sprite gets a HiTag of 147 (SO_DRIVABLE_ATTRIB) and set BOOL4 to 1. The fifth ST1 sprite is given a HiTag of 77 (SO_RAM_DAMAGE) and a LoTag of 30000. The sixth ST1 sprite has a HiTag of 134 (SOUND_SPOT) and your next match tag value 1 for our map (first match tag). Give TAG4 = 149, TAG5 = 147, and BOOL2 = 1 (very important). The seventh ST1 sprite get a HiTag of 69 (SPAWN_SPOT) and a LoTag of 2 (next match tag for map). Set TAG3 and TAG6 to 3 for smoke to appear on the turret when it becomes broken. Again, these seven ST1 sprites must go in the turret object sector.

Ok, at the top right of the first sector in step 1 insert a ST1 sprite, and give it a HiTag of 32 (SECT_SO_DONT_BOB). We need to insert two more ST1 sprites to create what is known as the Bounding Box (section 4.1.2 of the ADVANCED.TXT). This is an "imaginary rectangle" that must be large enough to contain the entire outer wall loop plus the sprites that will move with the sector object (the gun barrel and SHOOT_POINT sprites in our case). The first ST1 sprite is given a HiTag of 500 (BOUND_SO_UPPER) since it is our first sector object on the map. It is placed to the upper left of the sector object. The second ST1 sprite is given a HiTag of 501 (BOUND_SO_LOWER). You will note that this is and MUST be the same value of the LoTag given to the turret object sector in step 7 above. This sprite is placed to the lower right of the sector object. Remember, this imaginary rectangle must contain the entire outer wall loop PLUS the gun barrel and SHOOT_POINT sprites. Insert another ST1 sprite for a SOUND_SPOT (HiTag 134) somewhere within the Bounding Box (I placed it in the lower right). Give it the same match tag that you gave to the SPAWN_SPOT sprite (2 in our case). Now, give TAG4 a value of 276 (hissing sound) and BOOL2 a value of 1 (important).


Fig 10. Inserting ST1 sprites for the treads to move.

10. Next, we need to give the treads some movement as the tank moves. Insert a ST1 sprite in each of the tread sectors (6 in all). Give them a HiTag of 19 (SECT_FLOOR_PAN), and a LoTag of 100. Leave the angle pointing up and set BOOL1 = 1. We have to give the front and rear of the treads movement too. So, insert a ST1 sprite right next to each of the tread wall textures with the angle pointing at each wall (as shown in fig. 10). Give them a HiTag of 23 and a LoTag of 100. The ones in the front get TAG6 = 1536 and the rear get TAG6 = 512. Set all four ST1 sprites BOOL1 = 1 and you are done.

11. Finally, since I used a different palette value (4 - gray) for my floor textures (top of tank) of my tank. I needed to insert a ST1 sprite in each of the sectors with the changed palette floor value. I used HiTag 47 (SECT_DONT_COPY_PALETTE). This is not shown here, but can be found in the zipped file that you can download.




Back to my Shadow Warrior site.