PDA

View Full Version : Fire!



IlovePascal
13-09-2006, 03:51 AM
Hello everyone, I've been making a simple turned-based 3D strategy game, and I've got to the point where I would like to add some cool visual effects to it.
So for example, I had a look at the Library in this website and found the very interesting article on simulating water, which I have already implemented in my game. I also read the one about fog, but didnt get much of it.
I was wondering if you guys could help me with ideas, 'tutorials', or bits of code, on things like explosions, fire, and maybe cloud effects. The main one I want is of course fire! lol.

Cheers ;)

czar
13-09-2006, 05:26 AM
How about some screen shots :)

DirectX or OpenGL?

IlovePascal
14-09-2006, 10:08 AM
Well, well, no screenshots quite yet, I need another couple of weeks to get it 'pretty' :D

You guys keep asking me "what 3D package?", "DirectX or OpenGL?" and all those names of software that Iv never heard!!
I just use Free Dev-Pascal 1.9.2. That's it, no package!

So, any ideas?

PS: btw, if you have a lot of time to spare and feel like telling me what
DirectX, OpenGL, JEDI-SDL, Asphyre, Omega, UnDelphiX, 3DStudio Max, Lightwave, Blender, Anim8or, are, it would be welcome. Because that's all the things Iv been asked if I have!
And I repeat, I only use Dev-Pascal, no Delphi, nothing! lol

NecroDOME
14-09-2006, 10:31 AM
simple explanation:

DirectX (from microsoft), OpenGL - API to connect your application with hardware

Asphyre, Omega, UnDelphiX - the easy way to connect your application with directx

3DStudio Max, Lightwave, Blender - 3D modeling program

IlovePascal
17-09-2006, 02:48 AM
Thanks for that! :thumbup:

Since I don't have any of those and I am constantly asked which one I have, I'm gonna get one! lol

Can everyone tell me what I should get, why, and where I could download it from??? (it has to be free)

Cheers ;)

PS: I would particularly appreciate to get Huehnerschaender's point of view on this matter because his game is AMAZING!!!

c yas

WILL
17-09-2006, 04:08 AM
Blender is free and so is a program called DeleD. Both do 3D modeling, but I cannot say which is better. :)

