Tutorial: Graffiti effect

From DF21 Wiki
An alliance starbird on the walls of an imperial restroom- an example of the Graffiti effect
Kyle steps back and admires his handiwork

TUTORIAL IS IN ALPHA STAGE AND LACKS IMAGES AT PRESENT- please send feedback to Secbase Unlimited through Wiki or via Discord

This effect utilizes wall flag 1 bit 16 (wall texture anchored); or, more accurately, this effect utilizes the -lack- of said flag. Many first-time level authors have been confused why the sides of their elevators seem to draw from the wrong direction- about time we used it for good. Or maybe not good, since this is all about defacing public property. Ah well.

THE SHORT OF IT:

this tutorial assumes the reader has intermediate knowledge of dark forces editing - please refer to the WDFUSE tutorials if you have no idea what the heck I'm talking about

Pick a wall in your level that you want to deface. Any unadjoined wall will do - in the example, we're using a wall in a bathroom. Take whatever texture you're using on the walls, extract it to your preferred graphic design program, and draw the graffiti you want to add. Convert the new texture to a Dark Forces .BM (make sure it has a different name to your original wall texture), and stick it in your project folder.

Now, we're going to extrude a small sector behind the original, the same size as our new graffiti patch. When the effect is working properly we'll be making this new sector super-thin, but for now leave it at one DFU wide or so, just so things are easier to edit. Make the ceiling of the new sector the same height as the top of the graffiti (or a little bit higher), and match the floor for now.

The midtexture of the back wall on the new sector should be the graffiti'd texture, with the same offsets as the original wall (the one which you extruded to get the new sector), PLUS the height of the sector on the Y scale. Set flag 1 on the back wall to bit 16: this texture -should- be anchored. Meanwhile, the bottom texture on the original wall should be the same as the original midtexture, with the same offsets, and should -NOT- be anchored.

Name the sector you're in VANDAL, the sector with the graffiti texture SPRAY, and create a small dummy sector with the name SPRAY_CT. Now, here's the INF you'll want to use.

For the trigger, the un-tagged wall of VANDAL:

 seq
 class: trigger switch1
     sound: 0
   client: spray_ct
 seqend

For SPRAY, the sector with the graffiti texture:

 seq
 class: elevator move_floor
     sound: 1 spray.voc
     sound: 2 0
     sound: 3 0
     speed: 6
     event_mask: 0
   stop: @0 hold
   stop: @-9 terminate
 seqend

and for SPRAY_CT, the dummy sector that controls things behind the scenes:

 seq
 class: elevator move_floor
     sound: 1 0
     sound: 2 0
     sound: 3 0
     speed: 0
   stop: @0 hold
   stop: @1 1
     page: 1 shake.voc
   stop: @2 1.5
     message: 2 spray next_stop   
   stop: @3 terminate
 seqend

These INF commands use a pair of custom .VOCs as well - feel free to steal the .vocs I included in the example .GOB

Once you've tested the effect in your level and made sure that the front wall comes down correctly (and lines up with the back wall), you can reduce the width of the sector to 0.01 DFU or thereabouts and change the side walls to filler textures, and to the casual observer the graffiti is drawn onto the wall like magic. Neat, huh!

Okay, now if you want to make a slightly more complex effect, with multiple paintstrokes (like the starbird tag in the example .gob) you'll need to do a little bit more - firstly, you'll need a new wall texture for every stroke of paint you add, and a new thin sector with its own INF per stroke.

Secondly, every thin sector except for the last will need to include a scroll_wall INF command, to offset the need for an anchored texture in the preceding INF command. Give this scroll_wall command an angle of 0, a speed of (your move_floor speed times 8), and a stop height of (your move_floor stop distance times eight). Remember that scroll_wall commands are measured in pixels, rather than DFU. You'll also want to give every interim wall flag 1 bit 256 (allow scroll bottom texture), and a bottom texture Y offset equal to the height of the wall

Put it all together and- voila! Kyle does vandalism!

Example:

Graffiti.GOB - example GOB (currently hosted offsite)