Secret
A secret is something, usually a sector but sometimes an actor or a scripted event, which is tallied on the intermission screen.
Vanilla Doom secrets are always sectors with the sector special 9. Boom added a "secret flag" in the sector special allowing to combine it with other effects by adding the value 128 to said other effect. In UDMF and Hexen format, the secret flag for sectors is instead 1024, this change was required to support more sector special types.
Sector-based secrets are triggered when the player is standing on the ground; this is handled by the same function that also handles other sector effects applying to the player, such as damaging floors. For the same reason, if a control sector of a non-solid 3D floor is marked as secret, entering the volume of the 3D floor will trigger the secret.
ZDoom allows scripted secrets with the SecretTrigger actor. The secret is considered found when the secret trigger is activated, generally by a script. A SectorAction effect can be used to run the script that will in turn activate the SecretTrigger.
More recently was added the ability to mark things as secret in UDMF by setting its "countsecret" spawn flag to true. It is also possible, but not advised, to give actors the COUNTSECRET flag, which will make them always secret wherever they are placed. Things marked as secret with either of these methods will be found when picked up; so only inventory actors should ever be flagged as secret.
A SECRETS lump can be provided in a mod to help find secrets. The secret console command will list the secrets declared for this level in this lump, if any, and will also color-code those found in green and in red those not found.
Secret sound
When discovering a secret, ZDoom will play the "misc/secret" sound. Strife provides a sound for this, DSYEAH, but the other classic games do not and ZDoom maps this sound to its own DSSECRET sound lump. This sound was created by Randi from samples from a forgotten MOD file.
Secret message
The string displayed when a secret is found has the identifier SECRETMESSAGE. Its default value, "A secret is revealed!", comes from the game Blood.