www.blender.org (http://www.blender.org/) for Blender
www.delgine.com (http://www.delgine.com/) for DeleD (They have some cool model packs too.)

IlovePascal
25-09-2006, 02:59 AM
cheers man. I downloaded Blender, jst have to figure out how to use it now!
Workin' on it...

c ya and any ideas on making fires and explosions are still welcome!!! (haven't seem many of them lately...! :) )

savage
25-10-2006, 08:38 AM
So any progress/screenies?

Huehnerschaender
25-10-2006, 11:16 AM
Hi,

I didn't recognize this thread until now...

Any help still wanted/needed?

Greetings,
Dirk

IlovePascal
27-10-2006, 07:14 AM
Hey!
Well, as you can see, there hasn't been many replies around here...
I had given up simulating fire and explosions for the moment because I couldnt get it figured out.

But of course I am still open to help and even encourage it!

For Blender, don't bother, it's not wat I needed.

Thanks in advance!

Huehnerschaender
27-10-2006, 11:34 AM
To give you some advices/hints/help I would like to know a little more about your game. You said it's a 3D strategy game. What about the camera view? Is it dynamic? Or a fixed view from top, side, etc.
Do you know how to use billboards?
What exactly do you want to know? How to make the graphics? A particle system? Explosions, fire, smoke?

Greetings,
Dirk

Nitrogen
27-10-2006, 12:51 PM
I've made a few programs dealing with fire and smoke....

Have a look at
http://www.nitrogen.za.org/projectinfo.asp?id=11 - Firestorm
Dont know how effective it would be for a 3D game, you probably better off with particles, but have a look anyway, it's fun to play around with...

And here's an example of 3D billboard particles:
http://www.nitrogen.za.org/projectinfo.asp?id=16 - Smokestack

IlovePascal
28-10-2006, 01:34 AM
Hello!
First of all, thank you all for your replies.

>to Savage: sorry I hadn't seen your reply, and i would be ashamed to show screenshots cos I've made lots of progress with AI and stuff, but that is not what shows on a screenshot, so no.

>to Nitrogen: I checked out your programs, the idea is pretty cool! However, I didn't manage to c the smoke one because it goes extremely fast and i dont know how to change the frequency.

>to Huehnerschaender, I understand I didnt give enough details, so let me elaborate :
It is a turn-based strategy game, inspired by Advance Wars (Gameboy), but in 3D.
camera: the camera is fixed in a way, but the environment rotates, so I guess in a way, it's as if the camera moved. To give you an idea, it's very much like Blender. Zooms, shifts, rotations.

I dont know what billboards are, so probably not.

What I had in mind was the following:
-to make was to make units explode when they are hit (a bit like your Tanx), which would be like an animation every time a unit is destroyed. So it would be a procedure that is called, does the explosion, then it all goes back to the main procedures, it is not constantly called in real time.
-to make units burn as they are not yet dead, so it would be a fire that keeps burning as the player plays. It would therefore have to be a real time animation, a dynamic fire that keeps burning.
-eventually some smoke as well, but that is not essential

The idea of a particle system sounds interesting, I have never made one, so I don't know how to start...and wouldn't that slow it down heaps tho? I heard particle systems were heavy on the RAM.

well, what else to say...? If you would like more details, don't hesitate!

C ya ;)

WILL
28-10-2006, 05:03 AM
You know if you really want to do special effects for 3D of all things, I don't think you want to remain doing it with a software renderer. You'll really want to do it with your GPU hardware.

If you seen in my <a herf='viewtopic.php?p=26041#26041'>Cyber-Crisis thread</a>, NecroDOME gave a great example of how to do explosions for example... but it involved the use of particles and rotations, scaling and blending. All of which run much nicer and faster on hardware.

I'd really recommend looking into either Direct3D, OpenGL graphical APIs. Myself, I like OpenGL's functionality and that it's cross platform. You can either use a set of headers (DelphiGL.com (http://www.delphigl.com/), FPC Repository, JEDI-SDL's inculded OpenGL headers (http://sourceforge.net/projects/jedi-sdl/), NeHe's headers (http://nehe.gamedev.net/), etc) or use a game engine/3rd party library like GLScene (http://glscene.sourceforge.net/), GLXtreme (http://www.glxtreem.net/), the really new Phoenix engine (http://phoenix.eonclash.com/index.php), Rage3D (http://www.rage-game-engine.za.net/), etc.

But then you might like Direct3D (D3D) instead so you can find headers for that at Clootie's site (http://www.clootie.ru/) and FPC Repository should have a set or try one of the DirectX-based game libraries that support 3D. Asphyre (http://www.afterwarp.net/) is the only one I can think of that really does Direct3D for what you want. Anyone feel free to correct me. ;) The current hardware accelerated UnDelphiX might fair better than the older versions but last time I looked into it, it wasn't too great. Last I checked Omega only did 2D.


But anyhow thats my suggestion. Without really knowing what graphics library or API you are using, I find it VERY hard to give you advice though.

IlovePascal
28-10-2006, 10:26 AM
hey, for the explosion, the video NecroDOME put on your Cyber-crisis thread is exactly the kinda thing I want!

I am planning on reading the tutorials he avised, but at the moment I just want to say, if he reads this, that it'd be awesome if he could share the code for the explosions.
I'm not sure how he did it, is it a particle system or a whole bunch of images like the tutorial that he gave the link to?

Well, if I manage to reproduce that, it'll be awesome, and I'll only need fire (which I might be able to derive from that actually), so thanks Will, thanks NecroDOME,

impatiently waiting for replies... :wink:

NecroDOME
28-10-2006, 11:05 AM
Maybe this van help:

http://www.alsprogrammingresource.com/particles.html

(OpenGL and C++)

About the fire: When you have a particle engine, the only thing you need to do is play around with it to get the effect you want...

The basics are to move, scale, rotate and blend your particles every frame.

EDIT: Forgot to past URL :P

http://www.geocities.com/foetsch/particles/particles.htm

IlovePascal
29-10-2006, 12:40 AM
hey NecroDOME, thanks for your help, I'll read through the stuff for now, might take me a week or so to try it, so...
c u all

Huehnerschaender
29-10-2006, 10:28 AM
Personally, I use Asphyre for my projects.

I tried (Un)DelhiX and GLScene before but in my opinion, Asphyre is a very great free framework which is still under development.

But using Asphyre assumes using Delphi.

The community found a way to integrate the Asphyre components to the free Turbo Delphi version. So this may be a start if you decide to use Asphyre without spending money on a new compiler.

To start, I can advise to download the latest Asphyre-package and take a look at the demos, especially Vulcano, Landscape and Combustion demo. They are included as executables, so even without Delphi you can take a look at them to get an idea about the (already included) particle system of Asphyre.

Let me know when you took a look at it.

Greetings,
Dirk

ASPYHRE homepage:

http://www.afterwarp.net

IlovePascal
10-11-2006, 11:59 PM
Sorry, sorry, sorry about not replying!
It's end of year exams period here, so im into a lot of study and very very busy.

I'll try to be quick:
>Huehnerschaender : I checked the Asphyre website you advised, but couldn't find a download link! Could you please specify?

>NecroDOME : I had a look at both those links, found them very interesting indeed, and tried making a couple of particle systems myself.
I didn't manage to make anything look like fire quite yet, but I'll work on it. Thanks for the help, and there's only one thing I'm nt sure of: you say it is important to rotate the particles each frame. Why rotate? and how?

I was also wondering: should I make each particle like a couple of pixels wide and have a lot of them, or rather like on http://www.alsprogrammingresource.com/particles.html which seems to make them quite large?

Thanx a lot, sorry for not updating this often,
c ya ;)

Huehnerschaender
11-11-2006, 01:26 AM
Hi there,

don't matter about response times.

If you don't answer quick it just means you are busy with whatever and so the answer is not urgent anyway.

Try this link:

http://www.afterwarp.net/forum/thread87.html

There you get the Asphyre version 3.10 (latest version).
Notice that Asphyre 4 is under construction and will be released this month (featuring animated mesh support, pixel shader support etc). I am very exhited about the new features, they are everything I was missing in Asphyre to define it "complete".

Greetings,
Dirk

IlovePascal
18-11-2006, 01:51 AM
Hello!

Huehnerschaender, thank you very much for your quick reply. I was wondering wether it would be more interesting to wait for the new version of Asphyre that you say will come out fairly soon.

I just had a very quick look around the Afterwarp.net website, looking for news of that new version, but as I gather, it is not out yet. I was thinking about waiting for it to come out, but it seems that we will have to pay for it, is that correct? If so, I will download the current version; otherwise, would you be kind enough to tell me when it comes out?

I had a look at your Engine2 video as well as your thread, and man! that's amazing!
You could be making your own version of Counter-Strike and earning tons! lol
I am very interested in learning those techniques! lol. Why don't your start an online tutorial page, going through the steps of making a 3D engine in detail? For example, I recently went through the Blender "Noob to Pro" tutorial from Wikipedia (http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro) and it is wonderful how useful it is. You might be able to make your own 'Wikibook' and help heaps of ppl.

Well, that's just an idea tht i hope you'll consider!

c ya!

Huehnerschaender
18-11-2006, 07:40 AM
Hi Ilovepascal,

the first version of new Asphyre should come out in Novemeber (that's what Lifepower estimated).
It will be for free as usual. As far as I know Lifepower, this will remain. Asphyre is free. You will surely get the possibility to donate some money if you want, but this is no duty (though I myself wouldn't mind if it isn't too much).

The things you have seen in the video will be available with sourcecode this weekend (I hope I find enough time to comment it well).

Btw, thanky for your comments :) But I don't think I have enough time to start what you suggest, nor do I think that my techniques are the best ones. Most of the things just come into my mind and I start programming, without knowing if there are much better and faster ways to do the same thing.

Anyway, the source for the first draft of the "engine" will be available, so the people can learn from it, make it better and help each other by adding new things or making suggestions. Personally, I will add my own new features after the release and then decide what I can make out of it.

Greetings,
Dirk

IlovePascal
01-12-2006, 10:39 PM
Hey there, November has come and gone...The new Asphyre must be out, ryt?
Im sorry I couldn't find where to download, could you please give me a link? Im very excited about trying to do what you do! (I saw your Engine3D! Amazing!)

Huehnerschaender
01-12-2006, 11:42 PM
The release date of Asphyre 4 was extended to middle of december. I guess we have to wait 2 more weeks or so :)

I have just ported the main units of the plantengine to DanJetX, which gives very cool results with the all ready landscape class from DanJetX.

See http://www.ericbehme.de/phpBB2DAN/viewtopic.php?t=151&postdays=0&postorder=asc&start=100

Greetings,
Dirk

IlovePascal
02-12-2006, 02:53 AM
Ditching Asphyre? lol
Is DanJetX a lot better?
Do you think as a beginner I could use it properly or should i go for something simpler?

Btw I read mst of the discussion in the thread and I dnt get half of it! lol

If you say I should download DanJetX instead, ill do (jst tell me where from!)

c ya

czar
02-12-2006, 03:10 AM
DanjetX is no more easier or harder to use than other systems.

For me I found it set out quite logically after having used delphix for ages.

http://dan.mirgames.ru/

You can download it there (URL ABOVE). Skills you learn with one system are easily transfered to others so there is no real reason to stick to one system.

DanjetX is rather good at 3d stuff - animated meshes etc.

On the project page for DJX Dan has posted a bunch of screen shots of programs made using DJX.

http://dan.mirgames.ru/main.php?page=djx

IlovePascal
02-12-2006, 03:19 AM
lol i was exactly on tht page right now! having a look. It's quite nice.

What I mean by beginner is like beginner at programing. Iv never used anything other than free Dev-Pascal.
I dnt even hav delphi!

Im willing to download everything that would be useful to make cool games tho and start learning.

Should i get delphi first then?

Huehnerschaender
02-12-2006, 08:04 AM
In fact, DanJetX has advantages when it comes to 3D. But I don't know what Asphyre 4 will bring, which is pointing right into that direction with the next release (Quake 3 model support, Shaders etc.). Asphyre has definitely the better 2D support. If I would like to make a game in 2D I always would stick with Asphyre. Also the particle engines of Aspyre will be interesting to you, because this thread started with fire creation.

I don't know what you want to do.... If you don't know Delphi, this might be the best point to start with!

Then try to do some easy things (maybe a 2D game... an easy one like Pacman, Tetris or something else to get the basics). For this purpose I would start with Asphyre, because it has many classes already done (Spriteengine, Particleengine etc).

In fact, I would not start with a 3D project if I didn't knew Delphi and have never done anything game related before. This might become very hard and you get stuck very soon.

If you are a little more advanced then you can consider yourself which component library fits to your needs best, because then you can understand the benefits of the one and the other.

Greetings,
Dirk

NecroDOME
02-12-2006, 11:21 AM
Nice plant engine. Grass looks good!

IlovePascal
03-12-2006, 02:45 AM
I suppose there are many versions of Delphi out there...
Any advice?

Btw, does any1 know of a free blog tht lets people download exe files?

IlovePascal
11-12-2006, 12:41 AM
Hey, check out my first fire! :D

I cant say this thread was very useful for any of this...but the important is that I did it! Jst needs to be smoother now I guess

http://upload4.postimage.org/1878045/fire.jpg (http://upload4.postimage.org/1878045/photo_hosting.html)

Any comments on improvements?

Huehnerschaender
11-12-2006, 03:48 PM
Yes, fire begins to look like fire when you add the following:

- The particles should get more and more transparent in time
- The particles should rotate and grow a bit in time
- Very essential: Add smoke

Greetings,
Dirk :)

