THREE FUNCTIONS RELEASED!!!I am now releasing the function code for free.
FOUR VIDEOS RELEASED!!!Very impressive examples of the power of these functions.
there is amajor spark-function bug! fixing it right now!
SNOW FUNCTION SCREENSHOTS POSTED
VIDEOS FIXED FOR PUBLIC VEIWING (for your information, the videos are being fixed to be viewed by people who do or do not own Fraps, the video recorder. Also, the videos are now about 30 seconds long, and usually about 3 mbs in size. Thanks to those who helped me fix them. ):
Spark function.
Dust function (flame version).
That's right. What you read is true! I'm working on a
free particle pack. The effects in the images below were made by Agent Dink. I will not be distributing those, but will give out my complete functions I wrote for the use of the community.
The first function is (working fully):
RequestDirtSmoke(xpos#,ypos#,zpos#,maxsize,magefaderate,scalerate,liftrate#,imagemode)
This is a function used to request smoke made from dirt. Most of the the parameters are self explanatory. The imagemode parameter is used to adjust the transparency mode to match the of image.
NOTE: THE IMAGE MODE MUST BE EITHER 1, 2, OR, 3!!! Typically .png images use mode 1 and bmp images use mode 2. The 3rd mode is a second form of mode 2. Since mode 2 can be kind of solid looking with certain images, change a mode 2 effect to mode 3 and it will take care of the prob, althoguh the effect amy appear a little smaller.
This is a screenshot of the above function at work, showing an upturned car starting to smoke before the blow (pardon the poor landscape
):
Also, below I took the same function (even though it is used for smoke) and used another image in the place of the smoke image to make a kind of flame effect, even though the function wasn't written for this.
The car is now upon the point of exploding:
The dirt clod function:
The spark function (more screens coming soon...this one is difficult to see, so you must get the video...and even then, it is not as good as it is when you use it live
)
Snow function is underway! This is what I have so far:
And the image I made for the function:
Videos: (sorry if the effects look slow in the videos; that's because of FRAPS):
Video of Flames:
Flames (about 30 secs long, 3.03 megs)
Video of Sparks:
Sparks (about 30 secs long, 3.26 megs)
Video of Snow:
Snow (about 30 secs long, 2.28 megs)
This is how it works:
For the dust function, the parameters are:
PARAMETER-------
DATA TYPE------------
DESCRIPTION
x#------------------------real--------------------x position of effect
y#------------------------real--------------------y position of effect
z#------------------------real--------------------z position of effect
maxsize-------------------integer-----------------maximum size of effect (must be > or = to 100!)
faderate------------------integer-----------------rate of effect's image fading
scalerate-----------------integer-----------------rate of effect scaling
liftrate#-----------------real--------------------rate of effect rising
imagemode------------integer (1, 2 or 3!)----image mode of effect
For the dirt clod function, the parameters are:
PARAMETER-------
DATA TYPE------------
DESCRIPTION
x#------------------------real--------------------x position of effect
y#------------------------real--------------------y position of effect
z#------------------------real--------------------z position of effect
maxsize-------------------integer-----------------maximum size of effect (must be > or = to 100!)
gravityrate#--------------real--------------------gravitional pull on effect
clodlife------------------integer-----------------life of effect
liftrate#-----------------real--------------------rate of effect lifting
clodradius#---------------real--------------------radius of effect
imagemode------------integer (1 or 2!)-------image mode of effect
For the spark function, the parameters are:
PARAMETER-------
DATA TYPE------------
DESCRIPTION
x#------------------------real--------------------x position of effect
y#------------------------real--------------------y position of effect
z#------------------------real--------------------z position of effect
maxsize-------------------integer-----------------maximum size of effect (must be > or = to 100!)
gravityrate#--------------real--------------------gravitional pull on effect
scalerate------------------integer-----------------rate of effect scaling
liftrate#-----------------real--------------------rate of effect lifting
clodradius#---------------real--------------------radius of effect
faderate------------------integer-----------------rate of effect's image fading
imagemode------------integer (1 or 2!)-------image mode of effect
This is code for the functions:
rem request dirt smoke
rem x#=real, y#=real, z#=real, maxsize=integer, faderate=integer, scalerate=integer, liftrate#=real, imagemode=integer (1, 2 or 3!)
function RequestDirtSmoke
(desiredposx#,desiredposy#,desiredposz#,maxsize,faderate,scalerate,liftrate#,imode)
Dsmokepositionx#(CurrentDSmoke(1))=desiredposx#
Dsmokepositiony#(CurrentDSmoke(1))=desiredposy#
Dsmokepositionz#(CurrentDSmoke(1))=desiredposz#
Dsmoking(CurrentDSmoke(1))=1
Dsmokesize(CurrentDSmoke(1))=maxsize
Dsmokefadespeed(CurrentDSmoke(1))=faderate
Dsmokescalerate(CurrentDSmoke(1))=scalerate
Dsmokeliftrate#(CurrentDSmoke(1))=liftrate#
DSmokeImageMode(CurrentDSmoke(1))=imode
if DSmokeImageMode(CurrentDSmoke(1))=3
Dsmokefade(CurrentDSmoke(1))=60
endif
CurrentDSmoke(1)=CurrentDSmoke(1)+1
if CurrentDSmoke(1)>500 then CurrentDSmoke(1)=1
endfunction
rem request dirt clod
rem x#=real, y#=real, z#=real, maxsize=integer, gravityrate#=real, clodlife=integer, liftrate#=real, clodradius#=real, imagemode=integer (1 or 2!)
function RequestDirtClod(desiredposx#,desiredposy#,desiredposz#,maxsize,gravityrate#,clodlife,liftrate#,clodradius#,cimode)
Dclodpositionx#(CurrentDClod(1))=desiredposx#
Dclodpositiony#(CurrentDClod(1))=desiredposy#
Dclodpositionz#(CurrentDClod(1))=desiredposz#
Dcloding(CurrentDClod(1))=1
Dclodsize(CurrentDClod(1))=maxsize
DclodGravity#(CurrentDClod(1))=liftrate#
DclodGravityRate#(CurrentDClod(1))=gravityrate#
Dclodlife(CurrentDClod(1))=dlife
Dclodradius#(CurrentDClod(1))=dradius#
Dcloddirection(CurrentDClod(1))=rnd(360)
DclodImageMode(CurrentDClod(1))=cimode
if DclodImageMode(CurrentDClod(1))=1
set object transparency 30500+CurrentDClod(1),2
set alpha mapping on 30500+CurrentDClod(1),70
else
ghost object on 30500+CurrentDClod(1)
fade object 30500+CurrentDClod(1),70
endif
CurrentDClod(1)=CurrentDClod(1)+1
if CurrentDClod(1)>500 then CurrentDClod(1)=1
endfunction
rem request spark
function RequestSpark(desiredposx#,desiredposy#,desiredposz#,maxsize,gravityrate#,scalerate,liftrate#,dradius#,faderate,simode)
Sparkpositionx#(CurrentSpark(1))=desiredposx#
Sparkpositiony#(CurrentSpark(1))=desiredposy#
Sparkpositionz#(CurrentSpark(1))=desiredposz#
Sparking(CurrentSpark(1))=1
Sparksize(CurrentSpark(1))=maxsize
SparkGravity#(CurrentSpark(1))=liftrate#
SparkGravityRate#(CurrentSpark(1))=gravityrate#
Sparkscalerate(CurrentSpark(1))=scalerate
Sparkradius#(CurrentSpark(1))=dradius#
Sparkdirection(CurrentSpark(1))=rnd(360)
Sparkfaderate(CurrentSpark(1))=faderate
SparkImageMode(CurrentSpark(1))=simode
if DclodImageMode(CurrentSpark(1))=1
set object transparency 31000+CurrentSpark(1),2
set alpha mapping on 31000+CurrentSpark(1),70
else
ghost object on 31000+CurrentSpark(1)
fade object 31000+CurrentSpark(1),70
endif
CurrentSpark(1)=CurrentSpark(1)+1
if CurrentSpark(1)>500 then CurrentSpark(1)=1
endfunction
rem handle dirt smoke
HandleDirtSmoke:
for CDSmoke=30000 to 30500
arraycount=CDSmoke-29999
if Dsmoking(arraycount)=1
show object CDSmoke
position object CDSmoke,Dsmokepositionx#(arraycount),Dsmokepositiony#(arraycount),Dsmokepositionz#(arraycount)
point object CDSmoke,camera position x(),camera position y(),camera position z()
scale object CDSmoke,Dsmokescale(arraycount),Dsmokescale(arraycount),Dsmokescale(arraycount)
if DSmokeImageMode(arraycount)=1
set object transparency CDSmoke,2
set alpha mapping on CDSmoke,Dsmokefade(arraycount)
else
ghost object on CDSmoke
fade object CDSmoke,Dsmokefade(arraycount)
endif
if Dsmokefade(arraycount)>=0+Dsmokefadespeed(arraycount)
Dsmokefade(arraycount)=Dsmokefade(arraycount)-Dsmokefadespeed(arraycount)
endif
if Dsmokescale(arraycount)<Dsmokesize(arraycount)
Dsmokescale(arraycount)=Dsmokescale(arraycount)+Dsmokescalerate(arraycount)
endif
Dsmokepositiony#(arraycount)=Dsmokepositiony#(arraycount)+Dsmokeliftrate#(arraycount)
if Dsmokescale(arraycount)>=Dsmokesize(arraycount)
Dsmoking(arraycount)=0
Dsmokescale(arraycount)=0
Dsmokefade(arraycount)=100
Dsmokefadespeed(arraycount)=0
position object CDSmoke,0,0,0
ghost object off CDSmoke
set object transparency CDSmoke,0
hide object CDSmoke
DSmokeImageMode(arraycount)=0
endif
endif
next CDSmoke
return
rem handle dirt clods
HandleDirtClods:
for CSmoke=30501 to 31000
arraycount=CSmoke-30500
if DCloding(arraycount)=1
show object CSmoke
position object CSmoke,Dclodpositionx#(arraycount),Dclodpositiony#(arraycount),Dclodpositionz#(arraycount)
point object CSmoke,camera position x(),camera position y(),camera position z()
scale object CSmoke,Dclodsize(arraycount),Dclodsize(arraycount),Dclodsize(arraycount)
Dclodpositionx#(arraycount)=newxvalue(Dclodpositionx#(arraycount),Dcloddirection(arraycount),Dclodradius#(arraycount))
Dclodpositionz#(arraycount)=newzvalue(Dclodpositionz#(arraycount),Dcloddirection(arraycount),Dclodradius#(arraycount))
Dclodgravity#(arraycount)=Dclodgravity#(arraycount)-Dclodgravityrate#(arraycount)
Dclodpositiony#(arraycount)=Dclodpositiony#(arraycount)+Dclodgravity#(arraycount)
if Dclodlife(arraycount)<=0
Dcloding(arraycount)=0
rem scale object CSmoke,0,0,0
position object CSmoke,0,0,0
ghost object off CSmoke
set alpha mapping on CSmoke,0
set object transparency CSmoke,0
hide object CSmoke
else
Dclodlife(arraycount)=Dclodlife(arraycount)-1
endif
endif
next CSmoke
return
rem handle sparks
HandleSparks:
for CSmoke=31001 to 31500
arraycount=CSmoke-31000
if Sparking(arraycount)=1
show object CSmoke
position object CSmoke,Sparkpositionx#(arraycount),Sparkpositiony#(arraycount),Sparkpositionz#(arraycount)
point object CSmoke,camera position x(),camera position y(),camera position z()
scale object CSmoke,Sparkscale(arraycount),Sparkscale(arraycount),Sparkscale(arraycount)
Sparkpositionx#(arraycount)=newxvalue(Sparkpositionx#(arraycount),Sparkdirection(arraycount),Sparkradius#(arraycount))
Sparkpositionz#(arraycount)=newzvalue(Sparkpositionz#(arraycount),Sparkdirection(arraycount),Sparkradius#(arraycount))
if SparkScale(arraycount)<Sparksize(arraycount)
Sparkscale(arraycount)=Sparkscale(arraycount)+Sparkscalerate(arraycount)
endif
Sparkgravity#(arraycount)=Sparkgravity#(arraycount)-Sparkgravityrate#(arraycount)
Sparkpositiony#(arraycount)=Sparkpositiony#(arraycount)+Sparkgravity#(arraycount)
if SparkImageMode(arraycount)=1
set object transparency CSmoke,2
set alpha mapping on CSmoke,Sparkfade(arraycount)
else
ghost object on CSmoke
fade object CSmoke,Sparkfade(arraycount)
endif
if Sparkfade(arraycount)>=0+Sparkfaderate(arraycount)
Sparkfade(arraycount)=Sparkfade(arraycount)-Sparkfaderate(arraycount)
else
Sparking(arraycount)=0
Sparkscale(arraycount)=100
Sparkfade(arraycount)=100
ghost object off CSmoke
set alpha mapping on CSmoke,0
set object transparency CSmoke,0
scale object CSmoke,0,0,0
position object CSmoke,0,0,0
endif
endif
next CSmoke
return
rem load effects
LoadEffects:
rem load smoke
dim CurrentDSmoke(1)
dim DSmokeImageMode(501)
dim Dsmoking(501):dim Dsmokescale(501):dim Dsmokesize(501):dim Dsmokefade(501):dim Dsmokefadespeed(501):dim Dsmokescalerate(501):dim Dsmokeliftrate#(501):dim Dsmokepositionx#(501):dim Dsmokepositiony#(501):dim Dsmokepositionz#(501)
CurrentDSmoke(1)=1
for t=1 to 500
Dsmokefade(t)=100
next t
load image "dirtcloud1.png",500
for t=30000 to 30500
make object plain t,50,50
texture object t,500
set object ambient t,0
set object collision off t
hide object t
next t
rem load dirt clods
dim CurrentDClod(1):dim Dcloding(501):dim Dclodsize(501):dim DclodGravity#(501):dim DclodGravityrate#(501):dim Dclodlife(501):dim Dclodradius#(501):dim Dcloddirection(501):dim Dclodliftrate#(501):dim Dclodpositionx#(501):dim Dclodpositiony#(501):dim Dclodpositionz#(501)
dim DclodImageMode(501)
CurrentDClod(1)=1
load image "dirt_chunk.png",501
for t=30501 to 31000
make object plain t,10,10
texture object t,501
set object collision off t
set object ambient t,0
hide object t
next t
rem load sparks
dim CurrentSpark(1):dim Sparking(501):dim Sparkscale(501):dim Sparksize(501):dim SparkGravity#(501):dim SparkGravityrate#(501):dim Sparkscalerate(501):dim Sparkradius#(501):dim Sparkdirection(501):dim Sparkliftrate#(501):dim Sparkfaderate(501):dim Sparkfade(501):dim Sparkpositionx#(501):dim Sparkpositiony#(501):dim Sparkpositionz#(501)
dim SparkImageMode(501)
CurrentSpark(1)=1
for t=1 to 501
Sparkscale(t)=100
next t
load image "spark_orange2.png",502
for t=31001 to 31500
make object plain t,1,1
texture object t,502
set object ambient t,0
set object collision off t
hide object t
next t
return
Simply copy in the above code to the end of your code,
outside of the program loop. Then,
inside your loop somewhere, put in these statements:
rem handle dirt smoke
gosub HandleDirtSmoke
rem handle dirt clods
gosub HandleDirtClods
rem handle sparks
gosub HandleSparks
Also don't forget to load the effects! Put this code before your program loop, and make sure you have some images in the folder for it to load! You can easily rename it if you have to:
rem load effects
gosub LoadEffects
And whenever you want some dust, type:
RequestDirtSmoke(xpos#,ypos#,zpos#,maxsize,imagefaderate,scalerate,liftrate#,imagemode)
Set image mode to 1, 2 or 3 to find the best mode that matches your image. This must be 1, 2 or 3! Modes 1 and 2 are different transparency methods to match your images so that there will be no squares around the smoke. Mode 3 is a special version of mode 2. It allows for certain images that are solid to look more see through, which increases the effect. Mode 3 will probably decrease the apparent size of the effect, so beware! Most png images will probably use mode 1
Similarily, for dirt clods, request them with statement:
RequestDirtClod(posx#,posy#,posz#,maxsize,gravityrate#,life,liftrate#,radius#,imagemode)
There is only image mode 1 and 2 for this effect.
And for Sparks:
RequestSpark(posx#,posy#,posz#,maxsize,gravityrate#,scalerate,liftrate#,radius#,faderate,imagemode)
There is also only image mode 1 and 2 for this effect.
Next up, rubble effects (metal chunks, etc. from an explosion).
Stay tuned!
Uncle Sam
Nvidia Geforce 7600 GS 256MB PCIEx, 2.66 GHZ Pentium 4 proccessor, 768MB RAM
Need particles? Click
here!