Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Explosion and special effects demo

Author
Message
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 13th Nov 2004 03:00
darkdomy: Thanks for the compliments, I am glad that my code could help you out with your projects.

X Trade: This demo was to just demonstrate how the special effects are created, i.e. the smoke, shockwaves, explosions, etc. It is very simple to do what you want; however, it requires a little bit different approach, which you understand. In my demo, when the ship is shot, it immediately blows up. In your space game, when the ship is dead, you would just set a varialbe, or array, to show that it is dead. Now, if this variable, let't say "shipdead" equals one, then do not allow it to be controlled any more, but keep moving it:

Pseudo code (or, if you're Ilya, psycho code)

Ship being killed, time stored


This is in your main game loop, when you control your ship


You just keep the ship moving, but don't intelligently control its movement; i.e. don't make it find new targets. Now, as it is dying, make it smoke and flame by finding smoke and flame objects. This is where my special effects code comes in.



Now, in your main game loop you need to check how long it has been since it has been dead to know when to blow it up:



That is when you call the final explosion gosub and destroy the ship once and for all. Just don't create a destroyed ship object, don't add gravity to the debris, and make your debris shrink as time passes so it gradually disappears.

I hope that answered your question, I think you should be able to get it. If a lot of people really need a code example I suppose I could write one up...

Xander Moser - Bolt Software - Firewall
Philip
21
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 20th Nov 2004 06:15
Interestingly I was looking at Bolt's demo just the other day. I noticed that the ghosting issues with recent DBPro updates appear to have mucked up the shockwave effect. The problem is that the expanding shockwave plane and its overlap with the expanding explosion plane do not quite ghost properly. The top side of the explosion plane appears to overwrite the shockwave plane.

I've tried a disable object zwrite but that didn't fix it. Any ideas anybody?

Philip

What do you mean, bears aren't supposed to wear hats and a tie? P3.2ghz / 1 gig / GeForce FX 5900 128meg / WinXP home
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 21st Nov 2004 15:51 Edited at: 21st Nov 2004 15:55
Not much you can do, Phil. It's the lack of Z-Sort. The only thing i could think of off hand would be the priority buffer, but since both objects are ghosted, they are already drawn last.

Nice work on this wonderful code, Bolt! I modified it a little to make the ships spin faster after you blow them up and it becomes REALLY addictive. Great stress reliever, and a wonderful demo for showing how special effects can be done. Keep it up !

[Edit] -- Scratch what I said in first para, phil. Just realized there is no "right way" to draw the graphics. Not sure how you could fix it. The depth sort wouldn't work either I don't think.... disable object zwrite on the explosion and not the shockwave maybe?... YEP! Change line ~92 to:

if i=2 then texture object exobject(a,i),lightimage: disable object zwrite exobject(a,i)

fixes it here!


Home of DOOP, Strata Works, and Height
The Wendigo
22
Years of Service
User Offline
Joined: 13th Sep 2002
Location: A hole near the base of a tree in the US
Posted: 22nd Nov 2004 17:53
Been playing with this code. I fixed the smoke error in DBP. Since I don't have the code uploaded I'll just explain what I did:

First I made a single frame smoke texture as a TARGA with an alpha mask (looks great... I used yours ). Then What I did was rewrote some code to load it as an image instead of a bitmap, directly. Next, where you changed the frame to simluate the translucency effect, I replaced it with Set Alpha Mapping On. Last, but not least, I was getting some really annoying Z-Buffer problems so I used DISABLE OBJECT ZREAD to correct it. Normally, I would almost never use that command, but it worked fine for this example. Hopefully i'll post it all soon if you want. It really isn't much of a modification, just the smoke is back .


Home of DOOP, Strata Works, and Height
Xander
21
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 24th Nov 2004 02:01
Thanks Wendigo, I appreciate it.

Glad you got the smoke working. I don't use DB Pro right now...I still have to download the patch, not sure when I'll get around to it.

Xander Moser - Bolt Software - Firewall
NinJA99
19
Years of Service
User Offline
Joined: 21st Jan 2005
Location: Windham, NH
Posted: 23rd Jan 2005 02:50
AWESOME!!!!

Login to post a reply

Server time is: 2024-11-23 18:45:55
Your offset time is: 2024-11-23 18:45:55