IlovePascal
11-12-2006, 11:58 PM
thanks! Im definitely do that! Just a few questions beforehand :D :

When you say I should rotate them, do you mean like around a central vertical axis? If so, I already do that.

You also say they should grow in time...isn't that counter intuitive? I mean like, in my program, they become smaller with temperature (which decreases with time of course) and disappear when they are colder than a certain temperature. Why phenomenon would make them grow big? :shock:

About the smoke, should it come from the tip of the fire or rather from the whole burning area?

I'll make them more and more transparent when I get OpenGL working (I still haven't managed it... :( )...


Cheers ;)

WILL
12-12-2006, 03:09 AM
My recomendation.... light a match and watch it. Nothing tells a story like the real thing.

Just be sure to put it on something so your fingers don't burn. ;)

Huehnerschaender
12-12-2006, 10:26 AM
thanks! Im definitely do that! Just a few questions beforehand :D :

When you say I should rotate them, do you mean like around a central vertical axis? If so, I already do that.

You also say they should grow in time...isn't that counter intuitive? I mean like, in my program, they become smaller with temperature (which decreases with time of course) and disappear when they are colder than a certain temperature. Why phenomenon would make them grow big? :shock:

About the smoke, should it come from the tip of the fire or rather from the whole burning area?

I'll make them more and more transparent when I get OpenGL working (I still haven't managed it... :( )...


