anachronox-sdk/docs/Beams.html

269 lines
11 KiB
HTML
Raw Normal View History

2002-01-21 00:00:00 +00:00
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Generating 'Beam' visual effects</title>
<style type="text/css">
<!--
body {
background-color:black;
text-color:lightgrey;
margin-left:12%;
margin-right:13%;
}
a {
font-weight:bold;
text-decoration:none;
}
p {
font:12pt/16pt Arial, Geneva, sans-serif;
color:lightgrey;
margin-top:8pt;
margin-bottom:8pt;
text-indent:12pt;
}
h1 {
font:24pt/22pt Arial, Geneva, sans-serif;
color:orange;
text-align:center;
}
h2 {
font:18pt/18pt Arial, Geneva, sans-serif;
color:yellow;
text-align:left;
margin-top:24pt;
}
pre {
font:10pt/10pt Fixedsys, Courier, serif;
background-color:#202020;
color=lightgrey;
}
code {
font:10pt/15pt Fixedsys, Courier, serif;
background-color:#202020;
color=lightgrey;
}
hr {
color:red;
margin-top:-20pt;
}
hr.h2 {
color:orange;
width:50%;
text-align:left;
}
b.red {
font:light;
color:red;
}
b.green {
font-weight:light;
color:green;
}
-->
</style>
</head>
<body bgcolor="#000000" text="#FFFFFF" link="#0000FF"
vlink="#800080">
<p align="left"><font color="#808080" size="1" face="Arial">Last
updated 4/14/2000</font></p>
<p align="center"><a href="main.html"><font color="#990000"
size="3" face="Arial">Main Menu</font></a><font color="#990000"
size="3" face="Arial"> </font></p>
<hr>
<h1><font face="Arial">Generating 'Beam' Visual Effects</font></h1>
<p><font face="Arial"></font>&nbsp;</p>
<blockquote>
<p><font face="Arial"><i>Yeah, now we have beam effects. They
are still in progress, but we have almost all the basic
effects in at the moment. I imagine that these would be used
for stuff like boots' attacks and Demo's tractor beam skill.
Things that need scaleable lines for variable relative
targets.</i></font></p>
</blockquote>
<h2><font face="Arial"><i>Creating Beams in APE</i></font></h2>
<blockquote>
<p><font face="Arial"><i>What is a beam? It's a screen-oriented
polygon that starts at one point and ends at another. So
basically a line. These lines can have various effects such
as fading from opaque to solid, fading between colors,
growing/shrinking, etc.</i></font></p>
<p><font face="Arial"><i>Right now, you can only create beams
in APE. There are two APE externs to make beams:</i></font></p>
<p><font face="Arial"><code><i>BEAM_CreateBeam [srchandle] [tgthandle]
[r] [g] [b] [a] [time] [radius] [flags]</i></code></font></p>
<p><font face="Arial"><i>srchandle/tgthandle</i>: The two
handles are handles to the source and target entities--the
entity origins will be the start and end points of the beam.</font></p>
<p><font face="Arial"><i>r, g, b, a</i>: These represent the
red, green, blue, and alpha components of the beam's color.</font></p>
<p><font face="Arial"><i>time</i>: The lifetime of the beam
in milliseconds.</font></p>
<p><font face="Arial"><i>radius</i>: The thickness of the
beam.</font></p>
<p><font face="Arial"><i>flags</i>: The effects flags of the
beam (to be described later)</font></p>
<p><font face="Arial">The second command is a more complex
version of creatbeam with more arguments for greater control
over the beam's appearance.</font></p>
<p><font face="Arial"><code>BEAM_CreateBeamEx [srchandle] [srcsurface]
[tgthandle] [tgtsurface] [r] [g] [b] [a] [r2] [g2] [b2]
[time] [radius] [radius2] [texture #] [scrollx] [scrolly] [flags]</code></font></p>
<p><font face="Arial"><i>srchandle/tgthandle</i>: These are
the same as in the previous command, they represent the start
and end entities.</font></p>
<p><font face="Arial"><i>srcsurface/tgtsurface</i>: These are
the names of the triangles for the source and target that you
want the beams start and endpoints to be. They are optional.
So if you just want entity to entity beams, just make both
surfaces 0. If you want just a source surface (the most
common application), say for an eye-beam effect, just use a
source surface and keep the target surface as &quot;0&quot;.
You still need to have valid handles for using surface-basedbeams.</font></p>
<p><font face="Arial"><i>r, g, b, a</i>: The red, green,
blue, and alpha components of the beam's color.</font></p>
<p><font face="Arial"><i>r2, g2, b2</i>: The red, green, and
blue components of the 2nd color. If the 1st and 2nd color
are not the same, then the beam will fade between these two
colors as it decays.</font></p>
<p><font face="Arial"><i>time</i>: Lifetime of beam.</font></p>
<p><font face="Arial"><i>radius</i>: Thickness of beam/thickness
of start point.</font></p>
<p><font face="Arial"><i>radius2</i>: Thickness of end point
of beam. If both radii are different, then you will get a
flared-out beam.</font></p>
<p><font face="Arial"><i>texture #</i>:Texture number. This
is the same texture number you use for particles--it will
apply a texture from the pool of particle textures to the
beam. It is tiled down the length of the beam, but in width
it is stretched.</font></p>
<p><font face="Arial"><i>scrollx</i>: Texture scroll X speed.
</font></p>
<p><font face="Arial"><i>scrolly</i>: Texture scroll Y speed.
</font></p>
<p><font face="Arial"><i>flags</i>: Flags (to be described
later)</font></p>
</blockquote>
<h2><font face="Arial">Creating Beams in PLANET</font></h2>
<blockquote><p>The Planet Command is basically createbeamex, but slightly more flexible. This goes on the command path for any given track and
references the entity that belongs to that track as the source of the beam. Therefore, it's not necessary to specify a source entity:</p>
<p><code>beam=[surfacea],[tgttrack],[surfaceb],[r],[g],[b],[a],[r2],[g2],[b2],[time],[radius],[radius2],[texnum],[scrollx],[scrolly],[flags], [segments]</p></code>
<p><i>surfacea</i>: The surface of the target entity the beam will emit from. "0" if none.</p>
<p><i>tgttrack</i>: The track of the target entity. Can also be either the sequence or classname of the desired target entity.</p>
<p><i>surfaceb</i>: The surface you want to hit on the target entity. "0" if none.</p>
<p><i>r, g, b, a</i>: The red, green, blue, and alpha components of the first color.</p>
<p><i>r2, g2, b2</i>: The second color of the beam. If the same as the first, no color fading will occur.</p>
<p><i>time</i>: Time, in milliseconds, of the beam's life. 2500 is 2 and a half seconds, for a ballpark value.</p>
<p><i>radius</i>: Radius, 0-256, of the beam.</p>
<p><i>radius2</i>: Second radius--if the same as the first, no flaring will occur.</p>
<p><i>texnum</i>: Texture #, same as the texnum for particles. If -1 or 0, will not use a texture. (I probably have to let it use 0)</p>
<p><i>scrollx</i>: Scroll velocity along the x axis of the texture (if available).</p>
<p><i>scrolly</i>: Scroll velocity along the y axis of the texture (if available).</p>
<p><i>flags</i>: Effects flags.</p>
<p><i>segments</i>: Number of segments for lightning. (optional, only used for lightning beams--3-12 segments. Let me know if you need more) </p>
<h2><font face="Arial">FLAGS</font></h2>
<p><font face="Arial">These are the values that you add up and
use for the flags field. You can use the windows calculator in
hex mode to add in the appropriate effects flags. More info to
come...</font></p>
<p><font face="Arial"><code><br>
#define BE_SHRINK 0x0001 // beam shrinks with time (radius -&gt;
0)<br>
#define BE_FADE 0x0002 // beam fades with time<br>
#define BE_PARTICLE 0x0008 // add particles to beam length<br>
#define BE_GLOW 0x0020 // draw halo around beam<br>
#define BE_GROW 0x0040 // beam grows with time ( 0 -&gt; radius)<br>
#define BE_LIGHTNING 0x0200 // segmented lightning beam<br>
#define BE_2RADIUS 0x0400 // different source and target radius<br>
#define BE_ALPHALEFT 0x0800 // fade from 0 alpha, target --
source : fade<br>
#define BE_ALPHARIGHT 0x1000 // fade from 0 falpha, source -- target : fade<br>
#define BE_INFINITE 0x2000 // beam lasts forever (until killed)<br>
</code></font></p>
<p>If you are using the lightning flag, the radius2 argument is referenced as the deviation
instead of the flared radius since lightning would look pretty stupid with tapered beams. If it's
set to 0, it will just use a default value.</p>
<p><h3>A Small Note About the INFINITE Flag</h3></p>
<p>If you use the INFINITE flag, the beam will last forever. You can explicitly kill the beam with the command:</p>
<p><code>BEAM_KillBeam [handle]</p></code></p>
<p>This will kill the infinite beam associated with the entity handle passed in. If you have more than one
beam emitting from a single entity, this function will kill all beams associated with that
entity.</p>
<h2><font face="Arial">LIMITATIONS</font></h2>
<blockquote>
<p><font face="Arial">Beams are a single polygon (except lightning). So you will
notice if you have a particularly wide beam that the end
points will spin around as you move the camewra because it
always draws the beam orthogonal to the screen. It's not that
bad with small to medium sized beams, but beware of this when
using obscenely wide beams.</font></p>
</blockquote>
<h2><font face="Arial">Using The Beam Editor</font></h2>
<blockquote>
<p><font face="Arial">Now we have a Beam Editor. This allows
you to quickly demo different styles of beams and view their flag
values for easy creation of new effects.
</font></p>
</blockquote>
<p>
The Beam Editor is similar to the Particle Editor in that it needs to be launched from NoxDroppings. To start the editor,
type the console command <i>"ndbeamedit +"</i> from the console.
</p>
<p>Now you'll see an interface similar to the Particle Editor. There are a bunch of sliders on the right for adjusting
parameters and a listbox on the lower left for flags. You can click on the flags just like particle flags. These will
apply different styles.</p>
<p>Now, when you click the <i>create beam</i> button, a beam will be created in front of you. (It spawns two invisible entities
in front of the camera for this) When this button is clicked you will see the text "Beam Flags" in the upper left hand corner of
the screen. This is the effect argument for this given beam. That way you don't have to use a calculator.</p>
<p>By using the values of the sliders and the beam flags number, you can easily create particle commands with the editor.</p>
<p>
<font face="Arial">Complain about this document to the
wonderful author, </font><a href="mailto:ralph@ionstorm.com"><font
face="Arial">Ralph Barbagallo</font></a></p>
</body>
</html>