-
Notifications
You must be signed in to change notification settings - Fork 13
Tutorial 2: Creating an Enemy
This is a tutorial by Ziggy Gnarly that describes how to make a new monster using DDF.
So, you've probably now read about making a new weapon with DDF. So now lets make a completely new creature to waste using your brand new weapon. However, making a new creature in EDGE-Classic, like making a new weapon, takes a bit of time.
If you are creating a new monster from scratch you'll need:
a) graphics for your creature
b) sounds for your creature
c) graphics for any projectiles used by your creature (optional)
d) some idea of what your monster should do (does it float or walk? Shoot or use some kind of projectile weapon? Will it have a close combat attack? Will it be fast or slow, visibile or invisible?)
As in the weapon making tutorial, I'm assuming that you are somewhat familiar with doom editing - and that you know how to make sounds, graphics and understand how to use Wintex and make a WAD file.
In this example, I'm going to turn the male player from quake 2 into an enemy (using graphics from bluemax's skin patch.) Firstly, we're going to add some new sounds. We could probably use some doom sounds - but the aim here is to get you used to making your very own monster from scratch.
1) Create the new sounds for it:
- A pain sound called QMPAIN
- A death sound called QMDIE1
- A second death sound QMDIE2
2) Import and name them in new WAD using Wintex:
You'll need to add a DS to the front of each sound
- DSQMPAIN
- DSQMDIE1
- DSQMDIE2
All digital sounds MUST be called DS[name]. You can have 6 character names total. Like DSSPINDN for example.
3) We need to define the sounds, so open EDGE-Classic's existing SOUNDS.DDF, PAGE DOWN to the bottom to add new stuff:
Anything occurring after // is a comment, ex: // THIS IS A COMMENT. DDF doesn't pay attention to upper or lower case, but I use upper cause it looks better.
Add the following:
[Q2DIE1] // sound's name, used to reference the sound
LUMP_NAME="DSQMDIE1"; // the sound's lump name
PRIORITY=60; // medium level priority
[Q2DIE2]
LUMP_NAME="DSQMDIE2";
PRIORITY=60;
[Q2PAIN]
LUMP_NAME="DSQMPAIN";
PRIORITY=60;
I should just note that the sounds.ddf file is very important. It is quite easy to add your sound files to your WAD, and use those sounds in your attacks.ddf and things.ddf. However, if you don't identify the sounds in sounds.ddf, then EDGE-Classic won't be able to find or play your new sounds.
4) We now need to define the attack for the new creature, so open EDGE-Classic's existing ATTACKS.DDF, PAGE DOWN to the bottom to add new stuff.
Add the following:
[Q2_ATTACK] // name - used to reference the attack
ATTACKTYPE=SHOT; // will use bullet
SHOTCOUNT=1; // fires one bullet at a time
DAMAGE_RANGE=4;
DAMAGE_MULTI=3;
ACCURACY_ANGLE=22; // not deadly - will hit target half of the time
ACCURACY_SLOPE=12;
ENGAGED_SOUND=SHOTGN; // sound used during the attack
ATTACK_SPECIAL=FACE_TARGET; // monster will be spun to face target when attacking
PUFF=PUFF; // when a bullet hits a wall, it will play the animation [puff] stored in things.ddf
This attack is basically a beefed up version of the chaingunner's attack. When you are first starting out, it is often easier to modify an existing attack - that way you'll have a good idea of what the attack will be like..
5) We now need to create our creature sprites, and any projectile sprites:
In this case, our monster has no projectile sprites, so we will simply concentrate on doing the character sprites. However, the basic principles outlined hold true for creating projectile sprites. We will need a number of sprites for our new creature:
- The creature walking / chase states
- The creature attack states
- The creature pain states
- The creature death states
- The creature overkill states
All monsters have 8 'views' or rotations (if you open up the doom or doom2 wad using wintex, you'll see that all monsters can be viewed from a number of different angles) Some monsters, like the former humans, only have 5 frames while monsters like the cyberdemon have a full 8 frames) In the case of five framed monsters, the frames that show the monster facing front left, left and back left are automatically mirrored to create the views as seen from the right. See the Wintex documentation for more information.
What you need to remember is that you must name your sprites using a four letter description, followed by either:
A1, A2A8, A3A7, A4A6, A5
(for sprites that can be mirrored)
or
A1, A2, A3, A4, A5, A6, A7, A8
(for sprites that are asymmetric, and cannot be mirrored)
*as we already know, the letter A means that these would be the first graphics displayed in an animation. You will have to change this value as appropriate.
You should also note that only walking, firing and pain states have rotations. The death and overkill frames have no rotations, and are identical no matter what angle they are seen from. Consequently, they have a four character name suffixed with a frame character, and a zero (e.g G0, H0, I0)
6) We will need to import our character animation into the WAD file that we already have our sounds in, and name them as such:
-
All sprites will have the 4 character name Q2MM
-
The walking / chase states are frames A to D.
(format is A1, A2A8, A3A7, A4A6, A5) -
The attack states are frames E and F.
(format is E1, E2E8, E3E7, E4E6, E5) -
The pain state is frame G.
(format is G1, G2G8, G3G7, G4G6, G5) -
The death states are frames H to N.
(format is H0, I0, J0 etc) -
The overkill states are frames O to W.
(format is O0, P0, Q0 etc)
In EDGE-Classic, it is possible to add as many animation frames as you desire. In this example, the firing sequence is frames E and F (which is all that was possible with doom) However, such limits don't apply with DDF. if you wished, you could make a firing sequence that spanned 3, 4 or as many frames as you wished.
7) We now have all our graphics and sounds, so we now need to make our monster code. Open EDGE-Classic's existing THINGS.DDF, PAGE DOWN to the bottom to add new stuff.
Add the following (no word wrap either):
[Q2DUDE:77] // thing's name and number (used by map editor)
SPAWNHEALTH=40; // starting health
REACTION_TIME=0.23; // how long it takes the monster to react after seeing you
RADIUS=20;
HEIGHT=56;
SPEED=8;
MASS=100;
PAINCHANCE=60%; // 0% means monster never goes into pain, 100% is always
SPECIAL=COUNT_AS_KILL,SOLID,SHOOTABLE; // monster is counted in end of level statistics, will block you, and can be shot
MINATTACK_CHANCE=13%; // chance that the monster will move or shoot. 1% = move, 100% = shoot. 0% = ignore
CASTORDER=18; // monster can be seen in cast list at end of map30 in doom2
BLOOD=BLOOD; // when shot, the monster will use the animation 'blood', defined in things.ddf
RESPAWN_EFFECT=RESPAWN_FLASH; // uses the animation respawn_flash when respawns
ACTIVE_SOUND=POSACT; // used by former human
DEATH_SOUND="QMDIE?"; // question mark is a wildcard. If sounds with the prefix QMDIE exist, one will be chosen at random
PAIN_SOUND=QMPAIN;
SIGHTING_SOUND="POSIT?"; // when the creature sees you
RANGE_ATTACK=Q2_ATTACK; // calls our previously defined attack
DROPITEM=CLIP; // drops a clip when killed
STATES(IDLE)=Q2MM:A:10:NORMAL:LOOKOUT, // lookout directs monster to look for things to attack
Q2MM:B:10:NORMAL:LOOKOUT;
STATES(CHASE)=Q2MM:A:4:NORMAL:CHASE, // chase directs monster to pursue targets
Q2MM:A:4:NORMAL:CHASE,
Q2MM:B:4:NORMAL:CHASE,
Q2MM:B:4:NORMAL:CHASE,
Q2MM:C:4:NORMAL:CHASE,
Q2MM:C:4:NORMAL:CHASE,
Q2MM:D:4:NORMAL:CHASE,
Q2MM:D:4:NORMAL:CHASE;
STATES(MISSILE)=Q2MM:E:10:NORMAL:FACETARGET,
Q2MM:F:6:BRIGHT:RANGE_ATTACK,
Q2MM:E:6:BRIGHT:RANGE_ATTACK,
Q2MM:F:2:NORMAL:REFIRE_CHECK, #MISSILE:1; // loops back to frame 1 of missile_states
STATES(PAIN)=Q2MM:G:3:NORMAL:NOTHING,
Q2MM:G:3:NORMAL:MAKEPAINSOUND,#CHASE; // plays QMPAIN
STATES(DEATH)=Q2MM:H:5:NORMAL:NOTHING,
Q2MM:I:5:NORMAL:MAKEDEATHSOUND, // plays QMDIE1 or QMDIE2
Q2MM:J:5:NORMAL:MAKEDEAD, // monster is now dead and cannot react to anything
Q2MM:K:5:NORMAL:NOTHING,
Q2MM:L:5:NORMAL:NOTHING;
Q2MM:M:5:NORMAL:NOTHING,
Q2MM:N:-1:NORMAL:NOTHING;
STATES(OVERKILL)=Q2MM:O:5:NORMAL:NOTHING,
Q2MM:P:5:NORMAL:MAKEOVERKILLSOUND, // plays slop sound
Q2MM:Q:5:NORMAL:MAKEDEAD,
Q2MM:R:5:NORMAL:NOTHING,
Q2MM:S:5:NORMAL:NOTHING,
Q2MM:T:5:NORMAL:NOTHING,
Q2MM:U:5:NORMAL:NOTHING,
Q2MM:V:5:NORMAL:NOTHING,
Q2MM:W:-1:NORMAL:NOTHING;
STATES(RESPAWN)=Q2MM:N:5:NORMAL:NOTHING,
Q2MM:M:5:NORMAL:NOTHING,
Q2MM:L:5:NORMAL:NOTHING,
Q2MM:K:5:NORMAL:NOTHING,
Q2MM:J:5:NORMAL:NOTHING,
Q2MM:I:5:NORMAL:NOTHING,
Q2MM:H:5:NORMAL:NOTHING,#CHASE;
Now, the frames work as such:
STATES([state])=[4 letter sprite name]:[frame letter]:[duration of the frame]:[light level NORMAL or BRIGHT]:[action];
Remember to close the lines with a semi-colon ";". Commas indicate to continue the loop.
The #CHASE statement 'forces' the creature to go back to it's chasing states after certain actions take place. You can also use #DEATH, #PAIN, #MISSILE and #IDLE.
If a monster has a closecombat attack, you will need to include MELEE_STATES, and the action pointer CLOSE_COMBAT. A monster can have both close combat and range attacks, in this case, the action pointer COMBOATTACK is used to pick the appropriate attack (uses range attack if the creature is too far away to use close combat attack) Creatures can also have a spare_attack, which is activated using the SPARE_ATTACK action pointer.
Consult the DDF Things page for a comprehensive description of all possible actions that can be used with a creature.
At this point, you've done almost everything necessary to get your creature working. We have the our sounds and graphics in the wad, the sounds have been defined, an attack created, and the creature is coded. All we have to do now is get your monster to appear in the game. <br.
There are 2 basic ways of doing this. The easiest way is to simply comment out an existing monster (e.g the chaingunner) and then give your monster the same mapnumber as the chaingunner. This means that your monster will automatically appear whenever the chaingunner previously appeared in a map.</br.
If you choose this method, be very careful not to duplicate mapnumbers - otherwise you'll run into all kinds of problems - as EDGE-Classic won't be able to work out which creature to use.
The second method is to fool around with your map editor. Most good map editors have a means of adding new or custom items - so read the documentation that came with the map editor for more info. The advantage of this method is that you can keep all the old doom monsters, while introducing new monsters to make things more challenging!
But before you charge off to kill your new creature, you'll have to use Wintex or DeuSF to append all sprites to your WAD file with the sounds and sprites, then run EDGE-Classic as such:
edge-classic.exe -file [wadname].wad
That's it!
A neat way of using new creatures is to make copies of the DDF files and place the ones that you are editing in a new directory. That way, you can refer to the original DDF files as necessary, and use your custom DDF files to play with your new creature in the game.
If you do this, you'll need to run it as such:
edge-classic.exe -ddf [directory where you store your DDF files] -file [wadname].wad
DDF docs written by Andy Baker and Ziggy Gnarly, with updates by Andrew Apted, Andy Brewood and Luke Brennan. © EDGE Team, et al. 1998 - 2021.