How do sprites work?
-
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
How do sprites work?
I don't really have much knowledge as to how sprites work. I have a series of images that I have made into a .spr file for an explosion sprite, but I don't know how to actually call the sprite's "animation"... I know that either the model for the entity that is exploding needs to be changed to the sprite, or the original model gets removed, then the sprite is spawned as a temporary entity. This much I understand and know how to do, but when it comes to playing the sprite's animation, I am lost.
Re: How do sprites work?
afaik the animations works like this:
s_explode1 (); calls the animation from s_explod.spr
0,1,2,3,4 and 5 are the frames from the explosion sprite.
This is from qcv1.06, found in the weapons.qc.
afaik BecomeExplosion is called when a grenade, rocket and a barrel explodes.
Code: Select all
void() BecomeExplosion =
{
self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0';
self.touch = SUB_Null;
setmodel (self, "progs/s_explod.spr");
self.solid = SOLID_NOT;
s_explode1 ();
};
Code: Select all
void() s_explode1 = [0, s_explode2] {};
void() s_explode2 = [1, s_explode3] {};
void() s_explode3 = [2, s_explode4] {};
void() s_explode4 = [3, s_explode5] {};
void() s_explode5 = [4, s_explode6] {};
void() s_explode6 = [5, SUB_Remove] {};
This is from qcv1.06, found in the weapons.qc.
afaik BecomeExplosion is called when a grenade, rocket and a barrel explodes.
-
- Posts: 170
- Joined: Thu Aug 19, 2010 9:58 pm
Re: How do sprites work?
Oh, ok. Thanks for that. I looked at that before, but I never noticed the frame numbers in the s_explode functions. That's definitely what I was looking for, Thank you.
Re: How do sprites work?
The Plasmagun from Dr. Shadowborg´s Hellsmash is a nice example what you can do with sprites
Re: How do sprites work?
Nice info, I forgot this was something I was trying to modify a while back myself. I also learned you have to use frame numbers in that statement, IE:
...will not compile, at least not in Frikqc. You can play around in those frames and put in some extra effects, IE:
Adding an extra random frame gives the appearance of a longer lasting explosion. Of course, be careful with [self] , in this example I applied those floats the player who launched the rocket to have those present in his [missile.] entity generation code as well.
One thing I wanted to do is find a way using the particle command to maybe draw a smoke cloud that gradually dissapapates , in the area where the explosion took place. Or draw it using a new sprite model that represents a decent size smoke could with frames that eventually evolve to show it dissipate into the air.
Code: Select all
void() s_explode1 = [rint (random ()* 6), s_explode2] {};
Code: Select all
void () s_explode3 = [ 2, s_explode4 ]
{
if (self.items & IT_QUAD) // has Quad
if ((self.player_flag & ITEM_RUNE2_FLAG)) // Has strength rune in ctf....
self.effects = EF_BRIGHTFIELD;
self.frame = rint (random () * 6);
};
One thing I wanted to do is find a way using the particle command to maybe draw a smoke cloud that gradually dissapapates , in the area where the explosion took place. Or draw it using a new sprite model that represents a decent size smoke could with frames that eventually evolve to show it dissipate into the air.
Re: How do sprites work?
afaik Kurok has a Smokesprite on the explosions.
Code: Select all
void() s_smoke1 = [0, s_smoke2] {setmodel (self, "progs/s_smoke.spr");self.nextthink = time + 3 + random()*0.5;self.velocity = '0 0 8';};
void() s_smoke2 = [1, s_smoke3] {self.nextthink = time + 3 + random()*0.5;};
void() s_smoke3 = [2, s_smoke4] {self.nextthink = time + 3 + random()*0.5;};
void() s_smoke4 = [3, s_smoke5] {self.nextthink = time + 3 + random()*0.5;};
void() s_smoke5 = [4, s_smoke6] {self.nextthink = time + 3 + random()*0.5;};
void() s_smoke6 = [5, SUB_Remove] {self.nextthink = time + 3 + random()*0.5;};
-
- Posts: 336
- Joined: Thu Nov 12, 2009 4:37 am
Re: How do sprites work?
If you are using darkplaces you can use effectinfo.txt to customize all the TE_EFFECTS to your liking.Cobalt wrote: One thing I wanted to do is find a way using the particle command to maybe draw a smoke cloud that gradually dissapapates , in the area where the explosion took place. Or draw it using a new sprite model that represents a decent size smoke could with frames that eventually evolve to show it dissipate into the air.
Code: Select all
effect TE_EXPLOSION
underwater
count 128
type bubble
tex 62 62
color 0x404040 0x808080
size 2 2
alpha 128 256 64
gravity -0.125
bounce 1.5
liquidfriction 0.25
originjitter 16 16 16
velocityjitter 96 96 96
effect TE_EXPLOSION
notunderwater
count 128
type spark
color 0x903010 0xFFD030
size 4 4
alpha 0 256 512
gravity 1
airfriction 0.2
liquidfriction 0.8
velocityoffset 0 0 80
velocityjitter 256 256 350
effect TE_EXPLOSION
notunderwater
count 3
type smoke
color 0x202020 0x404040
tex 0 8
size 60 60
sizeincrease 2
alpha 30 80 8
bounce -1
lighttime 0
airfriction 0.1
liquidfriction 1
velocityjitter 30 30 30
rotate 0 15 20 50
effect TE_EXPLOSION
countabsolute 1
type decal
tex 8 16
size 48 48
alpha 256 256 0
originjitter 40 40 40
effect TE_EXPLOSION
lightradius 450
lightradiusfade 700
lightcolor 4 2 0.5
Re: How do sprites work?
Hello Cobalt,
you can create your own spawners of particle effects, just as you mentioned.
You are independent from original Quake TE_ and TR_ standard effects.
Please look into the source of the "small mod compilation" to find many samples.
Making use of:
1.) DP_SV_POINTPARTICLES
2.) DP_ENT_TRAILEFFECTNUM
1.) is entitiy independent and can be spawned everywhere at anytime.
2.) is used like "self.effects". It follows the entity and vanishes together with it.
Also "time-related" particle effects are possible with the help of a small QC time loop.
It is used for the armor effect in the "small mod compilation".
http://www.youtube.com/watch?v=vEKXWYTp ... JYVDt5j-UM
Best wishes,
Seven
you can create your own spawners of particle effects, just as you mentioned.
You are independent from original Quake TE_ and TR_ standard effects.
Please look into the source of the "small mod compilation" to find many samples.
Making use of:
1.) DP_SV_POINTPARTICLES
2.) DP_ENT_TRAILEFFECTNUM
1.) is entitiy independent and can be spawned everywhere at anytime.
2.) is used like "self.effects". It follows the entity and vanishes together with it.
Also "time-related" particle effects are possible with the help of a small QC time loop.
It is used for the armor effect in the "small mod compilation".
http://www.youtube.com/watch?v=vEKXWYTp ... JYVDt5j-UM
Best wishes,
Seven