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
Humor 
If there is no 'equal to' symbol in the statement

(I know the code),
(I want to know the solution)

know is equal

symbol in the statement
code to english translation

it means it is not an equation.

It will be considered as an expression.

translation is not a solution. 
@rj 
did I win? 
 
if (x && y) is shorthand for if (x == TRUE && y == TRUE)

As far as I can tell, it's wrong because it now returns true too early before doing the requisite trace_fraction check, which was previously the only condition that caused the function to return true. So monsters can now see through solids so long as there is liquid at any point between the player and monster

I think the correct solution would be to just take out the clause altogether 
Round Up 
I think the correct solution would be to just take out the clause altogether

Yes, this is the answer.

I now wish I'd drawn more attention to the purpose of the last line of the function, because the function is easier to understand if you start from there. It's making the final decision about vision, and all you need to know is TRACE_FRACTION < 1 if there are solid obstacles on the LOS between the monster and player.

So what's the line above that doing in the original code? It's checking if the LOS enters both water and open. If it's both, it must have passed through the surface of the water, which is opaque in standard Quake. When we think about this check in relation to the final check, its function becomes: "if the LOS goes through the surface of the water, no need to bother with the obstacle check because the target isn't visible".

If you change that return value from false to true, you've swung the pendulum too far in the other direction! Now you're saying "if the LOS goes through the surface of the water, no need to bother with the obstacle check because the target MUST be visible". What you actually want is to stop caring about the water/air boundary, but still do the obstacle check, and simply removing the check gets you there. 
I See, Thanks 
 
Wall Torch Dynamic Loop Sound? 
The current issue is the sounds only start after 7.5s have passed ingame, but if i reduced "self.nextthink = time + 7.5;" to "self.nextthink = time;"/"self.nextthink = time + 0.1;" then the sounds starts crackling because it's playing repeatedly before the sound is supposed to loop?

void () wallfire_sound =
{
sound(self, CHAN_BODY, "ambience/f1.wav", 0.33, ATTN_STATIC);

self.think = wallfire_sound;
self.nextthink = time + 7.5; //3.8 // Schedule next sound play in 1.2 second
};

void () wallfire_sound_Start =
{
sound(self, CHAN_BODY, "ambience/f1.wav", 0.33, ATTN_STATIC);

self.think = wallfire_sound;
self.nextthink = time;
};

void () light_torch_small_walltorch =
{
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_NONE;
self.skin = 0;
self.frame = 0;
//self.effects = EF_DIMLIGHT; //real light EF_BRIGHTLIGHT
precache_model ("progs/f.mdl");
setmodel (self, "progs/f.mdl");
setsize (self, '-8 -8 -8', '8 8 8');
precache_sound ("ambience/f1.wav");
self.health = 1;
self.th_die = f_break;
self.takedamage = DAMAGE_YES;

sound(self, CHAN_BODY, "ambience/f1.wav", 0.33, ATTN_STATIC);
self.think = wallfire_sound_Start;
self.nextthink = time; 
Delay A Bit 
Try self.nextthink = time + 1; in wallfire_sound_Start

From memory, the first four frames in quake happen at

time = 0
time = 0.1
time = 0.2
<- player connects to server here
time = 1

At the moment, because you're running your functions as fast as possible, your first call to wallfire_sound is happening at time = 0.2. This is too early, so the player can't hear it, and has to wait for the first repeat at time = 7.7 seconds. 
Sorta Fixed! 
you're saying the minimum delay before a dynamic looping sound can play is 1 sec after the level loads? 
About The Above Setup 
any reason why "sound(self, CHAN_BODY, "ambience/f1.wav", 0.33, ATTN_STATIC); " by itself doesn't work and it needs the separate wallfire_sound_Start wallfire_sound thinks?

f1.wav has a loop marker tho 
Playback 
You probably only need the sound in wallfire_sound, you can skip the other two. And potentially you can remove a layer of complexity by cutting out the middle function - just have wallfire_sound run after 1 second delay directly after the spawn function.

The old thought experiment goes: if a tree falls in the forest, and nobody is there to hear it, does it make a sound? Is it possible for this to happen in Quake? Yes, in multiplayer it's obviously possible! You can run a dedicated server, carefully simulating the world, even though nobody connected yet.

If a player connects after 30 seconds, they only start hearing the sounds that are triggered from that point onwards*. Even if a 6 second long sound started playing at 27 seconds, they don't hear the back half of it - they heard nothing.

Are the rules different for single player? Not substantially, single player is run under the multiplayer system, just with both ends of the conversation taking place on the same machine. And the crucial thing is that the player doesn't connect immediately in single player, it's more like after the first second. Before that moment, certain actions are being performed to an empty stage, and it appears like they never took place.

One final thing to watch out for is save games. Loading a save that's 30 seconds into the level is very much like connecting to a server after 30 seconds have past. The 6 second long sound that started playing at time = 27 is not logged as partially complete in the save file.

*Ambient sounds are the exception, these are logged and played back to each player as they connect. 
Got It Thanks 
also can TE_EXPLOSION TE_TAREXPLOSION TE_LAVASPLASH be modified? or hardcoded?

and can particles "particle (self.origin, '0 0 10', 5, 2);" be further changed like: increase lifetime of them, make accelerate, change in size, only use a range of or specific colors...

and what causes MOVETYPE_BOUNCE to fall through the floor? i noticed grenades don't, but my custom MOVETYPE_BOUNCE things sometimes do 
Points 
also can TE_EXPLOSION TE_TAREXPLOSION TE_LAVASPLASH be modified? or hardcoded?

They are hardcoded, look into TE_EXPLOSION2 for the customisable version.

and can particles "particle (self.origin, '0 0 10', 5, 2);" be further changed like: increase lifetime of them, make accelerate, change in size, only use a range of or specific colors

The only one of those things you can control is color, the 5 in your example code is a palette index (in practice the engine distribute the pixels over a range of palette entries which includes the supplied index).

and what causes MOVETYPE_BOUNCE to fall through the floor? i noticed grenades don't, but my custom MOVETYPE_BOUNCE things sometimes do

Only guess I have is entities are getting spawned in stuck positions. The existing code is careful to make sure grenades spawn inside a solid entity which is their owner. The ownership means that the two do not collide with each other, while at the same time the solidness of the owner will generally prevent any other solid objects from invading the same space. 
Particles 
I remember seeming arcane dimensions have different size particles and particles that change size and rotate? 
Projectile Sound 
Is it possible to give rockets ambient sound when they fly like in Quake 3? 
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.