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

real time effect

Started by Tran Minh Quang Aug 1, 2002 at 4:09 AM 5 replies 700+ views
Original Post
Tran Minh Quang
Tran Minh Quang
I am working on a tile engine program and want to implement real time effect in my program. The goal i want to do is: while i am scrolling there is a portion of map that has a fire burning. I know a simple animated tile method - changing tile using linked list but what i actually want here is: i can apply an algorithm to display effect in my map (real time effect). I need your help
flangazor
flangazor
What would be the basis ofyour realtime effect? A sprite particle generator (this will look like a fountain of orange cotton but some people think it looks like fire)? A mesh that flicks around in realtime?

When you figure that out, maybe you will be better equipped to handle this problem!
Carrot
Carrot
Is it a top-down view or a side-on view?

I used an algorithm for generating a fire effect a few years ago (it was written for VGA mode 0x13 using palletes but you could make it work with directX too).
The only problem is that you would need to write pixels dynamically to a surface but you could get it to work using billboards.

The idea (using set/get pixel) is this:

1. Create a false pallete map for say 100 colours
index
100 -> RGB white
:
: [gradually blending to orange]
:
80 -> Bright Orange
:
: [gradually blending to Yellow]
:
60 -> Bright Yellow
:
: [gradually blending to Red]
:
30 -> Bright Red
:
: [gradually blending to Black]
:
10 -> Bright Black
:
: [gradually blending to Blue]
:
0 -> Bright Blue

2. Create and clear a surface

3. Add a white pixel (index 100) with random horizontal offset along the bottom row

4. Do a pass through the whole surface averaging each set of (say) three horizontally adjacent pixels.

5. Scroll whole surface contents up one pixel

6. Repeat from step 3.


The averaging gives the illusion of a flame moving through the various colours as it rises up through the surface and the effect can be really good.

The colour indexes I give are just off the top of my head and calls for a certain amount of trial and error to get it looking right. The 'black' band at the end I found gave a great feeling of 'vapour' floating above the flame.

Also, there are better ways of implementing this other than set/get pixels, but you get the idea (I hope )




[edited by - carrot on August 1, 2002 12:36:21 PM]
Tran Minh Quang
Tran Minh Quang
Infact I know the algorithm to make a fire. The method has a name something like "using filter" - That is each time we caculate average color from 4 pixel below to apply to curent pixel we do a fact move a filter around our surface (I don''t know if it is a good explaination but Gamedev does have tutorial about fire effect). But my problem here is not how to make a fire but is: how to apply it to our map in a tile engine. Let me say: We have a map size 400x400 and larger than our screen to make a scrolling tile engine. We have a Player controlled by our keyboard. Consider the following part of map is in our view:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAFFFFFFFFFFFFFFAAAAAAAAAAAAAAAAAAAAA
AAAAAAFFFFFFFFFFFFFFAAAAAAPAAAAAAAAAAAAAA
AAAAAAFFFFFFFFFFFFFFAAAAAAPAAAAAAAAAAAAAA
AAAAAAFFFFFFFFFFFFFFAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Now the portion accompanied by "F" char represent the place where
our fire will burn. And P char represent our player. So what i want here is: when the the PLAYER is going in the part of map that has fire burning (represented by "F") we can see that fire is burning actually. The most important is: That fire is made by applying an making - fire algorithm,
ex: void MakeFire(...) in our program.
What do you think?
PS: DirectX has power tool to help us make a fire, in fact i made fire effect time ago but how to make it burned in a tile engine is a question for me now?










Tran Minh Quang
Tran Minh Quang
By the way, After making fire effect in Tile engine. I intend to make some other effect like: Pixel morphing, Fade, Snow effect, Thunder, Scrolling....So can you suggest me any link to bitmap (backgound image, sprites...) that i can use for my future program) Thanks.
Carrot
Carrot
quote:
Original post by DrunkenHyena
Carrot, umm, what does bright black look like?




doh!

[edited by - carrot on August 2, 2002 6:06:06 AM]

Topic Locked

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

Sign in to reply to this topic.