Cheers ;)

All this depends on which kind of fire you want to have and if it is 3D or 2D.

If you just want a torchlight or candle, then you are doing fine.
If you want to make explosions which e.g. should appear on an exploding petrol canister, then the things I mentioned need to be done.

The rotation and growth gives some motion to the fire. Growth only makes sense if the particles get transparent fast, or it will look strange. Also the smoke is very important to be transparent. I usually use a single texture for smoke and a single texture for the fire. The fire texture is used with different sizes and rotation and growth factors. This way the fire/explosion has enough motion and different color areas to let the viewer hardly recognize it's only one texture. Same to smoke... a single texture can be drawn as black smoke and white/gray smoke... rotation and growth factor (and of course life-duration factor!) makes it all very animated with only a single not animated texture... the single particles do not live long enough and move "too fast" to be investigated by the viewer. The more motion is in the fire, the more realistic it will look like.

But as I said in the beginning, I am speaking of fire in 3D space using Billboards and not all should be valid for small flames or candles and such things...

jasonf
12-12-2006, 11:55 AM
The absolute best fire I've seen in a game was in the original Unreal. It used realtime texture manipulation to make a really cool fire effect. When I saw it I was quite chuffed as I'd designed a similar effect myself, although the Unreal one was definately faster. I remember standing there watching it for ages..

