|
Posted by metlslime on 2007/08/08 04:57:56 |
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. |
|
|
Loading Bug?
#3552 posted by ranger on 2025/01/11 18:02:41
I got a bug that's been happening recently; when I load a saved game the models are all incorrect?
but it's seemingly fixed if i restart the map?
Loading Bug
#3553 posted by Preach on 2025/01/11 22:33:12
Hi Ranger, this is probably a variation on the issue I warned about in post 3532
https://celephais.net/board/view_thread.php?id=60097&start=3532&end=3532
If the save file dates back to an earlier version of the mod, and you've added, removed or reordered a model precache since then, you now have an incompatibility between your mod and your save file. Having a DIFFERENT deterministic precache sequence causes exactly the same problem as a non-deterministic one. It's one of those inconveniences you hit more often as a developer, your save files won't have a long shelf life until the mod is stabilised.
Effects
#3554 posted by Preach on 2025/01/11 22:49:41
Hi Andrew, I didn't do a great job of explaining where I was coming from. When I read your original post my impression was you believed the problem lay in a change between the version T effectinfo.txt and the version U effectinfo.txt. I admit I might have inferred incorrectly.
The really key message I wanted to send is that the flashlight in version T is not using effectinfo.txt - so you won't be able to locate the key to non-flickering effects there; there's nothing you can port to version U. It also makes it much more likely that the problem really lies in the ENGINE rather than the mod, that custom effects aren't compatible with high frame rates.
If you're into updating the engine then you can focus the effort there. If all you can do is change the mod, then you need to find a workaround for the bug, and that usually entails some kind of compromise. Capping FPS at 72 might be the better trade-off, you'll have to weigh it up.
Loading Bug
#3555 posted by ranger on 2025/01/12 05:15:37
Actually what was concerning was there were 2-3 times where I reloaded the map or typed "kill" in console and there was still a model error...
I had to boot the map/kill twice to fix it?
...on related note, any reason why don't just list every quake sound & model in the worldspawn in order to avoid precache errors?
Fps
#3556 posted by ranger on 2025/01/12 05:19:01
is it really noticeable to have any fps above 60-72?
Precaching
#3557 posted by Preach on 2025/01/12 10:11:19
...on related note, any reason why don't just list every quake sound & model in the worldspawn in order to avoid precache errors?
There's a limit on how many models total you can have precached. In vanilla quake the limit is 254. And every time you add a brush entity to a map, that also consumes a precache slot. In a sense, every model you precache needlessly is one fewer brush model your map makers can use.
Of course, it's worth understanding that Quake is a 1996 game. Computers of that era didn't have the memory to precache all the models - if you look at the original ID1 maps you'll notice that they never have more than 6 or 7 types of monster in a level. This was undoubtedly a concession to memory pressure. More modern engines raise the limit, but they did have to introduce new network protocols to do so - it wasn't a trivial change.
This kind of thing probably applies to sounds as well, but the pressure is a lot lower there. While a map will routinely include a small or medium number of custom brush models, it's rare for it to introduce a single custom sound (the basic Quake mod has no facility for this, it's only possible if your mod adds it).
Nope Somethings's Defo Up!
#3558 posted by ranger on 2025/01/13 16:01:50
I just saved a fresh load of a map, then loaded it again and the models are messed up? (but they were ok when i first loaded the map...)
#3559 posted by ranger on 2025/01/13 16:02:58
I didn't touch the progs.dat between loads... literally just loaded the map, saved, then loaded it again, and the models are messed up
Ibid
#3560 posted by Preach on 2025/01/13 19:16:06
That sounds like you have the version of the issue I described in my original post, that you are doing something non-deterministic in worldspawn or your spawn functions. Are you using random numbers anywhere to decide whether or not something spawns? Or any branching statement which precaches models on one branch that aren't precached on another?
Dynamic Looping Sound?
#3561 posted by ranger on 2025/01/19 09:16:41
I'm trying to make a breakable prop play a looping sound, but stops once it's killed and leaves a "corpse"
the sound is precached and has a marker for loops
ambientsound (self.origin, "ambience/thingy.wav", 1.0, ATTN_STATIC);
--works but continues to play once the object is killed, even with a ambientsound (self.origin, "misc/null.wav", 0.0, ATTN_STATIC); added to the self.th_die
self.noise = "ambience/thingy.wav";
sound(self, CHAN_BODY, "ambience/thingy.wav", 1.0, ATTN_STATIC);
--neither of these don't play the sound at all ingame
Sounding Off
#3562 posted by Preach on 2025/01/19 23:43:46
sound(self, CHAN_BODY, "ambience/thingy.wav", 1.0, ATTN_STATIC);
This is the correct approach, make sure that self is the entity you expect to make the sound, and try different attenuation values. We're back to where we started! To anticipate your next question, in order to stop the sound, the misc/null.wav idea comes in, but it's key to have both the same entity AND the same channel when you do so.
Seems Not To Work?
#3563 posted by ranger on 2025/01/20 03:37:49
void () thingy =
{
self.solid = SOLID_BBOX;
self.skin = 0;
self.frame = 0;
self.classname = "device";
precache_model ("progs/d.mdl");
precache_model ("progs/d2.mdl");
setmodel (self, "progs/d.mdl");
setsize (self, '-8 -8 -8', '8 8 8');
precache_sound ("misc/glass1.wav");
precache_sound ("ambience/elec1.wav");
self.health = 1;
self.th_die = dDead;
self.takedamage = DAMAGE_YES;
sound(self, CHAN_BODY, "ambience/elec1.wav", 1.0, ATTN_STATIC);
};
void () dDead =
{
self.takedamage = DAMAGE_NO;
self.solid = SOLID_NOT;
self.classname = "device";
sound (self, CHAN_VOICE, "misc/glass1.wav", 1.00, ATTN_NORM);
self.skin = 1;
if (((random () * 10) >= 7))
self.frame = 1;
else
self.frame = 2;
if ((self.health <= -80))
self.frame = 3;
ThrowGib ("progs/glass1.mdl", -60);
ThrowGib ("progs/glass2.mdl", -40);
sound(self, CHAN_BODY, "misc/null.wav", 0.0, ATTN_STATIC);
};
#3564 posted by ranger on 2025/01/20 03:40:48
changed thingy to looping electricity sound elec1, but seems to not work ingame? i don't hear it unless it's "ambientsound"?
Very Strange?
#3565 posted by ranger on 2025/01/20 03:52:44
Just confirmed that it doesn't work on my side
Seems to only work if i put the sound into its animation frame... but the problem is that it's not playing/looping correctly as the model doesn't have enough frames?
and adding this doesn't work (no sound plays)
self.think = AmbientTestSound;
self.nextthink = time + 10 *random();
Distance
#3566 posted by Preach on 2025/01/20 22:00:30
How far away is the player from the entity when AmbientTestSound runs? You're using ATTN_STATIC, which is the shortest distance a sound will travel. It might be a problem if the player isn't there to hear the start of the sound, even if they move into range later in the loop. Playing the sound as part of a spawn function might have a similar problem.
It's Not The Attn?
#3567 posted by ranger on 2025/01/21 04:45:50
ambientsound (self.origin, "ambience/elec1.wav", 1.0, ATTN_STATIC);
^this causes the sound to play, but then it keeps playing after dead
sound(self, CHAN_BODY, "ambience/elec1.wav", 1.0, ATTN_STATIC);
^nothing plays at all/silent
Dynamic Looping Sound Not Possible In Quake?
#3568 posted by ranger on 2025/01/21 04:51:24
i just looked through all the qc... i can't find any instance where there's a looping sound played that's not from being placed in the model's anim frame
Clearly Possible
#3569 posted by Preach on 2025/01/21 13:55:41
Set up a door, trigger it and block it. It generates a looping sound that continues indefinitely. So there's a problem with your set-up, but Quake is completely capable of doing it.
Not The Same
#3570 posted by ranger on 2025/01/21 15:53:15
that's (eg) self.noise1 = "doors/ddoor2.wav";
not the same as ambientsound or sound
If Anyone Wants To Know I Figured It Out!
#3571 posted by ranger on 2025/01/21 15:55:49
the object ( with the sound() )needs a think and the sound() needs to be its own func with a think too
strangely this is the only way that it'll work lol
Few Questions
#3572 posted by ranger on 2025/01/21 16:03:10
1 what controls how fast an anim plays/speed?
2 how do i make other player weapons knockback monsters or monster weapons knockback victims? (i know player explosions knock back already)
3 I'm trying to make monsters see through water with AI.qc trace_inopen && trace_inwater = TRUE, but seems monsters can see through the floor that's under the water? (thus some of my monster faction get angry at enemies located in unreachable areas, "under" the water surface)
can be fixed with code? or engine bug?
More Replies
#3573 posted by Preach on 2025/01/21 22:34:36
that's (eg) self.noise1 = "doors/ddoor2.wav";
not the same as ambientsound or sound
The code that makes the sounds is
void() door_go_down =
{
sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
It's using sound, like I said. noise2 is just somewhere to note down which sound to use later. Your solution with the think is a way to achieve what I said about delaying the sound until after the spawn function.
1 what controls how fast an anim plays/speed?
The default is 0.1 seconds per frame. You can manually set the nextthink time in each think function with self.nextthink = time + frame duration;
2 how do i make other player weapons knockback monsters or monster weapons knockback victims? (i know player explosions knock back already)
All weapons knock back like explosions, knockback is proportional to damage. Explosions make the effect obvious because they inflict a big burst of damage and cause self damage. But if you play multiplayer you can see how a full-on shotgun boosts you.
The problem with monsters is that they instantly cancel out velocity with their own movement when in contact with the ground. You'd have to pop them up into the air like how dogs and fiends leap. But note that dogs and fiends have a strategy to unstuck themselves if they land in an awkward position. You might need a plan for other monsters, else players may abuse this feature to easily strand them in stuck points.
3 I'm trying to make monsters see through water with AI.qc trace_inopen && trace_inwater = TRUE, but seems monsters can see through the floor that's under the water? (thus some of my monster faction get angry at enemies located in unreachable areas, "under" the water surface)
can be fixed with code? or engine bug?
If you wrote...
if (trace_inopen && trace_inwater)
return TRUE;
..then the bug is entirely of your own making. Work out what you've done, then ask yourself if sometimes less is more.
#3574 posted by ranger on 2025/01/22 05:05:09
for the water i just flipped some values of defaults from ID... dunno how it actually works
how do you make them not see through the underwater floor?
#3575 posted by ranger on 2025/01/22 05:07:11
about knock back, is there "mass" in quake physics or is every monster as light as the player?
Clarification On Momentum
#3576 posted by Preach on 2025/01/22 21:52:48
Knockback is performed by this code in combat.qc:
// figure momentum add
if ( (inflictor != world) && (targ.movetype == MOVETYPE_WALK) )
{
dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5;
dir = normalize(dir);
targ.velocity = targ.velocity + dir*damage*8;
}
The MOVETYPE_WALK check is one more reason why in practice it only affects players - monsters are MOVETYPE_STEP. If it was simply whether the monster was on the ground (as I suggested earlier) then you would be able to interrupt a fiend's leap with a shotgun blast, but observation tells us we can't in vanilla Quake. The velocity is set directly, so there is no mass calculation (in fact, nobody has defined mass in vanilla Quake).
I tried to drop a hint before but you didn't pick up on it. Let's try again... In vanilla Quake there is some code for the interaction between line of sight and water. Here it is
if (trace_inopen && trace_inwater)
return FALSE; // sight line crossed contents
Now I will translate this code into plain English
if= if
trace_inopen = part of the trace is in the open air
&& = and
trace_inwater = part of the trace is in the water
return FALSE = then the answer to the question of whether the monster can see its target is no
//sight line crossed contents = (because the line of sight passed through the surface of the water)
Put that together:
If part of the trace is in the open air and part of the trace is in the water, then the answer to the question of whether the monster can see its target is no (because the line of sight passed through the surface of the water).
Can you please post your version of this code, and the English translation of your version?
|
|
You must be logged in to post in this thread.
|
Website copyright © 2002-2025 John Fitzgibbons. All posts are copyright their respective authors.
|
|