tuxracer-checkins Mailing List for Tux Racer (Page 15)
Status: Beta
Brought to you by:
jfpatry
You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(46) |
Sep
(274) |
Oct
(36) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Jasmin P. <jf...@us...> - 2000-08-23 23:42:45
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv27327 Modified Files: phys_sim.c Log Message: - Adjusted physics for rolling (hard turn) - Tweaked particle generation - Fixed paddling (was too fast on rock) by capping paddling force - Turned friction off at low speed (to make acceleration faster and turning less wacky) - Fixed bug in which orientation wasn't being reset at start of race Index: phys_sim.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/phys_sim.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** phys_sim.c 2000/04/02 21:42:02 1.9 --- phys_sim.c 2000/08/23 23:42:42 1.10 *************** *** 39,42 **** --- 39,45 ---- #define MIN_TUX_SPEED 1.4 + /* Minimum speed for friction to take effect (m/s) */ + #define MIN_FRICTION_SPEED 2.8 + /* Initial Tux speed (m/s) */ #define INIT_TUX_SPEED 3.0 *************** *** 48,54 **** #define MAX_TURN_PENALTY 0.3 ! /* Force applied by Tux when braking */ #define BRAKE_FORCE 400 /* Tux's orientation is updated using a first-order filter; these are the time constants of the filter when tux is on ground and airborne (s) */ --- 51,69 ---- #define MAX_TURN_PENALTY 0.3 ! /* Force applied by Tux when braking (N) */ #define BRAKE_FORCE 400 + /* Maximum roll angle (degrees) */ + #define MAX_ROLL_ANGLE 45 + + /* Baseline friction coeff for rolling */ + #define IDEAL_ROLL_FRIC_COEFF 0.35 + + /* Baseline speed for rolling (m/s) */ + #define IDEAL_ROLL_SPEED 3.5 + + /* Force applied when rolling (based on speed) (N/(m/s)) */ + #define ROLL_PENALTY_FORCE 12.0 + /* Tux's orientation is updated using a first-order filter; these are the time constants of the filter when tux is on ground and airborne (s) */ *************** *** 57,62 **** /* Max particles generated by turning (particles/s) */ ! #define MAX_TURN_PARTICLES 3000 /* Particles generated by braking (particles/s) */ #define BRAKE_PARTICLES 6000 --- 72,80 ---- /* Max particles generated by turning (particles/s) */ ! #define MAX_TURN_PARTICLES 1500 + /* Max particles generated by rolling (particles/s) */ + #define MAX_ROLL_PARTICLES 5000 + /* Particles generated by braking (particles/s) */ #define BRAKE_PARTICLES 6000 *************** *** 151,155 **** /* Force applied against ground when paddling (N) */ ! #define PADDLING_FORCE 350 /* Speed at which paddling ceases to be effective (m/s) */ --- 169,176 ---- /* Force applied against ground when paddling (N) */ ! #define MAX_PADDLING_FORCE 122.5 ! ! /* Ideal paddling friction coefficient */ ! #define IDEAL_PADDLING_FRIC_COEFF 0.35 /* Speed at which paddling ceases to be effective (m/s) */ *************** *** 724,727 **** --- 745,790 ---- } + static vector_t adjust_tux_zvec_for_roll( player_data_t *plyr, + vector_t vel, vector_t zvec ) + { + matrixgl_t rot_mat; + + vel = project_into_plane( zvec, vel ); + + normalize_vector( &vel ); + + make_rotation_about_vector_matrix( rot_mat, vel, + plyr->control.roll_factor * + MAX_ROLL_ANGLE ); + + return transform_vector( rot_mat, zvec ); + } + + static vector_t adjust_surf_nml_for_roll( player_data_t *plyr, + vector_t vel, + scalar_t fric_coeff, + vector_t nml ) + { + matrixgl_t rot_mat; + scalar_t angle; + scalar_t speed; + + speed = normalize_vector( &vel ); + + vel = project_into_plane( nml, vel ); + + normalize_vector( &vel ); + + angle = plyr->control.roll_factor * MAX_ROLL_ANGLE * + min( 1.0, max(0.0, fric_coeff)/IDEAL_ROLL_FRIC_COEFF ) + * min(1.0, max(0.0,speed-MIN_TUX_SPEED)/ + (IDEAL_ROLL_SPEED-MIN_TUX_SPEED)); + + make_rotation_about_vector_matrix( rot_mat, vel, angle ); + + return transform_vector( rot_mat, nml ); + } + + void adjust_orientation( player_data_t *plyr, scalar_t dtime, point_t pos, vector_t vel, *************** *** 743,746 **** --- 806,810 ---- new_z = project_into_plane( new_y, make_vector(0., -1., 0.) ); normalize_vector( &new_z); + new_z = adjust_tux_zvec_for_roll( plyr, vel, new_z ); } else { new_y = scale_vector( -1., vel ); *************** *** 748,751 **** --- 812,816 ---- new_z = project_into_plane( new_y, make_vector(0., 1., 0.) ); normalize_vector( &new_z); + new_z = adjust_tux_zvec_for_roll( plyr, vel, new_z ); } *************** *** 754,761 **** --- 819,828 ---- if ( getparam_tux_slides_on_belly() ) { new_z = scale_vector( -1., surf_nml ); + new_z = adjust_tux_zvec_for_roll( plyr, vel, new_z ); new_y = project_into_plane( surf_nml, scale_vector( 1., vel ) ); normalize_vector(&new_y); } else { new_z = surf_nml; + new_z = adjust_tux_zvec_for_roll( plyr, vel, new_z ); new_y = project_into_plane( surf_nml, scale_vector( -1., vel ) ); normalize_vector(&new_y); *************** *** 814,824 **** point_t pos, scalar_t speed ) { ! point_t left_part_pt, right_part_pt; vector_t part_vector = { 0., 1., 0. }; scalar_t brake_particles; scalar_t turn_particles; terrain_t surf_type; scalar_t surf_y; ! scalar_t left_particles, right_particles; surf_type = get_surface_type( pos.x, pos.z ); --- 881,892 ---- point_t pos, scalar_t speed ) { ! point_t left_part_pt, right_part_pt, center_part_pt; vector_t part_vector = { 0., 1., 0. }; scalar_t brake_particles; scalar_t turn_particles; + scalar_t roll_particles; terrain_t surf_type; scalar_t surf_y; ! scalar_t left_particles, right_particles, center_particles; surf_type = get_surface_type( pos.x, pos.z ); *************** *** 826,832 **** if ( surf_type == Snow && pos.y < surf_y ) { ! right_part_pt = left_part_pt = pos; right_part_pt.x += 0.175; left_part_pt.x -= 0.175; brake_particles = dtime * --- 894,902 ---- if ( surf_type == Snow && pos.y < surf_y ) { ! right_part_pt = left_part_pt = center_part_pt = pos; ! right_part_pt.y = left_part_pt.y = center_part_pt.y = surf_y; right_part_pt.x += 0.175; left_part_pt.x -= 0.175; + center_part_pt.z += 0.175; brake_particles = dtime * *************** *** 835,838 **** --- 905,910 ---- turn_particles = dtime * MAX_TURN_PARTICLES * min( speed / PARTICLES_SPEED_FACTOR, 1.0 ); + roll_particles = dtime * MAX_ROLL_PARTICLES + * min( speed / PARTICLES_SPEED_FACTOR, 1.0 ); left_particles = turn_particles * *************** *** 844,849 **** --- 916,925 ---- brake_particles; + center_particles = roll_particles * + fabs( plyr->control.roll_factor ); + left_particles = adjust_particle_count( left_particles ); right_particles = adjust_particle_count( right_particles ); + center_particles = adjust_particle_count( center_particles ); create_new_particles( left_part_pt, part_vector, *************** *** 851,854 **** --- 927,932 ---- create_new_particles( right_part_pt, part_vector, (int)right_particles ); + create_new_particles( center_part_pt, part_vector, + (int)center_particles ); } } *************** *** 976,979 **** --- 1054,1058 ---- vector_t air_f; /* air resistance force */ vector_t brake_f; /* braking force */ + vector_t roll_drag_f; /* rolling drag force */ vector_t paddling_f; /* paddling force */ vector_t net_force; /* the net force (sum of all other forces) */ *************** *** 981,985 **** scalar_t speed; /* speed (m/s) */ scalar_t surf_y; /* y coord of terrain surface */ ! vector_t surf_nml; /* normal to terrain at current position */ terrain_t surf_type; /* type of terrain at current pos */ scalar_t glute_compression; /* amt that Tux's tush has been compressed */ --- 1060,1065 ---- scalar_t speed; /* speed (m/s) */ scalar_t surf_y; /* y coord of terrain surface */ ! vector_t orig_surf_nml; /* normal to terrain at current position */ ! vector_t surf_nml; /* normal to terrain w/ roll effect */ terrain_t surf_type; /* type of terrain at current pos */ scalar_t glute_compression; /* amt that Tux's tush has been compressed */ *************** *** 988,992 **** surf_type = get_surface_type( uncorr_pos.x, uncorr_pos.z ); ! surf_nml = find_course_normal( uncorr_pos.x, uncorr_pos.z ); surf_y = find_y_coord( uncorr_pos.x, uncorr_pos.z ); --- 1068,1074 ---- surf_type = get_surface_type( uncorr_pos.x, uncorr_pos.z ); ! orig_surf_nml = find_course_normal( uncorr_pos.x, uncorr_pos.z ); ! surf_nml = adjust_surf_nml_for_roll( plyr, vel, fricCoeff[surf_type], ! orig_surf_nml ); surf_y = find_y_coord( uncorr_pos.x, uncorr_pos.z ); *************** *** 1022,1026 **** fric_dir = scale_vector( -1.0, fric_dir ); ! if ( uncorr_pos.y <= surf_y ) { vector_t tmp_nml_f = nml_f; --- 1104,1108 ---- fric_dir = scale_vector( -1.0, fric_dir ); ! if ( uncorr_pos.y <= surf_y && speed > MIN_FRICTION_SPEED ) { vector_t tmp_nml_f = nml_f; *************** *** 1035,1039 **** */ steer_angle = plyr->control.turn_fact * MAX_TURN_ANGLE; ! make_rotation_about_vector_matrix( fric_rot_mat, surf_nml, steer_angle ); fric_f = transform_vector( fric_rot_mat, fric_f ); --- 1117,1121 ---- */ steer_angle = plyr->control.turn_fact * MAX_TURN_ANGLE; ! make_rotation_about_vector_matrix( fric_rot_mat, orig_surf_nml, steer_angle ); fric_f = transform_vector( fric_rot_mat, fric_f ); *************** *** 1051,1057 **** brake_f = make_vector( 0., 0., 0. ); } } else { ! fric_f = brake_f = make_vector( 0., 0., 0. ); } --- 1133,1152 ---- brake_f = make_vector( 0., 0., 0. ); } + + + /* + * Calculate rolling drag force + */ + roll_drag_f = scale_vector( + max(0.0, + (speed-MIN_TUX_SPEED) * ROLL_PENALTY_FORCE * + min( 1.0, max(0.0, fricCoeff[surf_type])/ + IDEAL_ROLL_FRIC_COEFF ) * + fabs( plyr->control.roll_factor ) ), + fric_dir ); + } else { ! fric_f = brake_f = roll_drag_f = make_vector( 0., 0., 0. ); } *************** *** 1068,1074 **** if ( plyr->control.is_paddling && uncorr_pos.y <= surf_y ) { paddling_f = scale_vector( ! -PADDLING_FORCE * ! ( MAX_PADDLING_SPEED - speed ) / MAX_PADDLING_SPEED * ! fricCoeff[surf_type], fric_dir ); } else { --- 1163,1171 ---- if ( plyr->control.is_paddling && uncorr_pos.y <= surf_y ) { paddling_f = scale_vector( ! -1 * min( MAX_PADDLING_FORCE, ! MAX_PADDLING_FORCE * ! ( MAX_PADDLING_SPEED - speed ) / MAX_PADDLING_SPEED * ! min(1.0, ! fricCoeff[surf_type]/IDEAL_PADDLING_FRIC_COEFF)) , fric_dir ); } else { *************** *** 1082,1086 **** net_force = add_vectors( grav_f, add_vectors( nml_f, add_vectors( fric_f, add_vectors( air_f, add_vectors( ! brake_f, paddling_f ))))); return net_force; --- 1179,1183 ---- net_force = add_vectors( grav_f, add_vectors( nml_f, add_vectors( fric_f, add_vectors( air_f, add_vectors( ! brake_f, add_vectors( roll_drag_f, paddling_f )))))); return net_force; *************** *** 1376,1379 **** --- 1473,1478 ---- } + tmp_vel = plyr->vel; + /* * Set position, orientation, generate particles *************** *** 1386,1390 **** adjust_position( &plyr->pos, surf_y, surf_type ); - tmp_vel = plyr->vel; speed = normalize_vector( &tmp_vel ); --- 1485,1488 ---- *************** *** 1436,1440 **** --- 1534,1540 ---- plyr->net_force = init_f; plyr->control.turn_fact = 0.0; + plyr->control.roll_factor = 0.0; plyr->control.is_braking = False; + plyr->orientation_initialized = False; } |
From: Jasmin P. <jf...@us...> - 2000-08-23 23:10:24
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv27714 Modified Files: racing.c Log Message: Added handling of roll (hard turn) controls. Index: racing.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/racing.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** racing.c 2000/08/15 03:08:12 1.9 --- racing.c 2000/08/23 23:10:21 1.10 *************** *** 40,45 **** --- 40,51 ---- #define TURN_DECAY_TIME_CONSTANT 0.5 + /* Time constant for automatic rolling centering (s) */ + #define ROLL_DECAY_TIME_CONSTANT 0.2 + static bool_t right_turn; static bool_t left_turn; + static bool_t right_roll; + static bool_t left_roll; + static bool_t roll_modifier; static bool_t paddling; *************** *** 63,66 **** --- 69,74 ---- left_turn = right_turn = paddling = False; + left_roll = right_roll = False; + roll_modifier = False; plyr->control.is_paddling = False; *************** *** 75,78 **** --- 83,88 ---- int width, height; player_data_t *plyr = get_player_data( local_player() ); + bool_t rolling_left = False; + bool_t rolling_right = False; width = getparam_x_resolution(); *************** *** 89,92 **** --- 99,105 ---- setup_fog(); + /* + * Turning + */ if ( left_turn ^ right_turn ) { increment_turn_fact( plyr, *************** *** 101,104 **** --- 114,148 ---- } + /* + * Rolling + */ + if ( left_roll || right_roll ) { + /* Roll controls take precedence over modifier key */ + rolling_left = left_roll; + rolling_right = right_roll; + } else if ( roll_modifier ) { + rolling_left = left_turn; + rolling_right = right_turn; + } + + if ( rolling_left ^ rolling_right ) { + plyr->control.roll_factor += + ( rolling_left ? -1 : 1 ) * 0.15 * time_step / 0.05; + + plyr->control.roll_factor = + min( 1.0, max( -1.0, plyr->control.roll_factor ) ); + } else { + /* Automatically centre rolling */ + if ( time_step < ROLL_DECAY_TIME_CONSTANT ) { + plyr->control.roll_factor *= + 1.0 - time_step/ROLL_DECAY_TIME_CONSTANT; + } else { + plyr->control.roll_factor = 0.0; + } + } + + /* + * Paddling + */ if ( paddling && plyr->control.is_paddling == False ) { print_debug( DEBUG_CONTROL, "paddling on" ); *************** *** 169,173 **** --- 213,236 ---- END_KEYBOARD_CB + START_KEYBOARD_CB( roll_left_cb ) + { + left_roll = !release; + } + END_KEYBOARD_CB + + START_KEYBOARD_CB( roll_right_cb ) + { + right_roll = !release; + } + END_KEYBOARD_CB + + START_KEYBOARD_CB( roll_modifier_cb ) + { + roll_modifier = !release; + } + END_KEYBOARD_CB + + START_KEYBOARD_CB( brake_cb ) { *************** *** 228,231 **** --- 291,301 ---- status |= add_keymap_entry( RACING, CONFIGURABLE_KEY, "l", getparam_turn_right_key, turn_right_cb ); + status |= add_keymap_entry( RACING, CONFIGURABLE_KEY, + "s", getparam_roll_left_key, roll_left_cb ); + status |= add_keymap_entry( RACING, CONFIGURABLE_KEY, + "f", getparam_roll_right_key, roll_right_cb ); + status |= add_keymap_entry( RACING, CONFIGURABLE_KEY, + "d", getparam_roll_modifier_key, + roll_modifier_cb ); status |= add_keymap_entry( RACING, CONFIGURABLE_KEY, "space", getparam_brake_key, brake_cb ); |
From: Jasmin P. <jf...@us...> - 2000-08-23 23:02:35
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv16407 Modified Files: game_config.c game_config.h Log Message: Added roll (hard turn) controls. Index: game_config.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/game_config.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -r1.14 -r1.15 *** game_config.c 2000/08/14 22:14:13 1.14 --- game_config.c 2000/08/23 23:02:32 1.15 *************** *** 345,348 **** --- 345,351 ---- struct param turn_left_key; struct param turn_right_key; + struct param roll_left_key; + struct param roll_right_key; + struct param roll_modifier_key; struct param brake_key; struct param paddle_key; *************** *** 436,439 **** --- 439,445 ---- INIT_PARAM_STRING( turn_left_key, "j" ); INIT_PARAM_STRING( turn_right_key, "l" ); + INIT_PARAM_STRING( roll_left_key, "s" ); + INIT_PARAM_STRING( roll_right_key, "f" ); + INIT_PARAM_STRING( roll_modifier_key, "d" ); INIT_PARAM_STRING( brake_key, "space" ); INIT_PARAM_STRING( paddle_key, "k" ); *************** *** 487,490 **** --- 493,499 ---- FN_PARAM_STRING( turn_left_key ) FN_PARAM_STRING( turn_right_key ) + FN_PARAM_STRING( roll_left_key ) + FN_PARAM_STRING( roll_right_key ) + FN_PARAM_STRING( roll_modifier_key ) FN_PARAM_STRING( brake_key ) FN_PARAM_STRING( paddle_key ) Index: game_config.h =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/game_config.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** game_config.h 2000/08/14 22:14:13 1.9 --- game_config.h 2000/08/23 23:02:32 1.10 *************** *** 93,96 **** --- 93,102 ---- PROTO_PARAM_STRING( turn_right_key ); + PROTO_PARAM_STRING( roll_left_key ); + + PROTO_PARAM_STRING( roll_right_key ); + + PROTO_PARAM_STRING( roll_modifier_key ); + PROTO_PARAM_STRING( brake_key ); |
From: Jasmin P. <jf...@us...> - 2000-08-23 23:00:28
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv12146 Modified Files: tuxracer.h Log Message: Added roll_factor to control_t (used for hard turns). Index: tuxracer.h =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/tuxracer.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** tuxracer.h 2000/08/09 15:00:02 1.7 --- tuxracer.h 2000/08/23 23:00:26 1.8 *************** *** 149,152 **** --- 149,153 ---- control_mode_t mode; /* control mode */ scalar_t turn_fact; /* amount turning [-1,1] */ + scalar_t roll_factor; /* amount rolling [-1,1] */ bool_t is_braking; /* is player braking? */ bool_t is_paddling; /* is player paddling? */ |
From: Jasmin P. <jf...@us...> - 2000-08-23 22:59:22
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv10589 Modified Files: audio.c Log Message: Loop values for music (specified with tux_bind_music) now honoured. Index: audio.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/audio.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** audio.c 2000/08/15 02:35:29 1.3 --- audio.c 2000/08/23 22:59:19 1.4 *************** *** 424,428 **** if ( ! Mix_PlayingMusic() ) { ! Mix_PlayMusic( music, -1 ); set_music_playing_status( music_name, True ); } --- 424,428 ---- if ( ! Mix_PlayingMusic() ) { ! Mix_PlayMusic( music, loop ); set_music_playing_status( music_name, True ); } |
From: Jasmin P. <jf...@us...> - 2000-08-23 14:29:07
|
Update of /cvsroot/tuxracer/tuxracer/src In directory slayer.i.sourceforge.net:/tmp/cvs-serv24640 Modified Files: main.c Log Message: Added a call to glutIgnoreKeyRepeat() to avoid seeing repeated KeyUp messages. Index: main.c =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/src/main.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -r1.10 -r1.11 *** main.c 2000/08/15 03:08:12 1.10 --- main.c 2000/08/23 14:29:01 1.11 *************** *** 253,256 **** --- 253,264 ---- } + /* Ingore key-repeat messages */ + glutIgnoreKeyRepeat(1); + + + /* + * Initialize SDL + */ + #if defined(HAVE_SDL) && defined(HAVE_SDL_MIXER) setup_sdl(); |
From: Jasmin P. <jf...@us...> - 2000-08-17 22:40:15
|
Update of /cvsroot/tuxracer/tuxracer In directory slayer.i.sourceforge.net:/tmp/cvs-serv9496 Modified Files: README Log Message: Testing syncmail again. Index: README =================================================================== RCS file: /cvsroot/tuxracer/tuxracer/README,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** README 2000/08/17 22:34:19 1.9 --- README 2000/08/17 22:40:12 1.10 *************** *** 1,5 **** Tux Racer ! Version 0.13 Copyright (C) 1999-2000 Jasmin F. Patry --- 1,5 ---- Tux Racer ! Version 0.12.1 Copyright (C) 1999-2000 Jasmin F. Patry |