I think that's the sign of a good fire effect. If you can make a pyro like me stand watching the flames, then you've cracked it :D

I was recently wondering how to make a decent Volume fire. But I don't think it will be possible until someone starts accellerating Voxels. Then we'll see some NICE Fire :D :twisted:

NecroDOME
12-12-2006, 12:13 PM
I remember standing there watching it for ages..

Done the same, also with the water and skys...

jasonf
12-12-2006, 01:05 PM
That first level when you make it out of the ship and you look up in the sky, the birds flying in the sky and the sun, fish in the water. All standard game tinsel now but amazing back then.

I've seen some fantasticly rendered fire in movies too, which looks so realistic. It's only a matter of time before it's possible to make completely believable fire in a game.

The spinning, growing particle trick can make some amazing effects, but every game uses this trick now and gamers' eyes are getting use to it.

I've just had a look at the planet unreal site, it's got some screen shots. It looks so dated now. I remember thinking it was the mutts nuts at the time.

jasonf
12-12-2006, 01:19 PM
OK, I've just looked at something at the GarageGames site (home of the Torque engine) and they've got an add-on pack (for Torque only) which has some really nice effects. http://www.garagegames.com/products/102/ I've posted this here because they have a video of the effects and it may give you some ideas about how they are done... and if you can figure it out, let me know.. 'cos I can't ;):D

IlovePascal
13-12-2006, 03:17 AM
Cool, thank you guys!

Now, there is one more thing I would like to ask (for the moment! :) )

What should my particles look like? Should they be a single pixel of a certain colour, or a wider circle, or something more complex, like a small btm for example, or something else?

Dan
13-12-2006, 05:14 AM
Seems like most people never mention a very important problem with particles in 3D... if you have a z buffer when you render particles, you will almost definetly see glitches where a raticle rendered earlier will make a particle rendered later partially or completely invisible. In that case disabling writing to z buffer somewhat solves the problem. However, imagine you have a particle system with a very thick smoke, and another system right behind it, say a fire. If the smoke system is rendered earlier than fire you will still see fire through the smoke, because the smoke doesnt write anything to z buffer. How would you people solve this problem? you wouldn't sort every particle by the distance to camera, would you?

Huehnerschaender
13-12-2006, 10:35 AM
@ILovePascal:
If you use a texture from a real fire explosion, it will look best.
Make it semitransparent. About half transparent in the middle and then the more to the edges of the texture, the more transparent it gets.

@Dan:
This is exactly how I do it (see above). Using semitransparent textures will makes it nearly regardless in which order the particles are displayed.
You can do the following to achieve an effect without obvious glitches:

You want to draw a fire/ an explosion at position x/y/z with a radius of r.

Spawn particles randomly in radius r around the position, defining the starting transparency more transparent dependend on the distance to the midpoint (points which are more far away are more transparent from startup).

I will show an example when we have a particle engine in DanJetX :)

Greetings,
Dirk

Dan
13-12-2006, 11:41 AM
Huehnerschaender,
I will try to code the problem and show it to you later...
If I make a particle engine in DJX with instancing then you wont be able to sort each particle easily... unless I somehow combine instancing with sorting.
The problem I'm talking about will only appear when you have a complex system with lots of different particles, some of them rendered with blend mode and some just semitransparent.