Plasma Beams (like in Halo and Halo 2)
Blitz3D Forums/Blitz3D Programming/Plasma Beams (like in Halo and Halo 2)
OK - I posted this at my own website, I don't really know why. Although I've opened it up to guests. You can reply without registering. (And feel free to put your code in the "Algorithms" section.
Here's the link:
http://noenemies.proboards34.com/index.cgi?board=advanced&action=display&num=1104116654
Well, if you take the Plasma Gun in Quake 3 for example, that used sprites for the projectiles, and I believe this was also the case in Halo 2. I don't know any specifics, but I'm pretty sure the plasma is a tiled sprite; tiled to make a sort of 'beam', if you will.
I assume you're talking about the effect seen with the Scarab's beam cannon (Halo 2) and the distress beacons (Halo). I don't think the Sentinel Beams in Halo 2 were done differently.
EDIT: Oh, the plasma rifles (aka the standard weapon for the Elites) did use sprites for the projectiles. If by "sprites wouldn't look right" you mean simple alpha blending will look too dull, use the EntityFX(sprite,3) command which sets the specified entity to be rendered with addictive blending. Plasma, hoy!
ok
addictive blending?
lol @ WolRon. You may need to use a couple of sprites with additive blending to get it looking bright enough. Remember and set the sprites to FULL BRIGHT also.
Check this stuff i did a while back. The file called "lightning.bb" is a single beam of lightning. Could be used for a gun. It creates a cylinder mesh, and deforms it in real time. The other file called "lightningTYPES.bb" is the same thing, except i wrapped it all up in types so you can generate as many as you want. Each lightning beam is 2 surfaces, so don't generate too many ^_^. Converting to single surface soon :o)
Arrow keys to rotate camera. "LightningTYPES.bb" the mousebuttons zoom in and out too.
www.rosscrooks.pwp.blueyonder.co.uk/lightninggun.zip
There's the only problem. I'm shooting lots and lots of them. As the in plasma rifles from Halo. But let's see what you got.
Well, these are lightning beams. You shouldn't need lots of them, cause, it's like a constant beam. :o)
Yeah - I'll probably use these lightning beams for another weapon.
No problem.
by "sprites wouldn't look right" I meant that they would always be facing the camera - and even if they weren't, they wouldn't look thick enough.
You need to use 3 (or more) fullbrigt, doublesided quads that are intersecting like a star. Then you need a few animated lightning textures. You have to edit them so they tile vertically. Then you need to calculate the distance between the plasma impact and player. Use this distance to determine a static texture tile size, so depending on the distance you'll tile the texture on the quads, and of course also scale the quads based on that distance. Playing an animated texture on each quad, choosen and restarted randomly, will give you a nice plasma effect. but of course, needs to be additive blending. I wouldn't use real Sprites here since they are not that flexible and don't support fog.
I'll try that....
Also, you might want to have a look at the 'Mega Blast' demo by "Reda Borchardt" in the 'Open DNA' folder of the B3D Samples folder.
Might be something of use in there - The demo has a kind of 'plasma gun' look to it.
Open DNA Folder?????
Where do you see that?
I don't think I got that?
nope, definately not there....
could you e-mail a .zip to me, puki?
steven@...
It would also be good if you stayed with one nickname.
NoEnemies
DigitalFortress
and now Optomistic.
What's next?
.
@xmlspy: I know, I'm really bad about that :( Keep thinking of good nicknames that no one likes. :( Ah well...life goes on....
I got it to work using code from "TunnelRun" in Games. :) it works now. Thanks guys.
Here's a little something I did:
Graphics3D 640, 480, 0, 2
SetBuffer BackBuffer()
tmr = CreateTimer(60)
Const MAX_SPRITES = 50
Global CClr = 2
Global CThick# = 2.3
Global CLength = 31
Global CSpread# = 0.4
Global CSpeed# = 0.8
cam = CreateCamera()
CameraZoom cam, 1.6
tex = LoadAnimTexture("suns_joseph.jpg", 2, 128, 128, 0, 4)
base = CreateSprite()
EntityBlend base, 3
EntityTexture base, tex, CClr
EntityAlpha base, 0.25
EntityFX base, 1
HideEntity base
pOrigin = CreateCone()
RotateEntity pOrigin, 90, 180, 0
PositionEntity cam, 10, 10, 10
PointEntity cam, pOrigin
While Not KeyDown(1)
WaitTimer tmr
Cls
If KeyHit(57) Then
CClr = CClr + 1
If CClr = 4 Then
CClr = 0
End If
EntityTexture base, tex, CClr
End If
CThick = CThick + 0.1 * Float(KeyDown(200) - KeyDown(208))
If CThick < 0.1 Then
CThick = 0.1
End If
If CThick > 5 Then
CThick = 5
End If
ScaleSprite base, CThick, CThick
CLength = CLength + (KeyDown(205) - KeyDown(203))
If CLength < 1 Then
CLength = 1
End If
If CLength > MAX_SPRITES Then
CLength = MAX_SPRITES
End If
CSpread = CSpread + 0.1 * Float(KeyDown(13) - KeyDown(12))
If CSpread < 0.1 Then
CSpread = 0.1
End If
If CSpread > 2 Then
CSpread = 2
End If
CSpeed = CSpeed + 0.1 * Float(KeyDown(201) - KeyDown(209))
If CSpeed < 0.1 Then
CSpeed = 0.1
End If
If CSpeed > 5 Then
CSpeed = 5
End If
If MouseHit(1) Then
newBeam.Beam = New Beam
For i = 0 To CLength
newBeam\Sprites[i] = CopyEntity(base)
MoveEntity newBeam\Sprites[i], 0, 0, -CSpread * Float(i)
ShowEntity newBeam\Sprites[i]
newBeam\Life = 100
Next
End If
For Beams.Beam = Each Beam
Beams\Life = Beams\Life - 1
For i = 0 To MAX_SPRITES
If Beams\Sprites[i] Then
If Beams\Life Then
MoveEntity Beams\Sprites[i], 0, 0, -CSpeed
Else
FreeEntity Beams\Sprites[i]
End If
End If
Next
If Not Beams\Life Then
Delete Beams
End If
Next
MoveEntity cam, 0.1, 0, 0
PointEntity cam, pOrigin
RenderWorld
Text 0, 0, "Color: " + Clr() + " [hit space to change]"
Text 0, 15, "Thickness: " + CThick + " [use up and down key to change]"
Text 0, 30, "Length: " + CLength + " [use left and right key to change]"
Text 0, 45, "Spread: " + CSpread + " [use + and - key to change]"
Text 0, 60, "Spead: " + CSpeed + " [use page up and page down key to change]"
Flip
Wend
End
Function Clr$()
Select CClr
Case 0
Return "Yellow"
Case 1
Return "Blue"
Case 2
Return "Purple"
Case 3
Return "Orange"
End Select
End Function
Type Beam
Field Sprites[MAX_SPRITES]
Field Life
End Type
You'll need to grab that texture:
nice one there GoSsE :D
Great GoSsE!!!!
You dont have a Nuclear blast also ?????? Please ?
Alienforce
All I see is a spinning gray cone. :(
Hit lmb! to see some cool beems ;)
/Alienforce
ooooooooh, ok.
Optomistic - here is an old program that I did in Blitz. Source code included. I made some changes to this a while ago, which are not in the download but look a lot better so let me know if you want them.
http://home.swiftdsl.com.au/~gezeder/lloyd/SpaceBattle.zipHave a look at the beam.3ds object to get an idea of how it is done.
Looks GREAT!!!! Do you have some more stuff?
Alienforce
OK, currently my computer won't start up because of some stupid hacker, so I'm using this old computer. So I'll take a look at it later, sorry.
@ GoSsE Korupted
I get Memory Access Violation..
Chad, have you put the image in the same folder as the source code? Nice effect, GoSsE.