Darkplaces effectinfo and QC - how?

Discuss programming in the QuakeC language.
Post Reply
lth
Posts: 144
Joined: Thu Nov 11, 2004 1:15 pm

Darkplaces effectinfo and QC - how?

Post by lth »

Hi,

Anyone actually know how to add a new custom effect to a mod using effectinfo? I want to add a new grenade-trail-like effect.

So, some questions:
- When I create a new effect in effectinfo I give it a name: what does this name relate to? If I call it TR_PELLET, how do I decide in my QC what float value TR_PELLET should have in order to be detected and used?
- Is it possible to add custom sprites to effectinfo? How?

Any tutorials anyone can point me at would be greatly appreciated, I have searched for them but not found any.

If there isn't a "beginners' guide to effectinfo" then if people spew everything they know about effectinfo here, I will attempt to write one!

Thanks,

LTH
Chip
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland
Contact:

Post by Chip »

I created new fire and smoke effects, but I was working on a CSQC installation I found on the web, and I just replaced the functions, see where they appeared and I replicated that.

Let me search inside the source, and I'll come up with something you might use. It'll take a couple of days, though.

Check out my Vimeo channel for the smoke and fire tests: http://www.vimeo.com/butterflymedia

EDIT: I might say that this effect http://www.vimeo.com/6994514 is using two effectinfo.txt effects, placed one above the other.

It's pretty simple to do it, the hard part comes when tweaking and trying to make it look real. ;)
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
lth
Posts: 144
Joined: Thu Nov 11, 2004 1:15 pm

Post by lth »

Yeah, I saw some of your stuff a while ago, which is why I was interested :) Any help you can give is greatly appreciated.
LordHavoc
Posts: 322
Joined: Fri Nov 05, 2004 3:12 am
Location: western Oregon, USA
Contact:

Re: Darkplaces effectinfo and QC - how?

Post by LordHavoc »

lth wrote:Hi,

Anyone actually know how to add a new custom effect to a mod using effectinfo? I want to add a new grenade-trail-like effect.

So, some questions:
- When I create a new effect in effectinfo I give it a name: what does this name relate to? If I call it TR_PELLET, how do I decide in my QC what float value TR_PELLET should have in order to be detected and used?
If the name matches one of the engine-supported names, then it is a replacement for that engine effect (TE_GUNSHOT, etc).

Custom names can only be reached using pointparticles(particleeffectnum("shotgunpellet"), org, vel, num);
or trailparticles(particleeffectnum("rifletrail"), start, end);

Where the example strings are "shotgunpellet" and "rifletrail", any custom name works fine, however the same effectinfo.txt must be installed on both client and server so that they agree on the numbers for these names.

Multiple entries can have the same name and will be triggered at once (for example sparks, smoke, decal + light flash).
lth wrote:- Is it possible to add custom sprites to effectinfo? How?
The short answer is no, but it's not as hopeless as it sounds.

All particle textures must be in a single image (named particles/particlefont.tga ) in an 8x8 grid (that is to say, 64 total cells).

I discussed the idea of customizing the grid size and allowing a number of beams (repeating textures) on one side of the image, with divverent at one point, but it appears that he has not added such a feature.

You can get an example effectinfo.txt here:
http://icculus.org/twilight/darkplaces/ ... lefont.zip

The tex commands in the effectinfo.txt correspond to ranges of cells (0-63) in the font, so for example tex 8 16 will choose randomly from 8 9 10 11 12 13 14 15 (collectively the entire second row) when spawning each particle.

Take consideration of the blend mode used as well - for example the ordinary particle textures are white with an alpha channel, where as decals are full color but inverted (that is to say, a cyan blob on black will make a dark red stain in the middle of an otherwise white surface).
lth wrote:Any tutorials anyone can point me at would be greatly appreciated, I have searched for them but not found any.

If there isn't a "beginners' guide to effectinfo" then if people spew everything they know about effectinfo here, I will attempt to write one!

Thanks,

LTH
I'd appreciate it if someone writes such a guide :)
lth
Posts: 144
Joined: Thu Nov 11, 2004 1:15 pm

Post by lth »

Thanks, LH, that's a great help!
Supa
Posts: 164
Joined: Tue Oct 26, 2004 8:10 am

Post by Supa »

lth wrote:If there isn't a "beginners' guide to effectinfo" then if people spew everything they know about effectinfo here, I will attempt to write one!
While it isn't exactly a guide, Electro has documented most of the keys here.
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

I know, it is an old thread, that I just bumped.
Sorry for that.

But using "effectinfo.txt" very much for all of my mods, I always asked myself if there is a way to create custom effect names.

I was aware of "dpextensions.qc"´s: DP_SV_POINTPARTICLES, but never really fully understood and got it to work.

