Skip to main content
GameDev.net gamedev.net
🔒 Locked

fire balls

Started by lethal encoding joe Sep 5, 2003 at 3:12 AM 9 replies 1.5k views
Original Post
lethal encoding joe
lethal encoding joe
hi all! is there some one who know how to produce a fire-ball algorythm? (non paletized, 16-bit per pixel based) thanx for advance!!!!!!!!!!!!!!
have a nice week.
CGameProgrammer
CGameProgrammer
All you do is draw lots of overlapping circular sprites or billboards. Each one is slightly offset from the next.

~CGameProgrammer( );

~CGameProgrammer( ); Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
lethal encoding joe
lethal encoding joe
well, how can you make it looking like a fireball?
where shall i put those circular sprites?(perhaps in a circular line using the trigonometric functions?)

thanx!!!

[edited by - lethal encoding joe on September 5, 2003 2:57:52 PM]
have a nice week.
lethal encoding joe
lethal encoding joe
oh yea, forgot to mention that i''ll be grateful if you will point me to some source code(C++, DIRECT DRAW/GDI/what ever)...

thanx for advance!!!!!
have a nice week.
CGameProgrammer
CGameProgrammer
I'd like to show you a screenshot of my fireball but I can't since it's disabled for the moment while I change some things. So here's a really bad drawing illustrating how it's done:



This shows a fireball moving right. To create a fireball, every frame you create one particle at the fireball's position, initially colored white or yellow. Over the next second you fade it out and change its color to orange or red. Because every frame you're creating a new particle at the fireball's new position (since it's moving) you end up with a trail like in the picture.

So in the picture, we've just created the white particle. The yellow one was from last frame, the orange from the frame before that, etc. The dark red particle is several frames old and is about to expire.

You have to have a working particle engine first.

~CGameProgrammer( );



[edited by - CGameProgrammer on September 5, 2003 3:37:11 PM]
~CGameProgrammer( ); Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
lethal encoding joe
lethal encoding joe
thanx man,

The thing is i''ve written a fire algorythm for 16BPP color depth
mode, and the problems are:
1)The fire is rendering at full screen and the next frame is based on the current so i cannot make it a "frame based".

2)I cannot make the fire look like a circular manner flame(the fireball i''ve want).

thanx though, i''ll try the things you''ve suggested nonetheless,
and i hope to see more suggestions...
have a nice week.
CGameProgrammer
CGameProgrammer
You misunderstand a bit. Each frame, you create a new sprite/billboard at the fireball''s new position, but you also keep drawing the old sprites at their original positions. This is how basically all games, 2D and 3D, draw fireballs.

~CGameProgrammer( );

~CGameProgrammer( ); Developer Image Exchange -- New Features: Upload screenshots of your games (size is unlimited) and upload the game itself (up to 10MB). Free. No registration needed.
bucheron
bucheron
As explained by CGProgrammer, you can make a trail with decreasing blending. For a better simulation, you also have to decrease the size of the sprite when you are moving towards the trail of the fireball. You can improve the effect by (randomly) adding some smaller fireballs on the trail. The blending is very important, I suggest to use a saturation (adding the colors together and clipping to 255). If you look at the picture below, you'll see the ball has darker zones. Simulate this by substracting (clipping to 0 if it's negative) some small flames on the main ball.

Look at the trail, at the end of the effect, it separates from the main ball, it's not hard to implement. You can use part of this picture to create your sprites. Last thing that would be cool is to add a glow around your fire, this can be simulated with a highly blurred version of the original fire sprite, zoomed with a ratio of about, say 1.3, and adding it with saturation and low alpha parameter over the main fireball.

Hope this helped




[edited by - bucheron on September 6, 2003 8:04:49 AM]
lethal encoding joe
lethal encoding joe
sorrey for double replying!

helped allot!

correct me if i'm wrong, you talking about making sprites,
and/or particles, i know this is beyond the scope of this kind
of forum, but how this is done in direct draw?(C++)

thanx!!!

[edited by - lethal encoding joe on September 6, 2003 3:13:52 PM]
have a nice week.
PaulCesar
PaulCesar
Using the blitting routeens. Essentialy, you are creating "particals" in the second dimmension.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.