News | Forum | People | FAQ | Links | Search | Register | Log in
Coding Help
This is a counterpart to the "Mapping Help" thread. If you need help with QuakeC coding, or questions about how to do some engine modification, this is the place for you! We've got a few coders here on the forum and hopefully someone knows the answer.
First | Previous | Next | Last
Aha 
So it's like the counterpart to the "private fields" trick, which creates a field mappers can't set on your entities by naming the field with a leading underscore... 
 
Quoth for instance uses it to sort out the screen tints for the custom powerups, restore stuffcmds the mapper has applied, and warn you if you load an incompatible save from an earlier version of the mod.

Really?

I've spent a long time thrashing around in qc trying to figure out how to do all of those things.

A big thank you, once again, for keeping the Quoth source closed, so that nobody can learn anything from it until revealed years later on Preach's blog. 
 
Got it working, but I had to use "nosave float" and not "float nosave" like your post says. This is with the latest fteqcc downloaded from the super-secret triptohell moodles directory above. 
Yeah, Well 
There aren't any trade secrets in Quoth, if there's any other features people want to understand just shout and I'll put it on the tutorial list. Thanks for the pointer on the keyword order, I'll fix that in the text. 
QC Blackbox 
There aren't any trade secrets in Quoth, if there's any other features people want to understand just shout

I think you are completely wrong! I have seen CZG, necro, Kinn and metlslime QC files and all of them were amazing sets of code which has made my understanding of QC better. I think you seriously under estimate the value of letting people see a working codebase. Cherry picking examples is all well and good but seeing the whole picture is damn right educational.

For example I would love to see the AI code for a bob from Quoth, I love how they move, shoot and even their crazy death is cool. Another gem I would love to see is the working code for the ladders in Quoth, not text descriptions but actually working QC files.

There are tons of things about Quoth QC that would be awesome to look at and I personally believe the greatest thing you could ever do for this community is let people see what QC tricks you have done. 
Hm 
I should probably post the RMQ qc somewhere.

<Most hated project ever yadda yadda go fuck yourself>

Would any of the people the above didn't apply to be interested in seeing it?

There are some gems in there, like Supa's NPC code and the Shambler lightning attack visual improvement.

Exploding zombies and fast zombies were mine, and pretty cool if I do say so myself :>

I think next map (after I release the current one) will have the exploders in it. 
 
For all its faults, RMQ had some wonderful things in the qc. 
RJ's 
Map were also incredibly epic... 
Maps 
 
...rj's Maps... 
Ugh 
Wish those would get released standalone. 
Can Somebody Smart Do This Thing But For Scrags. 
 
That looks flocking amazing! 
Using FTEQCC 
Why is:
void() frame = [ $f1, self.th_run ] {};
not allowed?

error: Type mismatch on redeclaration of self. void (), should be entity 
QC Opcodes 
In short, because the newthink function has to be determined at compile time for the frame definitions to work.

In long: the [frame, newthink] notation in QC is usually described as a shorthand, but it's actually a bit more than that. When QC is compiled it gets turned into opcodes (like java). Most of the opcodes are pretty generic and normal, but for efficiency reasons that made sense in '96 there's a special opcode which does all the basic monster housekeeping:

* it sets the frame
* it sets the new think function
* it sets nextthink to time 0.1

The only way to create something with this opcode is to use the special [] notation, but once you do, you're locked into using the opcode, and it needs to hardcode the function. I suppose in theory a compiler could treat the [] differently - detect when a dynamic expression has been input and in that case skip the opcode optimisation in favour or writing the relevant QC manually. Might break the principle of least surprise though... 
 
state functions need special handling if only because they're the one place where a variable can be used without prototyping it first.
this means that the qcc is expecting explicitly a function name and not a statement/formula, and is naturally complaining when the name it saw (self) was not in fact a function as required by the opcode.
the .th_run] part of the definition has not been tokenized yet. 
 
thanks, that makes sense. :) 
Aiming 
I've got a large enemy that fires twin streams of projectiles from either hand, each being offset quite a bit from the centre to either side.

The point they aim at has a scattered origin, randomising within a small volume to make the fire pattern more interesting.

In a small test map the enemy works fine, but in my main map it occasionally looks like it's the point of origin and not the point of aim that's getting slightly randomised.

Does this sound like an engine precision issue? 
 
depends how large your projectiles are.
with the vanilla network protocol, origins have 1/8th qu precision.
angles have 1/256th revolution precision

on a large object with offset origins (read: rotating bsp doors), the angular precision can result in significant jerks. this is generally not much of an issue with models though.

if you want to test if its an engine precision thing, try the following engine+cvar settings.
fte: compare sv_bigcoords 0(low/vanilla precision) to 1(16bit angles, 32bit float coords). restart the map for it to take effect.
dp: compare sv_protocol 'quake' (vanilla) to 'dpp7' (16bit angles, 32bit float coords), or whatever it was. not sure what you need to do to actually apply the new setting. 
They're Points 
So that pretty much rules that out. I need to debug again.

Thanks for the answer. 
 
you're using makevectors and v_* to do the offsets? 
 
yeah, makevectors(self.angles) is bad if self.angles_x will ever be anything but 0.
makevectors pitch angle is inverted relative to non-brush models (old id bug).
yes, its inverted relative to vectoangles too. 
No Makevectors... 
I got it working eventually in a testmap like I say, without any weirdness. Just in my large BSP2 it seems like the org (point of origin) is behaving like the vec (point of aim).


org1 = self.origin + v_forward * 20 + v_right * 36 + '0 0 24'; //right hand
org2 = self.origin + v_forward * 20 + v_right * -36 + '0 0 24'; //left hand

vec1 = self.enemy.origin + RandomOffset(22) - org1;
vec2 = self.enemy.origin + RandomOffset(22) - org2;


The RandomOffset function just does this:

local vector offset;

offset_x = crandom() * offset_amt;
offset_y = crandom() * offset_amt;
offset_z = crandom() * offset_amt;

return offset;


Am I missing something obvious there or taking something for granted? My coding is built on trial and lots of error, meaning I kn ow nothing of good practices etc. I don't have makevectors anywhere in the qc file actually... 
Well There's Yer Problem 
makevectors is where v_forward and v_right get populated. if you don't call it on self before doing all that, they'll be left over v_forward and v_right vectors from whatever thing last used them. 
Hah, So... 
It was all in my head about it only happening in the larger map.

Will test it out tonight, thanks. 
First | Previous | Next | Last
You must be logged in to post in this thread.
Website copyright © 2002-2025 John Fitzgibbons. All posts are copyright their respective authors.