Engine traceline?
Moderator: InsideQC Admins
23 posts
• Page 1 of 2 • 1, 2
Engine traceline?
What would an engine traceline look like?
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
(-_-)___________________________________________(-_-)
I coulda swore I seen something in the engine concerning tracelines(Using them in the engine, rather than qc)
I coulda swore I seen something in the engine concerning tracelines(Using them in the engine, rather than qc)
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
Explain further what you mean?
I reworked MH's chase-cam fix into a client-side visibility function.
If that is what you are looking for, I can post it here. But explain what you are trying to do? Are you talking server side (QuakeC) or client side?
I reworked MH's chase-cam fix into a client-side visibility function.
If that is what you are looking for, I can post it here. But explain what you are trying to do? Are you talking server side (QuakeC) or client side?
The night is young. How else can I annoy the world before sunsrise?
Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
-

Baker - Posts: 3666
- Joined: Tue Mar 14, 2006 5:15 am
Baker wrote:I reworked MH's chase-cam fix into a client-side visibility function.
viewtopic.php?t=2711
hurray
-

Ranger366 - Posts: 203
- Joined: Thu Mar 18, 2010 5:51 pm
I mean like using a traceline in the engine. I have a traceline that I use in player_pre_think, and I can't find any way to make it false. It really is heavy on the framerate(I lose around 3-4 fps)
So I thought If I just did it in The engine, I might save some memory strains. And the function is to make the crosshairs turn red. when the traceline hits something that takes damage, the crosshair turns red.
So I thought If I just did it in The engine, I might save some memory strains. And the function is to make the crosshairs turn red. when the traceline hits something that takes damage, the crosshair turns red.
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
- Code: Select all
void TraceLine (vec3_t start, vec3_t end, vec3_t impact)
{
trace_t trace;
qboolean result;
Q_memset (&trace, 0, sizeof(trace));
trace.fraction = 1;
//result is true if end is empty...
result = SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace);
if (!result)//hit something
{
VectorCopy (trace.endpos, impact);
}
else
VectorCopy (end, impact);
}
unless you mean what the quakeC traceline looks like in C
- Code: Select all
/*
=================
PF_traceline
Used for use tracing and shot targeting
Traces are blocked by bbox and exact bsp entities, and also slide box entities
if the tryents flag is set.
traceline (vector1, vector2, tryents)
=================
*/
void PF_traceline (void)
{
float *v1, *v2;
trace_t trace;
int nomonsters;
edict_t *ent;
v1 = G_VECTOR(OFS_PARM0);
v2 = G_VECTOR(OFS_PARM1);
nomonsters = G_FLOAT(OFS_PARM2);
ent = G_EDICT(OFS_PARM3);
trace = SV_Move (v1, vec3_origin, vec3_origin, v2, nomonsters ? MOVE_NOMONSTERS : MOVE_NORMAL, ent);
pr_global_struct->trace_allsolid = trace.allsolid;
pr_global_struct->trace_startsolid = trace.startsolid;
pr_global_struct->trace_fraction = trace.fraction;
pr_global_struct->trace_inwater = trace.inwater;
pr_global_struct->trace_inopen = trace.inopen;
VectorCopy (trace.endpos, pr_global_struct->trace_endpos);
VectorCopy (trace.plane.normal, pr_global_struct->trace_plane_normal);
pr_global_struct->trace_plane_dist = trace.plane.dist;
if (trace.ent)
pr_global_struct->trace_ent = EDICT_TO_PROG(trace.ent);
else
pr_global_struct->trace_ent = EDICT_TO_PROG(sv.edicts);
}
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Mexicouger wrote:So I thought If I just did it in The engine, I might save some memory strains. And the function is to make the crosshairs turn red. when the traceline hits something that takes damage, the crosshair turns red.
Thing is though, traceline *is* in the engine. Its a builtin... Meaning its built in to the engine.
do a traceline, check trace_ent.takedamage. easy!
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Spike wrote:Mexicouger wrote:So I thought If I just did it in The engine, I might save some memory strains. And the function is to make the crosshairs turn red. when the traceline hits something that takes damage, the crosshair turns red.
Thing is though, traceline *is* in the engine. Its a builtin... Meaning its built in to the engine.
do a traceline, check trace_ent.takedamage. easy!
Thing is, I have nowhere to put it but playerprethink, Which I hate clogging that up. My intention was to maybe move it to the engine for a speed increase
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
The traceline is already done in engine code. All QC does is call the function. All the overhead isn't in the function call, it's what the function itself (which in the engine) is doing. Moving the traceline CALL to the engine won't solve anything.
In the other thread I posted an example of what mk suggested...
In the other thread I posted an example of what mk suggested...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
Mexicouger wrote:Spike wrote:Mexicouger wrote:So I thought If I just did it in The engine, I might save some memory strains. And the function is to make the crosshairs turn red. when the traceline hits something that takes damage, the crosshair turns red.
Thing is though, traceline *is* in the engine. Its a builtin... Meaning its built in to the engine.
do a traceline, check trace_ent.takedamage. easy!
Thing is, I have nowhere to put it but playerprethink, Which I hate clogging that up. My intention was to maybe move it to the engine for a speed increase
*sigh*
Shoving bad code into the engine won't make things magically works.
traceline is already as optmized as it can be. If your QC code is slowing things down, maybe you should first consider that your code is the culprit. What exactly are you trying to do ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
23 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 1 guest


