Re: [Tuxracer-devel] too many Particles and libtcl8.x
Status: Beta
Brought to you by:
jfpatry
From: Jasmin P. <jf...@mu...> - 2000-03-01 03:54:53
|
On 29 Feb 2000, Ingo Ruhnke wrote: > There is no core file generated. So I played a bit around with gdb: [snip] > | #0 create_new_particles (loc={x = 0.67505081281655532, > | y = -20.186827572125033, z = -50.121188293065998}, vel={x = 0, y = 1, > | z = 0}, num=186591) at part_sys.c:66 > | ^^^^^^ <-------------------- This looks far to big [snip] > > Looks like plyr->control.turn_fact is the cause for this: > > ,---- > | (gdb) print generate_particles::plyr->control.turn_fact > | $5 = 48711.292061943917 > `---- Spot on. Thanks! I've tracked it down to a problem with the automatic centering of steering. This bug was actually framerate dependent; it would only be triggered by framerates below 18 Hz. I almost always get over 20 Hz so that explains why I only saw this happen once. > > By the way, if you want to suppress particle generation altogether, > > simply comment out the call to generate_particles() in phys_sim.c. > > That didn't help. Tux gets totally out of controll if I press J or L, > looks like the problem is not the particle system, but instead that > there is something wrong with the controls. Yup, that's consistent with the bug I found. Please try the attached patch and let me know if things are better. Thanks, Jasmin *** racing.c.0.10 Tue Feb 29 22:15:08 2000 --- racing.c Tue Feb 29 22:37:27 2000 *************** *** 31,36 **** --- 31,40 ---- #include "tux_shadow.h" #include "phys_sim.h" #include "part_sys.h" + #include "screenshot.h" + + /* Time constant for automatic steering centering (s) */ + #define TURN_DECAY_TIME_CONSTANT 0.2 static bool_t right_turn; static bool_t left_turn; *************** *** 76,82 **** increment_turn_fact( plyr, ( left_turn ? -1 : 1 ) * 0.2 * time_step / 0.05 ); } else { ! plyr->control.turn_fact *= 0.9 * time_step / 0.05; } update_player_pos( plyr, time_step ); --- 80,91 ---- increment_turn_fact( plyr, ( left_turn ? -1 : 1 ) * 0.2 * time_step / 0.05 ); } else { ! /* Automatically centre steering */ ! if ( time_step < TURN_DECAY_TIME_CONSTANT ) { ! plyr->control.turn_fact *= 1.0 - time_step/TURN_DECAY_TIME_CONSTANT; ! } else { ! plyr->control.turn_fact = 0.0; ! } } update_player_pos( plyr, time_step ); |