Fire

Blitz3D Forums/Blitz3D Beginners Area/Fire

AJ00200(Posted 2009) [#1]
I need an easy way to make fire.
Does anyone know how.

PS, don't say rub 2 sticks together, I want real suggestions


GfK(Posted 2009) [#2]
Rub two sticks togeth... oh.... erm, particle systems. You need a particle system. Try Particle Candy.


AJ00200(Posted 2009) [#3]
Wow, that looks like it will be it.
Is there any free ones?

PS - LOL


AJ00200(Posted 2009) [#4]
Never mind,
Just got one out of the archives unless there's a free one you recommend.


josk(Posted 2009) [#5]
This is worth a look
Click here

I would recommend particle candy if you can afford it.


AJ00200(Posted 2009) [#6]
Yeah, that was the same one I found.
I don't really want to pay that much just to use fire, but thanks for your help.

With that other one, how would I make fire
(that code is way too big for me to look at)


josk(Posted 2009) [#7]
Look in the includes folder and open test_particles, its not a big file.

You should be able to rip some code from there to get a fire going.


Aussie(Posted 2009) [#8]
Gday.
Try this. http://www.blitzbasic.com/Community/posts.php?topic=80922#910970


Jerome Squalor(Posted 2009) [#9]
why don't you just do it yourself? just make a quick particle system and work with it a bit until you get it look how you want it. I myself never bothered with buying a particle system thingy ma jiggy. I dont know, it seems to me that the extra bit of work is ok considering all the other times you will probably use something as common as fire. I guess its just opinion...


AJ00200(Posted 2009) [#10]
I don't know much about particle systems, and I need to get it working soon, so I can't make my own.


_PJ_(Posted 2009) [#11]
A 'particle system' at te very simplest is simoly code to manage the production, recycling and deletion of small visual effects (i.e. particles), especially when these effects move in a set pattern or within other boundaries, so, unless you have a specific need for many particle effects all to be managed under the same system, you might as well coe your own for a specific effect requirement.

Essentially, fire / flames wobble a bit and move upwards, fading / disappearing at a critical height. Generally speaking, (normal 'orangey') flames are white at their hottest to red at the cool points.

So your particles which may be "wisp-like" sprites would have a setup something like:
Type Particle
Field Spr=CopySprite(MasterFlameSprite)
Field Size
End type


And the functions to emit/ update might e like this: (Just a quick scribble here. It may have typos in etc.)

Function SpawnFire(X,Y,Z,Size)
local EmitterPivot=CreatePivot()
PositionEntity EmitterPivot,X,Y,Z
For f=1 to Size
Flame.Particle = New Particle
EntityParent Flame\Spr,EmitterPivot
Next
End Function
 
Function UpdateFire(EmitterPivot)
For IterFlame.Particle=Each Particle
If (IterFlame\Emitter=EmitterPivot)
TranslateEntity IterFlame\Spr,Rand(-1,1),2,Rand(-1,1),True
If (EntityY(IterFlame\Spr,False)>(IterFlame\Size)))
PositionEntity IterFlame\Spr,0,0,0,False
Moveentity Iterflame\Spr,Rand(Size)- Size  shr True),0,Rand(Size)- Size  shr True)
EntityColour IterFlame\Spr,160+EntityDistance(IterFlame\Spr,EmitterPivot)),160,32
Next
End Function



GIB3D(Posted 2009) [#12]
3 Simple functions

CreateFire
UpdateFire
DeleteFire

What else could you possibly need?




_PJ_(Posted 2009) [#13]
What else could you possibly need?

Some marshmallows? :D


GIB3D(Posted 2009) [#14]
Hehe, now I'm obsessed with making it look better and better, here's this.

Edit: Changed it so now you can set your own speeds for rising and moving horizontally.



Woowee this is kinda fun. Now I wanna make a customizable option for the size that it starts on, and what it will be when it finishes. Hmm I just have to figure out the math for that.

Edit: I guess I'm gonna have to take a little trip to GarrysMod to take a closer look at the Trails that you can add to props. You can choose their Start Size and their End Size, so here I go.


_PJ_(Posted 2009) [#15]
And thus... a particle system is born...........

:)


GIB3D(Posted 2009) [#16]
I'm glad you like it, it's extremely easy to make. I've also been TRYING to figure out 2D collision like blitz3d does with 3D collision after UpdateWorld but it's kinda hard. Mostly because I don't have enough information.

I figured it out, the code for going through starting and ending size over time is found in the UpdateFire() in the variable LifeScale




And now for those with Blitz3D+.dll I added a Light Range Limit.
Download Blitz3D+.dll here
http://www.blitzbasic.com/Community/posts.php?topic=75711





AJ00200(Posted 2009) [#17]
Thanks everyone.
Ill see what I can do.
If mine turns out good, Ill put it in the code arcs, and on my website.

If all else fails, I'll use someone else's.

Thanks again,
AJ00200