Kev's 22nd Century Flashlight



This mod replaces the flashlight in Doom 3 with one that is a bit more "realistic" and consistent with the technology of the game.

The screenshots:

The first one is of a completely darkened room (in Alpha Labs Sector 2). The second is of the same room with the flashlight in use at maximum intensity. If you look, you can tell that the reflected light dims with distance. The third is of a different location on the same map with the flashlight at maximum intensity.


This mod appears to be compatible with Doom 3 and ROE. However, I've found that there are some custom shader programs, e.g. some generated by 3mood, that will cause the variable intensity function of this mod to not work properly. It will work properly with the default shader.



   Kev's 22nd Century Flashlight -- a simple flashlight mod for Doom 3

Installation instructions:

Drop the zmod-kevflashlight-v1.pk4 file either into your 'Doom
3\Gamedata\base' folder (if you want this flashlight to work with all
mods that don't define their own flashlight) or into a 'Doom
3\Gamedata\kevflashlight' folder (you'll have to create this folder
first) if you want this to act as a standalone mod.

I'm including the GIMP image source file for the flashlight's disk
image as well as the falloff image.  These are the .xcf files included
in this distribution.  They won't be of much use to you unless you've
used the GIMP (http://www.gimp.org) before.  The rest of the mod is
already in 'source' form as such, so there's nothing else that needs
to be included for you to easily make changes to this mod.

Detailed explanation:

Ever notice how the default flashlight in Doom 3 is a little, well,
out of place?  It has a few problems:

1.  It doesn't obey the laws of physics.  The intensity of a light's
    reflection on a surface generally drops with distance, and
    flashlights are no exception to this.  But the one in Doom 3 is as
    bright at long distances as it is at short ones.

2.  The light image looks like it's coming from a cheap incandescent
    flashlight.  And its intensity isn't steady -- it varies over
    time.  It acts like a cheap 5 dollar flashlight that you can buy
    at the store today.  But this is the 22nd century we're talking
    about here!  Even the cheapest 22nd century flashlights are going
    to be of much higher quality than this.  The military-issued
    combat ones certainly will be.

3.  It's not terribly bright.  Again, we're talking about the 22nd
    century here.  You'd expect a flashlight to be brighter than this,
    especially a combat flashlight.

4.  When you use it in a completely dark room, you'll probably get a
    claustrophobic feeling.  That's because in Doom 3, the flashlight
    lights up only the circular target area and nothing else.  There's
    no light scattering and no leakage.  But here's the thing: if
    someone points a flashlight in your general direction, but not
    directly at you, you can see some light coming from the end of the
    flashlight, right?  That means that some of the flashlight's light
    is reaching you, which means it's also being reflected off you and
    back at the person holding the flashlight, which means he might be
    able to see you, even if only barely.

And so I present you with a flashlight that tries to address the above

This one obeys (to the degree I can make it) the laws of physics: the
brightness of the reflected light drops as the object reflecting the
light moves further away from the flashlight.  In short, distant
objects will be more dimly lit than close objects, just like in real

The light from this flashlight is rock-steady, as it should be (I
don't care that there are weird hellishly magical things happening in
the world, not *all* the lights in the Doom 3 world act the way the
standard Doom 3 flashlight does).  It's also a little bluish.  That's
because I figure they're probably going to use something like modern
high intensity discharge lights (like what you see on most higher-end
cars these days) that produce a higher energy light.  And the 'circle'
is much more even, as you'd expect from decent-quality optics.

The vast majority of the light is focused into the 'circle', as you'd
expect, but as you'd expect there's still some fringe leakage, which
will cause the rest of the room ahead of you to be lit up a tiny bit.
Yeah, this might change the atmosphere of the game a little.  To
compensate a little for this effect, I've reduced the size of the
bright disk relative to the one for the original flashlight.

Finally, this flashlight has three settings: low, medium, and high.
Low setting gets you an intensity value that's about the same as that
of the standard Doom 3 flashlight.  Medium is 1.75 times the intensity
of Low, and High is 2.5 times the intensity of Low.  You can toggle
between them by hitting the 'reload' key/button when the flashlight is
in use.  Note that this feature only works in single-player mode.  If
you want me to make it work in multiplayer mode as well, just let me
know.  I'll be happy to, but you'll be sacrificing your ability to
turn your flashlight off without lowering it (or, alternatively, you'd
have to cycle through the various settings until it gets turned off).

Limitations on realism:

1.  In the real world, the maximum distance that you can see reflected
    objects with your flashlight would depend on the intensity of the
    flashlight itself (so if you use the brightest setting, you should
    be able to see objects further away that you wouldn't be able to
    see with dimmer settings).  In this mod, the maximum distance is
    fixed.  This is either (most likely) a limitation on my knowledge
    of how to modify Doom 3 or a limitation of the engine itself.  The
    distance in question is defined in the flashTarget attribute of
    the flashlight's entityDef.  I don't know how to change that at
    runtime.  If anyone in the mod community has some ideas of how to
    address this problem I'd like to know about it.  And I couldn't
    just adjust that one value either -- I'd also have to adjust the
    flashUp and flashRight values to maintain the same flashlight disk

2.  The 'ambient light' effect is generated by having the flashlight's
    'disk' be very wide compared with the normal flashlight's, and
    having most of that disk comprised of very low pixel values 
    (the pixel value is multiplied by the light's value and then by
    the falloff value to generate the final light value hitting the
    target surface).  The light circle you see in the shots is
    actually a very small part of the actual disk.  While this
    method works reasonably well, the downside is that I only had
    something like 4 intensity values to work with in the 'ambient
    light' area, so it's possible to see where two pixel values are
    adjacent to each other.  I attempted to reduce the obviousness of
    this by doing a dithered merge between adjacent areas of differing
    pixel value, but you can still see this when shining the
    flashlight on certain surfaces.  It's more obvious when the
    flashlight is at maximum intensity, of course.  Even so, in my
    experience the effect is subtle enough that you hopefully won't
    notice it too much in normal gameplay.

Terms of use:

You may alter this mod to suit your own purposes as much as you like,
and you may include it in other mods as well.  You may publish this
mod in any medium you like.  You must give credit where it's due -- if
you publish a modified form of this mod, you must reference this mod
in your README (or equivalent).

I'd strongly prefer that if you include this mod (in altered form or
not) in your own mod, you also publish the source code of your mod, as
I have here.  This isn't a requirement (proper attribution is), but it
will encourage others to create derivatives of your work and thus
enrichen us all.  What goes around tends to come around: if you
publish the source to your work, it's likely that eventually you'll be
able to make use of the source to someone else's work.

Thanks to:

- ID software, for creating an excellent gaming framework.
- DC Doom, for creating the Super Flashlight mod, which inspired and
  helped with the implementation of the multiple intensity settings
  feature of this mod.

- Kevin Brown (My ID on d3files.com is kcbrown)
  n2185x AT yahoo.com

There are no comments yet. Be the first!