Now that LordHavoc himself explaines it with a nice example, I was finally able to create custom effects and use it in QC.

Thank you very much LordHavoc !

I am sure, that this is very interesting+helpful for many other DP modders as well.

Best wishes,
Seven
Nahuel
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Post by Nahuel »

Seven wrote:I know, it is an old thread, that I just bumped.
Sorry for that.

But using "effectinfo.txt" very much for all of my mods, I always asked myself if there is a way to create custom effect names.

I was aware of "dpextensions.qc"´s: DP_SV_POINTPARTICLES, but never really fully understood and got it to work.

Now that LordHavoc himself explaines it with a nice example, I was finally able to create custom effects and use it in QC.

Thank you very much LordHavoc !

I am sure, that this is very interesting+helpful for many other DP modders as well.

Best wishes,
Seven
:o HOW? WHERE? can you tell me?
Thanks!!!!!!! :D :D
hi, I am nahuel, I love quake and qc.
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

Dear Nahuel,

I am more than happy to help you.
After all the things you thaugt me the last weeks :)

I always had the problem, that I had to stick to the already existing effects in "effectinfo.txt":

Code: Select all

float TE_SPIKE          = 0;
float TE_SUPERSPIKE     = 1;
float TE_GUNSHOT        = 2;
float TE_EXPLOSION      = 3;
float TE_TAREXPLOSION   = 4;
float TE_LIGHTNING1     = 5;
float TE_LIGHTNING2     = 6;
float TE_WIZSPIKE       = 7;
float TE_KNIGHTSPIKE    = 8;
float TE_LIGHTNING3     = 9;
float TE_LAVASPLASH     = 10;
float TE_TELEPORT       = 11;
float   TE_EXPLOSION2   = 12;
float TE_BEAM           = 13; 
DP also knows some more Nexuiz effects (like: TE_TEI_SMOKE, EF_STARDUST, ...),
but I needed custom ones, that I could adjust as I needed.


Now what you want to do is the following (example:)

1. Open your effectinfo.txt in ID1 folder
2. Add a new effect to it (doesnt mater in which line), like:

Code: Select all

effect nahuel
notunderwater
count 12
type smoke
color 0x202020 0x404040
tex 0 8
size 12 12
sizeincrease 1
alpha 0 32 2
bounce -1
lighttime 0
airfriction 0.2
liquidfriction 1
velocityjitter 64 64 64    
3. Save it
4. Open your qc file and add this line wherever you need it (example):

Code: Select all

pointparticles(particleeffectnum("nahuel"), self.origin, '0 0 0', 1); 

Read "dpextensions.qc"´s: DP_SV_POINTPARTICLES for description of the other params.
5. Compile it

That is all you need. It is as simple as this.

I always had problems in defining the "float effectnum". I always thought, that a "float" can only be a number.
Thats why I tried to add the effect number (declared in defs.qc), which made it of course impossible to add custom effects.
That way I could only use the existing effects (mentioned above).

Now that LH explained, that instead of "float effectnum", we can also use "particleeffectnum("nahuel")", the last barrier was broken. lol


Have fun creating your own effects Nahuel.
And thanks again for your support.

Regards,
Seven

PS: If you are looking for a nice effect compilation (to start working with), you can find beautiful custom ones in this thread:
http://quakeone.com/forums/quake-help/q ... tiful.html[/url]
Last edited by Seven on Wed Jun 08, 2011 6:59 pm, edited 1 time in total.
Nahuel
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Post by Nahuel »

THANK you very much SEVEN for your simple and great tutorial!
I will experiment with new effects!
do you know if it is possible to have different effects in the collisions (nails and bullets) with SOLID_BSP ( with brushes ) according to the textures?
I believe that it would be great, I will experiment on this matter!!!!!
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
hi, I am nahuel, I love quake and qc.
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

Yes absolutely.

I know, that you have good QC skills.
So everything that is possible in QC is possible with effects as well.

You can declare a (if...then...) condition (in which you check the wall texture),
as you know DP has such a command.
And depending on this decision, you call different effects through "pointparticles" command.

I also have such a texture condition/check in my footsteps mod.
Depending on the texture name, the footstep sound is different.
This can of course also be used for an effect.
You can create almost infinite effects inside your effectinfo.txt.

If you are looking for a custom effect compilation to start with, I edited my above post and added a link.
Maybe this helps you a bit.

Best wishes,
Seven
Nahuel
Posts: 495
Joined: Wed Jan 12, 2011 8:42 pm
Location: mar del plata

Post by Nahuel »

Thanks again,
cool stuff, i will check it :) :)
hi, I am nahuel, I love quake and qc.
Post Reply