Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

baddrizz

best way to do fire under 16 - 32bit ???

This topic is 5988 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello again well like the topic says i''m looking for idea''s or code to look over that''ll help me learn how to do the fire effect in 16 24 or 32bit color i''v found lots of fire demo''s in 256colors but they don''t really help much cause i''m a newbie and don''t know how to use palette''s in win32 or ddraw i''v done some stuff in 16bit but nothing special, i''m hopping to learn the fire effect so i can move on to bigger effects like water or bump mapping in 16bit thx for any help

Share this post


Link to post
Share on other sites
Advertisement
Use particles... (not available for newb''s thoo)



''Qui habet aures audiendi audiat'' - Me

A link to the website of my 3D engine will follow as soon as I have something concrete to show... Which will be soon.

Share this post


Link to post
Share on other sites
You could make a fire texture and use some variation of the sine funcion to make the fire texture wave (like a flag). Then use billboarding to keep it facing the player.

Share this post


Link to post
Share on other sites
simple, you just need to do the EXACT same algorithm. ie.

1. seed bottom of screen with hot color
2. soften the screen
3. fade the screen to black (or use a larger pallete and do lookups)
4. repeat

Share this post


Link to post
Share on other sites
I''ve made a REALLY good-looking fire using OpenGL to draw it. If you''re interested, just give me an E-Mail. I really suggest you to look at it . Complete sourcecode, excutable, project files etc...

Share this post


Link to post
Share on other sites
Well, I guess if you want to use 256 colors examples than just use!!! You said you didn''t know how to deal with pallets... well you will know how to deal with *your* own pallete I guess. So just create a 8bit bitmap... and then look at a pallet for the colours you have to draw each pixel. I never wrote such a code (since I use allegro and it''s all pretty much done) but I guess you can do something like this:

int a;

typedef struct{
unsigned char r,g,b;
} rgb;
rgb pallete[256];

unsigned char bitmap8bpc[YOUR 8bit BITMAP WIDTH SIZE][YOUR 8bit BITMAP HEIGHT SIZE];

then you fill the pallete with the Red Green Blue values so that you create the color gradient for your fire. ex:
for (a=0;a<256;a++)
{
pallete
just do a loop that goes through the ''bitmap8bc'' and draw the pixels! something like this will work (I guess)(it suposes you are only gonna draw ''bitmap8bc'' using it, but you can change it if you want):

void blit8bits (x,y) /*draws ''bitmap8bpc'' to x,y position*/
{
int a,b,xa,ya,colour;
for (a=0;a{
for (b=0;b {
/*here i''m supposing you have a "color creation" routine ready for the colour bit you are using, just replace the hypothetic "create colour(r,g,b)" with it*/
colour = create_colour (pallete[bitmap8bpc[a]].r,pallete[bitmap8bpc[a][b]].g,pallete[bitmap8bpc[a][b]].b);
/*and then use your ''putpixel(x,y,colur)'' like routine*/
xa=a+x;ya=b+y;
putpixel (xa,ya,colour);
}
}

}

I guess that''s about it... if you don''t wan''t to have so much work just try using allegro (http://www.talula.demon.co.uk/allegro/)
because it does all the "hard work" like this...

I hope it helps a bit....
keep in mind I wrote it pretty fast and didn''t quit look back for mistakes...
' Target=_Blank>Link

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!