You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(136) |
Dec
(218) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(214) |
Feb
(208) |
Mar
(186) |
Apr
(15) |
May
(3) |
Jun
(35) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(58) |
Aug
(123) |
Sep
(31) |
Oct
(9) |
Nov
|
Dec
(1) |
2006 |
Jan
(25) |
Feb
(10) |
Mar
(25) |
Apr
(61) |
May
|
Jun
(78) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Rob <geo...@us...> - 2005-08-14 16:15:01
|
Update of /cvsroot/timewarp/source/sc1ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/sc1ships Modified Files: shpandgu.cpp shparisk.cpp shpsyrpe.cpp shpumgdr.cpp Log Message: fixed/updates for the use of random() Index: shparisk.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shparisk.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shparisk.cpp 24 Mar 2004 23:51:44 -0000 1.8 --- shparisk.cpp 14 Aug 2005 16:14:50 -0000 1.9 *************** *** 55,60 **** Vector2 d = Vector2 ( ! random(-1500.0, 1500.0), ! random(-1500.0, 1500.0) ); translate(d); --- 55,60 ---- Vector2 d = Vector2 ( ! tw_random(-1500.0, 1500.0), ! tw_random(-1500.0, 1500.0) ); translate(d); Index: shpandgu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpandgu.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpandgu.cpp 4 Aug 2005 15:03:58 -0000 1.14 --- shpandgu.cpp 14 Aug 2005 16:14:50 -0000 1.15 *************** *** 168,172 **** courseFrames -= 150; ! newAngle = random(PI2); vel = v * unit_vector(newAngle); --- 168,172 ---- courseFrames -= 150; ! newAngle = tw_random(PI2); vel = v * unit_vector(newAngle); Index: shpsyrpe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpsyrpe.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpsyrpe.cpp 2 Aug 2005 00:23:48 -0000 1.14 --- shpsyrpe.cpp 14 Aug 2005 16:14:50 -0000 1.15 *************** *** 74,78 **** callDamage = (int)(r * (double)(specialDamage) / specialRange); if (callDamage > specialDamage) callDamage = specialDamage; ! callDamage += (random() % specialDamage); if ((target->getCrew() - callDamage) < 1) callDamage = iround(target->getCrew() - 1); int old = iround(target->getCrew()); --- 74,78 ---- callDamage = (int)(r * (double)(specialDamage) / specialRange); if (callDamage > specialDamage) callDamage = specialDamage; ! callDamage += (tw_random(specialDamage)); if ((target->getCrew() - callDamage) < 1) callDamage = iround(target->getCrew() - 1); int old = iround(target->getCrew()); *************** *** 82,86 **** add(new CrewPod( target->normal_pos() + (unit_vector(trajectory_angle(target) - PI) * ! target->size.x) + random(Vector2(50,50)) - Vector2(25,25), specialVelocity, specialFrames, this, data->spriteSpecial, 32, 50)); --- 82,86 ---- add(new CrewPod( target->normal_pos() + (unit_vector(trajectory_angle(target) - PI) * ! target->size.x) + tw_random(Vector2(50,50)) - Vector2(25,25), specialVelocity, specialFrames, this, data->spriteSpecial, 32, 50)); Index: shpumgdr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpumgdr.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpumgdr.cpp 2 Aug 2005 00:23:48 -0000 1.18 --- shpumgdr.cpp 14 Aug 2005 16:14:50 -0000 1.19 *************** *** 139,143 **** SpaceObject::inflict_damage(other); }; residual_damage *= 1e4; ! if (residual_damage > random(10000)) SpaceObject::inflict_damage(other); }; break; --- 139,143 ---- SpaceObject::inflict_damage(other); }; residual_damage *= 1e4; ! if (residual_damage > tw_random(10000)) SpaceObject::inflict_damage(other); }; break; |
From: Rob <geo...@us...> - 2005-08-14 16:15:01
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/util Modified Files: random.cpp random.h Log Message: fixed/updates for the use of random() Index: random.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/random.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** random.cpp 8 Aug 2005 14:35:05 -0000 1.9 --- random.cpp 14 Aug 2005 16:14:50 -0000 1.10 *************** *** 217,220 **** --- 217,228 ---- } + + // extra test... + int maxval = 1000; + int w; + w = tw_random(maxval); + if (w < 0 || w >= maxval) + tw_error("unsigned int value out of bounds"); + } *************** *** 260,263 **** --- 268,278 ---- val = a * (double(tw_random()) / double(0x0100000000)); + + if ((a != 0) && (val < 0 || val >= a)) + { + tw_error("random (double), out of bounds!"); + } + + return val; } *************** *** 268,273 **** } ! unsigned int tw_random( int a ) { ! return tw_random() % a; } --- 283,301 ---- } ! ! int tw_random( int a ) { ! if (a < 0) ! { ! tw_error("random: needing to convert a negative integer to an unsigned integer: should not happen"); ! } ! ! int k = int( tw_random() % unsigned int(a) ); ! ! if (k < 0 || k >= a) ! { ! tw_error("random (int), out of bounds!"); ! } ! ! return k; } Index: random.h =================================================================== RCS file: /cvsroot/timewarp/source/util/random.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** random.h 8 Aug 2005 14:35:05 -0000 1.7 --- random.h 14 Aug 2005 16:14:50 -0000 1.8 *************** *** 72,76 **** double tw_random(double a); double tw_random(double min, double max); ! unsigned int tw_random( int a ); unsigned int tw_random(); --- 72,76 ---- double tw_random(double a); double tw_random(double min, double max); ! int tw_random( int a ); unsigned int tw_random(); |
From: Rob <geo...@us...> - 2005-08-14 16:15:00
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/other Modified Files: gquest.cpp gup.cpp planet3d.cpp vbodies.cpp Log Message: fixed/updates for the use of random() Index: vbodies.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/vbodies.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** vbodies.cpp 11 Jul 2005 00:25:58 -0000 1.13 --- vbodies.cpp 14 Aug 2005 16:14:50 -0000 1.14 *************** *** 191,195 **** //end sprite handling routines ! VSpaceInstallation::VSpaceInstallation():SpaceObject(NULL, random(map_size), random(PI2), meleedata.asteroidSprite) { collide_flag_sameteam = ALL_LAYERS; --- 191,195 ---- //end sprite handling routines ! VSpaceInstallation::VSpaceInstallation():SpaceObject(NULL, tw_random(map_size), tw_random(PI2), meleedata.asteroidSprite) { collide_flag_sameteam = ALL_LAYERS; *************** *** 1054,1058 **** maxFlares = (double)frame_time * this->maxFlaresPerSecond / (double)1000.0; while(this->starEnergy>this->starEnergyToFlare && flareCounter>0.0) { ! r = (double)(random() % 1000000) / (double)1000000.0; LaunchFlare(PI2*r, this->flareSpeed, this->flareRange, this->flareDamage, this->finalFlareSpeed); this->starEnergy -=this->starEnergyPerFlare; --- 1054,1058 ---- maxFlares = (double)frame_time * this->maxFlaresPerSecond / (double)1000.0; while(this->starEnergy>this->starEnergyToFlare && flareCounter>0.0) { ! r = random(1.0); LaunchFlare(PI2*r, this->flareSpeed, this->flareRange, this->flareDamage, this->finalFlareSpeed); this->starEnergy -=this->starEnergyPerFlare; Index: gquest.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gquest.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** gquest.cpp 24 Mar 2004 23:51:43 -0000 1.20 --- gquest.cpp 14 Aug 2005 16:14:50 -0000 1.21 *************** *** 90,94 **** { // just to speed up game ! if( random()%50 ) return; --- 90,94 ---- { // just to speed up game ! if( random(50) ) return; Index: gup.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gup.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gup.cpp 24 Mar 2004 23:51:43 -0000 1.11 --- gup.cpp 14 Aug 2005 16:14:50 -0000 1.12 *************** *** 739,747 **** angle -= frame_time / 10.0; if (angle < 0) angle += 360; ! if (random(1700) < frame_time) { Query q; q.begin(focus, OBJECT_LAYERS, 666); for (;q.current; q.next() ) { ! if (!(focus->sameTeam(q.current))) q.current->handle_damage(focus, 0, random() % 6); } } --- 739,747 ---- angle -= frame_time / 10.0; if (angle < 0) angle += 360; ! if (tw_random(1700) < frame_time) { Query q; q.begin(focus, OBJECT_LAYERS, 666); for (;q.current; q.next() ) { ! if (!(focus->sameTeam(q.current))) q.current->handle_damage(focus, 0, random(6)); } } Index: planet3d.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/planet3d.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** planet3d.cpp 11 Jul 2005 00:25:58 -0000 1.20 --- planet3d.cpp 14 Aug 2005 16:14:50 -0000 1.21 *************** *** 149,153 **** { // create a 2D planet ! Planet *planet = new Planet (position, meleedata.planetSprite, random(meleedata.planetSprite->frames())); game->add (planet); return planet; --- 149,153 ---- { // create a 2D planet ! Planet *planet = new Planet (position, meleedata.planetSprite, tw_random(meleedata.planetSprite->frames())); game->add (planet); return planet; |
From: Rob <geo...@us...> - 2005-08-14 16:15:00
|
Update of /cvsroot/timewarp/source/sc2ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/sc2ships Modified Files: shpchmav.cpp shporzne.cpp shppkufu.cpp shpslypr.cpp shputwju.cpp shpzfpst.cpp Log Message: fixed/updates for the use of random() Index: shpzfpst.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpzfpst.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpzfpst.cpp 2 Aug 2005 00:23:49 -0000 1.14 --- shpzfpst.cpp 14 Aug 2005 16:14:50 -0000 1.15 *************** *** 57,61 **** int ZoqFotPikStinger::activate_weapon() { add(new ZoqFotPikShot( ! Vector2(0.0, 0.5*get_size().y), angle + ANGLE_RATIO * random(-10.0, 10.0), weaponVelocity, weaponDamage, weaponRange, weaponArmour, this, data->spriteWeapon, 6)); --- 57,61 ---- int ZoqFotPikStinger::activate_weapon() { add(new ZoqFotPikShot( ! Vector2(0.0, 0.5*get_size().y), angle + ANGLE_RATIO * tw_random(-10.0, 10.0), weaponVelocity, weaponDamage, weaponRange, weaponArmour, this, data->spriteWeapon, 6)); Index: shporzne.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shporzne.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shporzne.cpp 11 Jul 2005 00:25:58 -0000 1.17 --- shporzne.cpp 14 Aug 2005 16:14:50 -0000 1.18 *************** *** 250,254 **** return; } ! chance = random() % 10000; if (chance < 9 * frame_time) { --- 250,254 ---- return; } ! chance = tw_random(10000); if (chance < 9 * frame_time) { Index: shpchmav.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpchmav.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpchmav.cpp 2 Aug 2005 00:23:48 -0000 1.16 --- shpchmav.cpp 14 Aug 2005 16:14:50 -0000 1.17 *************** *** 87,91 **** pos + unit_vector(angle) * (tw_random(weaponRange-15) + 25 + 25) + Vector2(tw_random(-25,25), tw_random(-25,25)), ! data->spriteWeaponExplosion, (random()%4)*10, 10, 75, DEPTH_EXPLOSIONS)); }; --- 87,91 ---- pos + unit_vector(angle) * (tw_random(weaponRange-15) + 25 + 25) + Vector2(tw_random(-25,25), tw_random(-25,25)), ! data->spriteWeaponExplosion, (tw_random(4))*10, 10, 75, DEPTH_EXPLOSIONS)); }; *************** *** 99,108 **** pos + unit_vector(angle) * (tw_random(weaponRange-15) + 25 + 25) + Vector2(tw_random(-25,25), tw_random(-25,25)), ! data->spriteWeaponExplosion, (random()%4)*10, 10, 25+tw_random(50), DEPTH_EXPLOSIONS, tw_random(1.0) + tw_random(1.0)) ); add(new Animation(this, pos + unit_vector(angle) * (tw_random(weaponRange-15) + 25 + 25) + Vector2(tw_random(-25,25), tw_random(-25,25)), ! data->spriteWeaponExplosion, (random()%4)*10, 10, 50, DEPTH_EXPLOSIONS) ); } --- 99,108 ---- pos + unit_vector(angle) * (tw_random(weaponRange-15) + 25 + 25) + Vector2(tw_random(-25,25), tw_random(-25,25)), ! data->spriteWeaponExplosion, (random(4))*10, 10, 25+tw_random(50), DEPTH_EXPLOSIONS, tw_random(1.0) + tw_random(1.0)) ); add(new Animation(this, pos + unit_vector(angle) * (tw_random(weaponRange-15) + 25 + 25) + Vector2(tw_random(-25,25), tw_random(-25,25)), ! data->spriteWeaponExplosion, (random(4))*10, 10, 50, DEPTH_EXPLOSIONS) ); } *************** *** 140,144 **** int lfcount, SpaceLocation *opos, Vector2 rel_pos) : ! Laser(opos, langle, pallete_color[hot_color[random() % HOT_COLORS]], lrange, ldamage, lfcount, opos, rel_pos, true) { --- 140,144 ---- int lfcount, SpaceLocation *opos, Vector2 rel_pos) : ! Laser(opos, langle, pallete_color[hot_color[random(HOT_COLORS)]], lrange, ldamage, lfcount, opos, rel_pos, true) { Index: shputwju.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shputwju.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shputwju.cpp 24 Mar 2004 23:51:44 -0000 1.7 --- shputwju.cpp 14 Aug 2005 16:14:50 -0000 1.8 *************** *** 77,81 **** } if (fortitude && (normal > 0)) { ! if (normal > random(3)) normal -= fortitude; if (normal < 0) normal = 0; } --- 77,81 ---- } if (fortitude && (normal > 0)) { ! if (normal > tw_random(3)) normal -= fortitude; if (normal < 0) normal = 0; } Index: shppkufu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shppkufu.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shppkufu.cpp 2 Aug 2005 00:23:49 -0000 1.15 --- shppkufu.cpp 14 Aug 2005 16:14:50 -0000 1.16 *************** *** 48,52 **** ++num_reincarnations; ! double xra = random(1.0); double ra = num_reincarnations / (num_reincarnations+1); if ( xra > ra) --- 48,52 ---- ++num_reincarnations; ! double xra = tw_random(1.0); double ra = num_reincarnations / (num_reincarnations+1); if ( xra > ra) *************** *** 62,66 **** ! pos = random(Vector2(3000,3000)) - Vector2(1500,1500); SpaceLocation *spacePlanet = nearest_planet(); if (spacePlanet && (distance(spacePlanet) < 1000.0)) { --- 62,66 ---- ! pos = tw_random(Vector2(3000,3000)) - Vector2(1500,1500); SpaceLocation *spacePlanet = nearest_planet(); if (spacePlanet && (distance(spacePlanet) < 1000.0)) { Index: shpslypr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpslypr.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpslypr.cpp 23 Jul 2005 14:06:56 -0000 1.17 --- shpslypr.cpp 14 Aug 2005 16:14:50 -0000 1.18 *************** *** 55,59 **** thrustForward(TRUE) { ! sprite_index2 = random() & 63; segment_length = get_config_int("Weapon", "SegmentLength",0); segment_dispersion = get_config_int("Weapon", "SegmentLengthDispersion",0); --- 55,59 ---- thrustForward(TRUE) { ! sprite_index2 = tw_random() & 63; segment_length = get_config_int("Weapon", "SegmentLength",0); segment_dispersion = get_config_int("Weapon", "SegmentLengthDispersion",0); |
From: Rob <geo...@us...> - 2005-08-14 16:15:00
|
Update of /cvsroot/timewarp/source/sc3ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4182/source/sc3ships Modified Files: shpexqen.cpp shplk_sa.cpp Log Message: fixed/updates for the use of random() Index: shpexqen.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpexqen.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpexqen.cpp 2 Aug 2005 00:23:49 -0000 1.10 --- shpexqen.cpp 14 Aug 2005 16:14:50 -0000 1.11 *************** *** 77,81 **** void ExquivanEnigma::calculate_fire_weapon() { ! weapon_sample = random() % 2; Ship::calculate_fire_weapon(); } --- 77,81 ---- void ExquivanEnigma::calculate_fire_weapon() { ! weapon_sample = tw_random(2); Ship::calculate_fire_weapon(); } Index: shplk_sa.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shplk_sa.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shplk_sa.cpp 11 Jul 2005 00:25:59 -0000 1.7 --- shplk_sa.cpp 14 Aug 2005 16:14:50 -0000 1.8 *************** *** 37,41 **** int LkSanctorum::activate_weapon() { add(new Missile(this, ! Vector2(0.0, (size.y / 2.0+5)), angle - (random(5) - 2) * (3.0 * ANGLE_RATIO), weaponVelocity, weaponDamage, weaponRange, weaponArmour, this, data->spriteWeapon)); --- 37,41 ---- int LkSanctorum::activate_weapon() { add(new Missile(this, ! Vector2(0.0, (size.y / 2.0+5)), angle - (tw_random(5) - 2) * (3.0 * ANGLE_RATIO), weaponVelocity, weaponDamage, weaponRange, weaponArmour, this, data->spriteWeapon)); |
From: Rob <geo...@us...> - 2005-08-14 16:13:16
|
Update of /cvsroot/timewarp/ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3808/ships Modified Files: shpalckr.dat shprekas.dat shpvelcr.dat shpvuvji.dat Log Message: updates in ship graphics Index: shpvuvji.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpvuvji.dat,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsVEvgYe and /tmp/cvsbeTVOA differ Index: shpalckr.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpalckr.dat,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvsTuFWdT and /tmp/cvsdLvffh differ Index: shpvelcr.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shpvelcr.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsiPxCUn and /tmp/cvsmKiTZM differ Index: shprekas.dat =================================================================== RCS file: /cvsroot/timewarp/ships/shprekas.dat,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvs4OXfOs and /tmp/cvsROos6R differ |
From: Rob <geo...@us...> - 2005-08-10 21:08:00
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23345/source/melee Modified Files: mframe.cpp mgame.cpp mgame.h Log Message: game loop / networking update Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** mgame.cpp 8 Aug 2005 19:08:23 -0000 1.52 --- mgame.cpp 10 Aug 2005 21:07:48 -0000 1.53 *************** *** 1182,1186 **** // unless global-synch of lag is enabled. lag_increase += 1; ! message.print(1500, 15, "lag increase to [%i] frames", lag_buffer + lag_increase); } } --- 1182,1187 ---- // unless global-synch of lag is enabled. lag_increase += 1; ! message.print(1500, 15, "lag increase to [%i] frames or [%i] ms", lag_buffer + lag_increase, ! (lag_buffer + lag_increase) * frame_time); } } *************** *** 1195,1199 **** // unless global-synch of lag is enabled. lag_decrease += 1; ! message.print(1500, 15, "lag decrease to [%i] frames", lag_buffer - lag_decrease); } } --- 1196,1201 ---- // unless global-synch of lag is enabled. lag_decrease += 1; ! message.print(1500, 15, "lag decrease to [%i] frames or [%i] ms", lag_buffer - lag_decrease, ! (lag_buffer - lag_decrease) * frame_time); } } *************** *** 1373,1376 **** --- 1375,1381 ---- + // if you increase lag, iterations can be skipped... + skip_iteration = false; + try { while(!game_done) *************** *** 1386,1389 **** --- 1391,1395 ---- } + // physics can catch up with graphics. bool catching_up; *************** *** 1531,1535 **** // handle some important buttons... // must be done before the keys are re-set to 0 by the share_key ! if (player[p_local]) { --- 1537,1541 ---- // handle some important buttons... // must be done before the keys are re-set to 0 by the share_key ! if (player[p_local] && !skip_iteration ) { *************** *** 1540,1552 **** { CALL(event_lag_increase, p_local); - message.print(500, 12, "lag increase pressed"); toggle_key_inc_lag = false; - } else { - //message.print(500, 7, "lag increase held"); } - } else { toggle_key_inc_lag = true; - //message.print(500, 15, "lag increase released"); } --- 1546,1553 ---- *************** *** 1557,1561 **** { CALL(event_lag_decrease, p_local); - message.print(500, 12, "lag decrease pressed"); toggle_key_dec_lag = false; } --- 1558,1561 ---- *************** *** 1576,1579 **** --- 1576,1581 ---- network_share_keys(); + // after it's used, it can be re-set. + skip_iteration = false; // crc checking is now only available, if all the games involved run synchronized, *************** *** 1611,1615 **** --- 1613,1622 ---- if (player[p] && player[p]->islocal()) { + // notify within this iteration + // that this iteration is "empty", i.e., no control-info and such + CALL(notify_skip_iteration, p); + CALL(start_iteration, p); + } } *************** *** 1637,1642 **** int frame_time_length = frame_time / turbo; ! if (t_execute < 0.25*(frame_time / turbo)) { // in this case, you can try to have physics in a linear fashion --- 1644,1650 ---- + double factor = 0.25; int frame_time_length = frame_time / turbo; ! if (t_execute < factor*frame_time_length) { // in this case, you can try to have physics in a linear fashion *************** *** 1644,1648 **** if ((hiccup_margin >= 0) && (num_catchups < max_catchups) // prevent too many catchups (that will delay graphics update too much) ! && (next_tic_time + hiccup_margin > /* < */ time_current)) { --- 1652,1656 ---- if ((hiccup_margin >= 0) && (num_catchups < max_catchups) // prevent too many catchups (that will delay graphics update too much) ! && (next_tic_time + hiccup_margin > time_current + frame_time_length)) { *************** *** 1657,1661 **** // The follow may be a little more stable in time... catching_up = true; ! next_tic_time += frame_time_length / (num_catchups + 2); } else { catching_up = false; --- 1665,1673 ---- // The follow may be a little more stable in time... catching_up = true; ! next_tic_time += frame_time_length; // hmmm... ! // perhaps this is better... cause you're below "time" anyway... ! // so you will be catching up anyway... ! ! //xxx this might be... conceptual mistake... } else { catching_up = false; *************** *** 1707,1711 **** { NetLog *l = (NetLog*) glog; ! //l->recv_noblock(); // receive stuff, if you can [is not needed here ; sending has priority] // this helps to reduce idle-time, cause it doesn't have to wait till --- 1719,1723 ---- { NetLog *l = (NetLog*) glog; ! l->recv_noblock(); // receive stuff, if you can // this helps to reduce idle-time, cause it doesn't have to wait till *************** *** 1741,1746 **** time = get_time(); ! if (time >= next_render_time ) ! next_render_time = time + msecs_per_render; } } --- 1753,1759 ---- time = get_time(); ! // actually, just don't bother about linear timing animations... because there is ! // a rather bad effect on game lag if too much time is allocated for animation. ! next_render_time = time + msecs_per_render; } } *************** *** 2618,2622 **** // executes a call to the function in the list, with that id-number int req; ! log_int(req); //xxx it stopped here, requiring a read... because of the loop ? // player index is not stored: it's assumed that each player has its own channel issue(req, p); --- 2631,2643 ---- // executes a call to the function in the list, with that id-number int req; ! log_int(req); ! ! if (log_empty()) // only try to read the buffer, if there are data in the buffer... ! { ! message.print(1500, 12, "waiting for network data (should not happen)!"); ! // if this indeed occurs, then I'll have to add a length-measure for each "event" ... ! // so I hope it doesn't happen. ! } ! // player index is not stored: it's assumed that each player has its own channel issue(req, p); *************** *** 2652,2655 **** --- 2673,2677 ---- EVENT(Game, disconnect); EVENT(Game, start_iteration); + EVENT(Game, notify_skip_iteration); EVENT(Game, event_sharecontrols); EVENT(Game, event_lag_increase); *************** *** 2907,2910 **** --- 2929,2940 ---- + void Game::notify_skip_iteration(int iplayer) + { + if (log_synched) + { + skip_iteration = true; + } + } + void Game::start_iteration(int iplayer) { Index: mgame.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** mgame.h 6 Aug 2005 23:29:48 -0000 1.22 --- mgame.h 10 Aug 2005 21:07:48 -0000 1.23 *************** *** 347,350 **** --- 347,352 ---- void test_event1(int iplayer); void start_iteration(int iplayer); + bool skip_iteration; + void notify_skip_iteration(int iplayer); void share_crc(int iplayer); Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** mframe.cpp 8 Aug 2005 19:08:20 -0000 1.37 --- mframe.cpp 10 Aug 2005 21:07:48 -0000 1.38 *************** *** 1341,1345 **** { NetLog *l = (NetLog*) glog; ! // l->recv_noblock(); // receive stuff, if you can [not sure if this is required] // this helps to reduce idle-time, cause it doesn't have to wait till --- 1341,1345 ---- { NetLog *l = (NetLog*) glog; ! l->recv_noblock(); // receive stuff, if you can [not sure if this is required] // this helps to reduce idle-time, cause it doesn't have to wait till |
From: Rob <geo...@us...> - 2005-08-10 21:07:17
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23206/source/ais Modified Files: c_wussie.cpp Log Message: AI update Index: c_wussie.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_wussie.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** c_wussie.cpp 8 Aug 2005 14:33:50 -0000 1.22 --- c_wussie.cpp 10 Aug 2005 21:07:05 -0000 1.23 *************** *** 11,14 **** --- 11,23 ---- #include "../melee/mmain.h" + enum {OPTION_UNKNOWN = 0, OPTION_FRONT, OPTION_NO_FRONT, OPTION_SIDES, + OPTION_FEILD, OPTION_NARROW, OPTION_HOMING, OPTION_NO_RANGE, OPTION_BACK, + OPTION_PRECEDENCE, OPTION_DEFENSE, OPTION_BATTERY, OPTION_MAX_BATT, OPTION_RESERVE_BATT, + OPTION_CLOAK, OPTION_PROXIMITY, OPTION_PLUS_FIRE, OPTION_PLUS_SPECIAL, OPTION_LAUNCHED, OPTION_HOLD, + OPTION_NO_PROXIMITY, OPTION_NEXT_STATE, OPTION_RESET_STATE, OPTION_ALWAYS_WHEN_FULL, OPTION_MINE, + OPTION_NONE, + OPTION_LAST // this must be the last in the line + }; + /* #define OPTION_UNKNOWN 0 #define OPTION_NONE 1 *************** *** 37,40 **** --- 46,50 ---- #define OPTION_ALWAYS_WHEN_FULL 24 #define OPTION_MINE 25 + */ #define STATE_TOO_CLOSE 0 *************** *** 47,51 **** // for testing (graphics): ! //#include "scp.h" /*! \brief Check danger --- 57,61 ---- // for testing (graphics): ! #include "scp.h" /*! \brief Check danger *************** *** 214,217 **** --- 224,229 ---- } + + double da = ship->get_angle() - a; *************** *** 222,225 **** --- 234,251 ---- double a_ev = evasion_angle_change; + // if the enemy weapon is slow, then you should "simply" run away from it... if it is faster, + // then you should try to move perpendicularly... + double v_ship, v_shot; + v_ship = ship->vel.length(); + v_shot = shot->vel.length(); + + if (v_ship > 0.9 * v_shot) // move straight away, if possible... and hope the shot loses damage after a while + { + a = ship->trajectory_angle(shot); + a_ev = PI; // move straight away + } else { + + a_ev = evasion_angle_change; + } // steer away from the dangerous object. *************** *** 573,577 **** ! int i, j; if (!ship->target) return action; --- 599,603 ---- ! int j; if (!ship->target) return action; *************** *** 583,586 **** --- 609,618 ---- distance = ship->distance (ship->target); + + // reduce the distance a bit by the respective ship sizes; this is important for shorter range weapons. + distance -= 0.5 * (ship->size.x + ship->target->size.x); + if (distance < 0) + distance = 0; + for (j = 0; j < 2; j++) { *************** *** 588,602 **** dontfireoption[j] = FALSE; sweep[j] = 20 * ANGLE_RATIO; ! for (i = 0; i < MAX_OPTION; i++) ! { ! if (option_type[state][j][i] == OPTION_NARROW) ! sweep[j] = 5 * ANGLE_RATIO; ! if (option_type[state][j][i] == OPTION_HOMING) ! sweep[j] = 35 * ANGLE_RATIO; ! } } Vector2 ship_unit_vector; ! double target_vel;//, target_vel_relative; // ship orientation vector --- 620,632 ---- dontfireoption[j] = FALSE; sweep[j] = 20 * ANGLE_RATIO; ! ! if (option_type[state][j][OPTION_NARROW]) ! sweep[j] = 5 * ANGLE_RATIO; ! if (option_type[state][j][OPTION_HOMING]) ! sweep[j] = 35 * ANGLE_RATIO; } Vector2 ship_unit_vector; ! double target_vel, weapon_vel; // ship orientation vector *************** *** 604,611 **** // absolute movement of enemy relative to current ship direction target_vel = dot_product(ship->target->vel, ship_unit_vector); - // relative movement of enemy to the current ship, also measured along the ship orientation - //target_vel_relative = target_vel - dot_product(ship->vel, ship_unit_vector); double a; --- 634,641 ---- // absolute movement of enemy relative to current ship direction + // (and corrected for relativity... namely, if the weapon also has some of the ship speed! + weapon_vel = option_velocity[state][j] + dot_product(rel[state][j] * ship->vel, ship_unit_vector); target_vel = dot_product(ship->target->vel, ship_unit_vector); double a; *************** *** 620,626 **** if (j == 0) ! fire_front = TRUE; else ! fire_front = FALSE; if (j == 0) --- 650,656 ---- if (j == 0) ! fire_front = TRUE; // primary = front by default. else ! fire_front = FALSE; // secondary = back by default. if (j == 0) *************** *** 631,636 **** // intercept time along the ship orientation (line of sight) double t_intercept; ! if (option_velocity[state][j] - target_vel != 0) ! t_intercept = distance / (option_velocity[state][j] - target_vel); else t_intercept = 1E6; --- 661,666 ---- // intercept time along the ship orientation (line of sight) double t_intercept; ! if (weapon_vel > target_vel) ! t_intercept = distance / (weapon_vel - target_vel); // weapon_vel includes correction for weapon relativity else t_intercept = 1E6; *************** *** 638,650 **** // intercept distance along the line of sight double d_intercept; ! d_intercept = t_intercept * option_velocity[state][j]; //xxx this does not take relativity into account ? ! bool weapon_in_range = (option_range[state][j] > 1.1 * d_intercept); ! // check, if the (uncorrected) velocity isn't too high for your weapon: if (option_velocity[state][j] < 0.9 * ship->target->vel.length() && (option_range[state][j] > 0.4 * distance || distance > 500)) dontfireoption[j] = TRUE; --- 668,684 ---- // intercept distance along the line of sight double d_intercept; ! d_intercept = t_intercept * weapon_vel; //xxx this does not take relativity into account ? ! bool weapon_in_range = (option_range[state][j]+0.5*ship->size.x > 1.0 * d_intercept); ! ! /* hmmm... this is too detailed, and too general. ! // check, if the (uncorrected) velocity isn't too high for your weapon, i.e., the enemy ship ! // moves faster than you: if (option_velocity[state][j] < 0.9 * ship->target->vel.length() && (option_range[state][j] > 0.4 * distance || distance > 500)) dontfireoption[j] = TRUE; + */ *************** *** 655,801 **** rV = option_velocity[state][j] / (v + option_velocity[state][j]); rD = option_range[state][j] / (option_range[state][j] + distance); if ( rD < rV * out_of_range_multiplier ) // out of range condition dontfireoption[j] = TRUE; - for (i = 0; i < MAX_OPTION; i++) - { ! switch (option_type[state][j][i]) { ! default: ! case OPTION_UNKNOWN: ! if (i == 0) ! if (j == 0) ! { ! if ((fabs (angle_fire) < sweep[j]) && ! weapon_in_range ) ! fireoption[0] = TRUE; ! } ! else if (ship->batt != ship->batt_max) ! dontfireoption[1] = TRUE; ! break; ! ! case OPTION_FRONT: ! fire_front = TRUE; ! field_fire = FALSE; ! break; ! ! case OPTION_NO_FRONT: ! fire_front = FALSE; ! field_fire = FALSE; ! break; ! ! case OPTION_BACK: ! if (fabs (angle_fire) > (PI - sweep[j])) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! break; ! ! case OPTION_SIDES: ! if ((fabs (angle_fire) < PI/2 + sweep[j]) ! && (fabs (angle_fire) > PI/2 - sweep[j])) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! break; ! case OPTION_FEILD: ! //fireoption[j] = TRUE; //xxx should you disable this here? I think so... ! field_fire = TRUE; ! break; ! case OPTION_NO_RANGE: ! range_fire = FALSE; ! break; ! case OPTION_NO_PROXIMITY: ! if (distance < option_range[state][j]) ! dontfireoption[j] = TRUE; ! else ! fireoption[j] = TRUE; // added... is needed for mrmrm state-change ! range_fire = FALSE; ! break; ! case OPTION_PROXIMITY: ! if (distance > option_range[state][j]) dontfireoption[j] = TRUE; ! else ! fireoption[j] = TRUE; // added... is needed for mrmrm state-change ! range_fire = TRUE; ! break; ! ! case OPTION_BATTERY: ! if (ship->batt <= batt_level[state][j]) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! break; ! ! case OPTION_MINE: ! a = atan(ship->target->get_vel ()); ! if (fabs ! (normalize ! (ship->target->trajectory_angle (ship) + PI/2, ! PI2) - a) < sweep[j]) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! fire_front = FALSE; ! break; ! ! case OPTION_CLOAK: ! if (!(ship->isInvisible ())) ! fireoption[j] = TRUE; ! else dontfireoption[j] = TRUE; ! break; ! ! case OPTION_DEFENSE: ! if (check_danger () > (4 / option_freq[state][j])) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! break; ! case OPTION_MAX_BATT: ! if (ship->batt != ship->batt_max) { ! if (!option_held[j]) ! dontfireoption[j] = TRUE; } ! break; ! ! case OPTION_RESERVE_BATT: ! if (ship->batt < batt_level[state][j]) ! if (!option_held[j]) ! dontfireoption[j] = TRUE; ! break; ! ! case OPTION_LAUNCHED: ! if (option_held[j]) { ! bombx[j] += (bombvx[j] * frame_time); ! bomby[j] += (bombvy[j] * frame_time); ! normalize (bombx[j], map_size.x); ! normalize (bomby[j], map_size.y); ! bomb = ! new SpaceLocation (NULL, Vector2(bombx[j], bomby[j]), 0); ! if (ship->target->distance (bomb) > bombdistance[j]) ! { ! option_held[j] = FALSE; ! dontfireoption[j] = TRUE; ! } ! else ! { ! bombdistance[j] = ship->target->distance (bomb); ! } ! delete bomb; } ! break; ! ! case OPTION_NONE: ! dontfireoption[j] = TRUE; ! break; } } if (range_fire) --- 689,856 ---- rV = option_velocity[state][j] / (v + option_velocity[state][j]); rD = option_range[state][j] / (option_range[state][j] + distance); + if ( rD < rV * out_of_range_multiplier ) // out of range condition dontfireoption[j] = TRUE; + //if (j == 0)// && weapon_in_range) + //{ + // message.print(100, 15, "in range (weapon: %i) (rV=%4.2lf rD=%4.2lf:%i)", int(weapon_in_range), rV, rD); + //} ! // ------------- CHECKING VARIOUS OPTIONS ------------- ! ! if (option_type[state][j][OPTION_UNKNOWN]) ! { ! // this is the case, if there were no options checked... ! if (j == 0) { ! if ((fabs (angle_fire) < sweep[j]) && ! weapon_in_range ) ! fireoption[0] = TRUE; ! } ! } ! if (option_type[state][j][OPTION_FRONT]) ! { ! fire_front = TRUE; ! field_fire = FALSE; ! } ! ! if (option_type[state][j][OPTION_NO_FRONT]) ! { ! fire_front = FALSE; ! field_fire = FALSE; ! } ! ! if (option_type[state][j][OPTION_BACK]) ! { ! if (fabs (angle_fire) > (PI - sweep[j])) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! } ! ! if (option_type[state][j][OPTION_SIDES]) ! { ! if ((fabs (angle_fire) < PI/2 + sweep[j]) ! && (fabs (angle_fire) > PI/2 - sweep[j])) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! } ! ! if (option_type[state][j][OPTION_FEILD]) ! { ! //fireoption[j] = TRUE; //xxx should you disable this here? I think so... ! field_fire = TRUE; ! } ! if (option_type[state][j][OPTION_NO_RANGE]) ! { ! range_fire = FALSE; ! } ! ! if (option_type[state][j][OPTION_NO_PROXIMITY]) ! { ! if (distance < option_range[state][j]) ! dontfireoption[j] = TRUE; ! else ! fireoption[j] = TRUE; // added... is needed for mrmrm state-change ! range_fire = FALSE; ! } ! ! if (option_type[state][j][OPTION_PROXIMITY]) ! { ! if (distance > option_range[state][j]) ! dontfireoption[j] = TRUE; ! else ! fireoption[j] = TRUE; // added... is needed for mrmrm state-change ! range_fire = TRUE; ! } ! if (option_type[state][j][OPTION_BATTERY]) ! { ! if (ship->batt <= batt_level[state][j]) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! } ! ! if (option_type[state][j][OPTION_MINE]) ! { ! a = atan(ship->target->get_vel ()); ! if (fabs ! (normalize ! (ship->target->trajectory_angle (ship) + PI/2, ! PI2) - a) < sweep[j]) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! fire_front = FALSE; ! } ! ! if (option_type[state][j][OPTION_CLOAK]) ! { ! if (!(ship->isInvisible ())) ! fireoption[j] = TRUE; ! else ! dontfireoption[j] = TRUE; ! } ! if (option_type[state][j][OPTION_DEFENSE]) ! { ! if (check_danger () > (4 / option_freq[state][j])) ! fireoption[j] = TRUE; ! field_fire = FALSE; ! } ! ! if (option_type[state][j][OPTION_MAX_BATT]) ! { ! if (ship->batt != ship->batt_max) ! { ! if (!option_held[j]) dontfireoption[j] = TRUE; ! } ! } ! ! if (option_type[state][j][OPTION_RESERVE_BATT]) ! { ! if (ship->batt < batt_level[state][j]) ! if (!option_held[j]) dontfireoption[j] = TRUE; ! } ! if (option_type[state][j][OPTION_LAUNCHED]) ! { ! if (option_held[j]) ! { ! bombx[j] += (bombvx[j] * frame_time); ! bomby[j] += (bombvy[j] * frame_time); ! normalize (bombx[j], map_size.x); ! normalize (bomby[j], map_size.y); ! bomb = ! new SpaceLocation (NULL, Vector2(bombx[j], bomby[j]), 0); ! if (ship->target->distance (bomb) > bombdistance[j]) { ! option_held[j] = FALSE; ! dontfireoption[j] = TRUE; } ! else { ! bombdistance[j] = ship->target->distance (bomb); } ! delete bomb; } + } + + if (option_type[state][j][OPTION_NONE]) + { + dontfireoption[j] = TRUE; + } + + // ----------- DONE CHECKING THE VARIOUS OPTIONS -------- + + + if (range_fire) *************** *** 816,860 **** } } for (j = 0; j < 2; j++) { ! for (i = 0; i < MAX_OPTION; i++) { ! if (option_type[state][j][i] == OPTION_LAUNCHED) { ! if ((!option_held[j]) && (fireoption[j]) ! && (!dontfireoption[j])) ! { ! bombx[j] = ship->normal_pos().x; ! bomby[j] = ship->normal_pos().y; ! bombvx[j] = (ship->get_vel().x * rel[state][j]) + ! (option_velocity[state][j] * ! cos (ship->get_angle ())); ! bombvy[j] = ! (ship->get_vel().y * rel[state][j]) + ! (option_velocity[state][j] * ! sin (ship->get_angle ())); ! bombdistance[j] = ship->distance (ship->target); ! } } ! if (option_type[state][j][i] == OPTION_HOLD) { ! if ((option_held[j]) && (fireoption[j]) ! && (!dontfireoption[j])) ! { ! dontfireoption[j] = TRUE; ! option_held[j] = FALSE; ! } ! else if (option_held[j]) ! { ! option_held[j] = TRUE; ! fireoption[j] = TRUE; ! dontfireoption[j] = FALSE; ! } ! else if (!option_held[j]) ! { ! option_held[j] = TRUE; ! fireoption[j] = TRUE; ! dontfireoption[j] = FALSE; ! } } } --- 871,914 ---- } } + + for (j = 0; j < 2; j++) { ! if (option_type[state][j][OPTION_LAUNCHED]) { ! if ((!option_held[j]) && (fireoption[j]) ! && (!dontfireoption[j])) { ! bombx[j] = ship->normal_pos().x; ! bomby[j] = ship->normal_pos().y; ! bombvx[j] = (ship->get_vel().x * rel[state][j]) + ! (option_velocity[state][j] * ! cos (ship->get_angle ())); ! bombvy[j] = ! (ship->get_vel().y * rel[state][j]) + ! (option_velocity[state][j] * ! sin (ship->get_angle ())); ! bombdistance[j] = ship->distance (ship->target); } ! } ! if (option_type[state][j][OPTION_HOLD]) ! { ! if ((option_held[j]) && (fireoption[j]) ! && (!dontfireoption[j])) { ! dontfireoption[j] = TRUE; ! option_held[j] = FALSE; ! } ! else if (option_held[j]) ! { ! option_held[j] = TRUE; ! fireoption[j] = TRUE; ! dontfireoption[j] = FALSE; ! } ! else if (!option_held[j]) ! { ! option_held[j] = TRUE; ! fireoption[j] = TRUE; ! dontfireoption[j] = FALSE; } } *************** *** 870,900 **** } ! for (i = 0; i < MAX_OPTION; i++) { ! if (option_type[state][j][i] == OPTION_PRECEDENCE) { ! if (fireoption[j] && (!dontfireoption[j])) ! { ! int k; ! if ( j == 0 ) ! k = 1; ! else ! k = 0; ! ! dontfireoption[k] = TRUE; ! } } ! ! ! if (option_type[state][j][i] == OPTION_ALWAYS_WHEN_FULL) { ! if (ship->batt >= ship->batt_max) ! { ! fireoption[j] = TRUE; ! dontfireoption[j] = FALSE; ! } } - } } --- 924,951 ---- } ! if (option_type[state][j][OPTION_PRECEDENCE]) { ! if (fireoption[j] && (!dontfireoption[j])) { ! int k; ! if ( j == 0 ) ! k = 1; ! else ! k = 0; ! ! dontfireoption[k] = TRUE; } ! } ! ! ! if (option_type[state][j][OPTION_ALWAYS_WHEN_FULL]) ! { ! if (ship->batt >= ship->batt_max) { ! fireoption[j] = TRUE; ! dontfireoption[j] = FALSE; } } + } *************** *** 911,929 **** option_time[j] = option_timer[state][j]; ! for (i = 0; i < MAX_OPTION; i++) ! { ! if (option_type[state][j][i] == OPTION_LAUNCHED) ! option_held[state] = TRUE; ! if (option_type[state][j][i] == OPTION_HOLD) ! option_held[state] = TRUE; ! if (option_type[state][j][i] == OPTION_PLUS_SPECIAL) ! action |= keyflag::special; ! if (option_type[state][j][i] == OPTION_PLUS_FIRE) ! action |= keyflag::fire; ! if (option_type[state][j][i] == OPTION_NEXT_STATE) ! newstate++; ! if (option_type[state][j][i] == OPTION_RESET_STATE) ! newstate = 0; ! } } else --- 962,982 ---- option_time[j] = option_timer[state][j]; ! if (option_type[state][j][OPTION_LAUNCHED]) ! option_held[state] = TRUE; ! ! if (option_type[state][j][OPTION_HOLD]) ! option_held[state] = TRUE; ! ! if (option_type[state][j][OPTION_PLUS_SPECIAL]) ! action |= keyflag::special; ! ! if (option_type[state][j][OPTION_PLUS_FIRE]) ! action |= keyflag::fire; ! ! if (option_type[state][j][OPTION_NEXT_STATE]) ! newstate++; ! ! if (option_type[state][j][OPTION_RESET_STATE]) ! newstate = 0; } else *************** *** 955,958 **** --- 1008,1012 ---- // } + void ControlWussie::select_ship (Ship * ship_pointer, const char *ship_name) { *************** *** 969,978 **** for (k = 0; k < MAX_STATES; k++) { for (j = 0; j < 2; j++) { strcpy (states, "AI3_Default"); if (k != 0) sprintf (states + strlen (states), "%d", k + 1); ! for (i = 0; i < MAX_OPTION; i++) { if (j == 0) --- 1023,1041 ---- for (k = 0; k < MAX_STATES; k++) { + + // check primary and secondary weapon for (j = 0; j < 2; j++) { + // reset all posibilities. + for ( i = 0; i < OPTION_LAST; ++i ) + option_type[k][j][i] = false; + + // initialize the AI options strcpy (states, "AI3_Default"); if (k != 0) sprintf (states + strlen (states), "%d", k + 1); ! ! // read at most 10 possible weapon definitions... ! for (i = 0; i < 10; i++) // 0 to 9 { if (j == 0) *************** *** 980,1037 **** else strcpy (sstr, "Special"); if (i != 0) sprintf (sstr + strlen (sstr), "%d", i + 1); w = get_config_string (states, sstr, ""); ! option_type[k][j][i] = OPTION_UNKNOWN; if (!strcmp (w, "No_Front")) ! option_type[k][j][i] = OPTION_NO_FRONT; else if (!strcmp (w, "Front")) ! option_type[k][j][i] = OPTION_FRONT; else if (!strcmp (w, "Sides")) ! option_type[k][j][i] = OPTION_SIDES; else if (!strcmp (w, "Field")) ! option_type[k][j][i] = OPTION_FEILD; else if (!strcmp (w, "Narrow")) ! option_type[k][j][i] = OPTION_NARROW; else if (!strcmp (w, "Homing")) ! option_type[k][j][i] = OPTION_HOMING; else if (!strcmp (w, "No_range")) ! option_type[k][j][i] = OPTION_NO_RANGE; else if (!strcmp (w, "Back")) ! option_type[k][j][i] = OPTION_BACK; else if (!strcmp (w, "Precedence")) ! option_type[k][j][i] = OPTION_PRECEDENCE; else if (!strcmp (w, "Defense")) ! option_type[k][j][i] = OPTION_DEFENSE; else if (!strcmp (w, "Battery")) ! option_type[k][j][i] = OPTION_BATTERY; else if (!strcmp (w, "Max_Battery")) ! option_type[k][j][i] = OPTION_MAX_BATT; else if (!strcmp (w, "Reserve_Battery")) ! option_type[k][j][i] = OPTION_RESERVE_BATT; else if (!strcmp (w, "Cloak")) ! option_type[k][j][i] = OPTION_CLOAK; else if (!strcmp (w, "Proximity")) ! option_type[k][j][i] = OPTION_PROXIMITY; else if (!strcmp (w, "Plus_Fire")) ! option_type[k][j][i] = OPTION_PLUS_FIRE; else if (!strcmp (w, "Plus_Special")) ! option_type[k][j][i] = OPTION_PLUS_SPECIAL; else if (!strcmp (w, "Launched")) ! option_type[k][j][i] = OPTION_LAUNCHED; else if (!strcmp (w, "Hold")) ! option_type[k][j][i] = OPTION_HOLD; else if (!strcmp (w, "No_Proximity")) ! option_type[k][j][i] = OPTION_NO_PROXIMITY; else if (!strcmp (w, "Next_State")) ! option_type[k][j][i] = OPTION_NEXT_STATE; else if (!strcmp (w, "Reset_State")) ! option_type[k][j][i] = OPTION_RESET_STATE; else if (!strcmp (w, "Always_When_Full")) ! option_type[k][j][i] = OPTION_ALWAYS_WHEN_FULL; else if (!strcmp (w, "Mine")) ! option_type[k][j][i] = OPTION_MINE; else if (!strcmp (w, "None")) ! option_type[k][j][i] = OPTION_NONE; s = get_config_string (states, "Tactic", ""); --- 1043,1105 ---- else strcpy (sstr, "Special"); + if (i != 0) sprintf (sstr + strlen (sstr), "%d", i + 1); + w = get_config_string (states, sstr, ""); ! ! ! ! if (!strcmp (w, "No_Front")) ! option_type[k][j][OPTION_NO_FRONT] = true; else if (!strcmp (w, "Front")) ! option_type[k][j][OPTION_FRONT] = true; else if (!strcmp (w, "Sides")) ! option_type[k][j][OPTION_SIDES] = true; else if (!strcmp (w, "Field")) ! option_type[k][j][OPTION_FEILD] = true; else if (!strcmp (w, "Narrow")) ! option_type[k][j][OPTION_NARROW] = true; else if (!strcmp (w, "Homing")) ! option_type[k][j][OPTION_HOMING] = true; else if (!strcmp (w, "No_range")) ! option_type[k][j][OPTION_NO_RANGE] = true; else if (!strcmp (w, "Back")) ! option_type[k][j][OPTION_BACK] = true; else if (!strcmp (w, "Precedence")) ! option_type[k][j][OPTION_PRECEDENCE] = true; else if (!strcmp (w, "Defense")) ! option_type[k][j][OPTION_DEFENSE] = true; else if (!strcmp (w, "Battery")) ! option_type[k][j][OPTION_BATTERY] = true; else if (!strcmp (w, "Max_Battery")) ! option_type[k][j][OPTION_MAX_BATT] = true; else if (!strcmp (w, "Reserve_Battery")) ! option_type[k][j][OPTION_RESERVE_BATT] = true; else if (!strcmp (w, "Cloak")) ! option_type[k][j][OPTION_CLOAK] = true; else if (!strcmp (w, "Proximity")) ! option_type[k][j][OPTION_PROXIMITY] = true; else if (!strcmp (w, "Plus_Fire")) ! option_type[k][j][OPTION_PLUS_FIRE] = true; else if (!strcmp (w, "Plus_Special")) ! option_type[k][j][OPTION_PLUS_SPECIAL] = true; else if (!strcmp (w, "Launched")) ! option_type[k][j][OPTION_LAUNCHED] = true; else if (!strcmp (w, "Hold")) ! option_type[k][j][OPTION_HOLD] = true; else if (!strcmp (w, "No_Proximity")) ! option_type[k][j][OPTION_NO_PROXIMITY] = true; else if (!strcmp (w, "Next_State")) ! option_type[k][j][OPTION_NEXT_STATE] = true; else if (!strcmp (w, "Reset_State")) ! option_type[k][j][OPTION_RESET_STATE] = true; else if (!strcmp (w, "Always_When_Full")) ! option_type[k][j][OPTION_ALWAYS_WHEN_FULL] = true; else if (!strcmp (w, "Mine")) ! option_type[k][j][OPTION_MINE] = true; else if (!strcmp (w, "None")) ! option_type[k][j][OPTION_NONE] = true; s = get_config_string (states, "Tactic", ""); *************** *** 1055,1058 **** --- 1123,1138 ---- get_config_int (states, "BattRecharge", 0); } + + // in case nothing was defined, then default behaviour should be activated: + bool some_option = false; + for ( i = 0; i < OPTION_LAST; ++i ) + { + if (option_type[k][j][i]) + some_option = true; + } + if (!some_option) + { + option_type[k][j][OPTION_UNKNOWN] = true; + } } *************** *** 1123,1127 **** // lower means, more cowardly ! intercept_abort_speed_factor = 0.25 + random(0.1); // scareness: when an attack is aborted.. --- 1203,1207 ---- // lower means, more cowardly ! intercept_abort_speed_factor = 0.3 + random(0.2); // scareness: when an attack is aborted.. *************** *** 1132,1136 **** // out of range (shoot or not, the further you are, the smaller the chance). ! out_of_range_multiplier = 0.5 + random(0.5); --- 1212,1216 ---- // out of range (shoot or not, the further you are, the smaller the chance). ! out_of_range_multiplier = 0.1 + random(0.1); // smaller means, less range |
From: Rob <geo...@us...> - 2005-08-10 21:06:41
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23058/source/ais Modified Files: c_input.cpp Log Message: cyborg control update Index: c_input.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_input.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** c_input.cpp 8 Aug 2005 20:01:54 -0000 1.19 --- c_input.cpp 10 Aug 2005 21:06:32 -0000 1.20 *************** *** 229,234 **** --- 229,236 ---- if (cyborg && cyborg->ship) { + tw_random_push_state(); select_ship(cyborg->ship, cyborg->ship->data->file); cyborg->select_ship(0, 0); + tw_random_pop_state(); } } |
From: Rob <geo...@us...> - 2005-08-10 21:06:40
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23058/source Modified Files: ais.h Log Message: cyborg control update Index: ais.h =================================================================== RCS file: /cvsroot/timewarp/source/ais.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ais.h 8 Aug 2005 14:33:50 -0000 1.12 --- ais.h 10 Aug 2005 21:06:32 -0000 1.13 *************** *** 8,12 **** #define MAX_STATES 3 ! #define MAX_OPTION 4 --- 8,13 ---- #define MAX_STATES 3 ! ! const int MAX_OPTIONS = 1024; *************** *** 82,86 **** double option_velocity[MAX_STATES][2]; int last_seen_time; ! int option_type[MAX_STATES][2][MAX_OPTION]; int fireoption[2]; int dontfireoption[2]; --- 83,89 ---- double option_velocity[MAX_STATES][2]; int last_seen_time; ! ! bool option_type[MAX_STATES][2][MAX_OPTIONS]; ! int fireoption[2]; int dontfireoption[2]; |
From: Rob <geo...@us...> - 2005-08-10 21:06:02
|
Update of /cvsroot/timewarp/ships/sc1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22926/ships/sc1 Modified Files: shpilwav.ini shpspael.ini Log Message: ai correction Index: shpspael.ini =================================================================== RCS file: /cvsroot/timewarp/ships/sc1/shpspael.ini,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** shpspael.ini 21 Oct 2003 21:50:38 -0000 1.4 --- shpspael.ini 10 Aug 2005 21:05:52 -0000 1.5 *************** *** 40,46 **** [AI3_Default] ! Special = Proximity ! Special2 = Back ! Special3 = Homing [Names] --- 40,46 ---- [AI3_Default] ! Weapon = Narrow ! Special = Back ! Special2 = Homing [Names] Index: shpilwav.ini =================================================================== RCS file: /cvsroot/timewarp/ships/sc1/shpilwav.ini,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shpilwav.ini 8 Jun 2003 17:55:34 -0000 1.3 --- shpilwav.ini 10 Aug 2005 21:05:52 -0000 1.4 *************** *** 35,40 **** --- 35,43 ---- Weapon = Precedence Weapon_Range = 4 + Weapon_Vecolity = 999 + WeaponRel = 1.0 Special = Cloak + [Names] NumNames = 16 |
From: Rob <geo...@us...> - 2005-08-10 04:10:39
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30327/source/ais Modified Files: c_input.cpp Log Message: further cyborg-control update Index: c_input.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_input.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** c_input.cpp 8 Aug 2005 19:08:09 -0000 1.18 --- c_input.cpp 8 Aug 2005 20:01:54 -0000 1.19 *************** *** 169,172 **** --- 169,177 ---- int r = 0; + if (ship && ship->target && !ship->target->exists ()) + { + ship->target = 0; + } + // if you want a computer AI to do the work for you ;) if (cyborg_control) *************** *** 188,192 **** // needs to check pointers, through the game interface ! // physics->add(cyborg); } --- 193,197 ---- // needs to check pointers, through the game interface ! // physics->add(cyborg); //better, exclude this... } *************** *** 216,224 **** r = cyborg->think(); - if (cyborg->ship) - { - message.print(1500, 15, "cyborg key = %i ship = %s", r, cyborg->ship->type->name); - } - tw_random_pop_state(); --- 221,224 ---- |
From: Rob <geo...@us...> - 2005-08-10 04:09:37
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19034/source/ais Modified Files: c_input.cpp Log Message: update for the cyborg-control override Index: c_input.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_input.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** c_input.cpp 8 Aug 2005 14:33:50 -0000 1.17 --- c_input.cpp 8 Aug 2005 19:08:09 -0000 1.18 *************** *** 178,189 **** tw_random_push_state(); if (!cyborg) { // load and initialize the cyborg AI cyborg = getController("WussieBot", "cyborg-human-interface", channel_none); cyborg->load("scp.ini", "Config0"); // needs to check pointers, through the game interface ! physics->add(cyborg); } --- 178,192 ---- tw_random_push_state(); + if (!cyborg) { // load and initialize the cyborg AI cyborg = getController("WussieBot", "cyborg-human-interface", channel_none); + cyborg->auto_update = false; // networked players need think() to be called externally, so that it's synched... + cyborg->load("scp.ini", "Config0"); // needs to check pointers, through the game interface ! // physics->add(cyborg); } *************** *** 200,210 **** set_config_file(ship->type->file); ! cyborg->select_ship(ship, shipname); pop_config_state(); //select_ship(0, 0); } - if (cyborg->ship && !ship) - select_ship(cyborg->ship, cyborg->ship->data->file); // determine the key sequence. --- 203,214 ---- set_config_file(ship->type->file); ! // this assigns the AI to that ship, but the ship->control should still points to the human AI... ! // so that needs to be corrected, then ! cyborg->select_ship(ship, "cyborg-human-interface"); ! ship->control = this; // restore the proper "control" hierarchy pop_config_state(); //select_ship(0, 0); } // determine the key sequence. *************** *** 212,217 **** --- 216,227 ---- r = cyborg->think(); + if (cyborg->ship) + { + message.print(1500, 15, "cyborg key = %i ship = %s", r, cyborg->ship->type->name); + } + tw_random_pop_state(); + return r; } else { |
From: Rob <geo...@us...> - 2005-08-10 04:02:11
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19034/source/melee Modified Files: mcontrol.cpp mframe.cpp mgame.cpp mmain.cpp mship.h mshot.cpp Log Message: update for the cyborg-control override Index: mshot.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshot.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** mshot.cpp 1 Aug 2005 10:46:33 -0000 1.18 --- mshot.cpp 8 Aug 2005 19:08:28 -0000 1.19 *************** *** 198,207 **** { target = otarget; id = SPACE_HOMING_MISSILE; } ! void HomingMissile::calculate() { Missile::calculate(); ! if (target && !target->isInvisible()) { double d_a = normalize(trajectory_angle(target) - (angle + turn_step), PI2); if (d_a > PI) d_a -= PI2; --- 198,214 ---- { target = otarget; + + if (target && !target->exists()) + target = 0; + id = SPACE_HOMING_MISSILE; } ! void HomingMissile::calculate() ! { Missile::calculate(); ! ! if (target && !target->isInvisible()) ! { double d_a = normalize(trajectory_angle(target) - (angle + turn_step), PI2); if (d_a > PI) d_a -= PI2; Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** mgame.cpp 6 Aug 2005 23:29:46 -0000 1.51 --- mgame.cpp 8 Aug 2005 19:08:23 -0000 1.52 *************** *** 1085,1089 **** if (p > 0) { ! if (player[p]->crc != player[p-1]->crc) { tw_error("The game is desynched."); --- 1085,1089 ---- if (p > 0) { ! if (player[p] && player[p-1] && player[p]->crc != player[p-1]->crc) { tw_error("The game is desynched."); *************** *** 1152,1156 **** // distribute the lag evenly between sender and receiver: ! maxlag /= 2; share(-1, &maxlag); --- 1152,1157 ---- // distribute the lag evenly between sender and receiver: ! // uhm... no, because actually, this is the one-way lag: because the local player has zero-lag. ! //maxlag /= 2; so, disable this here. share(-1, &maxlag); *************** *** 1162,1166 **** // we need to set lag ... the worst there is, perhaps ? ! lag_buffer = maxlag / frame_time; if (lag_buffer <= 1) --- 1163,1168 ---- // we need to set lag ... the worst there is, perhaps ? ! lag_buffer = (maxlag / frame_time) + 1; ! // +1, because it is (usually) rounded down, while we would like a small margin of error. if (lag_buffer <= 1) *************** *** 1320,1323 **** --- 1322,1329 ---- static int base_delay = 0; // for debug (lag-test) purpose only + // toggle control + static bool toggle_key_inc_lag = true; + static bool toggle_key_dec_lag = true; + void Game::play() { *************** *** 1499,1505 **** - // this can also do some game stuff ... (namely, Esc = quit) - while (keypressed()) - handle_key(readkey()); // check if the network is in synch? --- 1505,1508 ---- *************** *** 1525,1528 **** --- 1528,1572 ---- // it's best to do this only in debug mode... + + // handle some important buttons... + // must be done before the keys are re-set to 0 by the share_key + if (player[p_local]) + { + + if ( (player[p_local]->control->keys & keyflag::inc_lag) != 0) + { + + if (toggle_key_inc_lag) + { + CALL(event_lag_increase, p_local); + message.print(500, 12, "lag increase pressed"); + toggle_key_inc_lag = false; + } else { + //message.print(500, 7, "lag increase held"); + } + + } else { + toggle_key_inc_lag = true; + //message.print(500, 15, "lag increase released"); + } + + if ( (player[p_local]->control->keys & keyflag::dec_lag) != 0) + { + + if (toggle_key_dec_lag && lag_buffer > 1) + { + CALL(event_lag_decrease, p_local); + message.print(500, 12, "lag decrease pressed"); + toggle_key_dec_lag = false; + } + } else { + toggle_key_dec_lag = true; + } + } + + // this can also do some game stuff ... (namely, Esc = quit) + while (keypressed()) + handle_key(readkey()); + // actually ... duh ... it's best to call this AFTER the events-handle, cause then the data // have some time to be sent across the network, while the game is doing its calculations. *************** *** 1539,1542 **** --- 1583,1589 ---- + + + // approve of the next iteration, after ALL possible event thingies are done. if (lag_decrease == 0) *************** *** 2184,2188 **** } ! bool Game::handle_key(int k) {STACKTRACE switch (k >> 8) { #if !defined _DEBUG --- 2231,2238 ---- } ! bool Game::handle_key(int k) ! { ! STACKTRACE; ! switch (k >> 8) { #if !defined _DEBUG *************** *** 2218,2235 **** break; - case KEY_CLOSEBRACE: - { - CALL(event_lag_increase, p_local); - } - break; - - case KEY_OPENBRACE: - { - if (lag_buffer > 1) - { - CALL(event_lag_decrease, p_local); - } - } - break; case KEY_F1: {// help --- 2268,2271 ---- *************** *** 2246,2249 **** --- 2282,2317 ---- } break; + case KEY_F4: {// toggle cruise-control on/off + extern bool cruise_control; + cruise_control = !cruise_control; + + if (cruise_control) + { + message.print(1500, 12, "cruise control enabled"); + } else { + message.print(1500, 12, "cruise control disabled"); + } + return true; + } + break; + + case KEY_F9: {// toggle cyborg control on/off for the local player. + if (player[p_local] && player[p_local]->control) + { + Control *c = player[p_local]->control; + + c->cyborg_control = !c->cyborg_control; + + if (c->cyborg_control) + { + message.print(1500, 12, "cyborg control enabled"); + } else { + message.print(1500, 12, "cyborg control disabled"); + } + } + return true; + } + break; + case KEY_F6: {// send message chat_len = 0; Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** mcontrol.cpp 8 Aug 2005 14:33:51 -0000 1.25 --- mcontrol.cpp 8 Aug 2005 19:08:18 -0000 1.26 *************** *** 335,339 **** STACKTRACE; ! if (!exists()) return; if (auto_update) --- 335,340 ---- STACKTRACE; ! if (!exists()) ! return; if (auto_update) Index: mship.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** mship.h 11 Jul 2005 00:25:28 -0000 1.22 --- mship.h 8 Aug 2005 19:08:28 -0000 1.23 *************** *** 22,27 **** extra2 = (1<<11), communicate = (1<<12), ! extra4 = (1<<13), ! extra5 = (1<<14), suicide = (1<<15), }; --- 22,27 ---- extra2 = (1<<11), communicate = (1<<12), ! dec_lag = (1<<13), ! inc_lag = (1<<14), suicide = (1<<15), }; Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** mframe.cpp 4 Aug 2005 15:03:47 -0000 1.36 --- mframe.cpp 8 Aug 2005 19:08:20 -0000 1.37 *************** *** 486,494 **** } ! void SpaceLocation::ship_died() {STACKTRACE ! ship = NULL; } ! void SpaceLocation::target_died() { ! target = NULL; } --- 486,496 ---- } ! void SpaceLocation::ship_died() ! { ! ship = 0; } ! void SpaceLocation::target_died() ! { ! target = 0; } Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** mmain.cpp 16 Jul 2005 23:48:30 -0000 1.40 --- mmain.cpp 8 Aug 2005 19:08:28 -0000 1.41 *************** *** 643,655 **** } break; ! /* ! case KEY_F9: { ! if (glog->type != Log::log_normal) return false; ! message.out("MUHAHAHAHAHA!!!!", 5000, 12); ! add(new Planet(random(size), meleedata.planetSprite, random(meleedata.planetSprite->frames()))); ! return true; ! } ! break; ! */ //don't use hardwired normal keys case KEY_H: --- 643,647 ---- } break; ! //don't use hardwired normal keys case KEY_H: *************** *** 1356,1359 **** --- 1348,1352 ---- you use these routines. */ + int test_number = 100000; void log_test(char *comment) { *************** *** 1361,1365 **** // synch the 2 games, which should assure that all data are read/written in the meantime int k, m; ! k = random(); m = k; --- 1354,1359 ---- // synch the 2 games, which should assure that all data are read/written in the meantime int k, m; ! k = test_number; ! ++test_number; m = k; |
From: Rob <geo...@us...> - 2005-08-10 04:00:20
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6578 Modified Files: ingame.txt Log Message: updated description (cruise control/ cyborg) Index: ingame.txt =================================================================== RCS file: /cvsroot/timewarp/ingame.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ingame.txt 11 Jul 2005 00:25:01 -0000 1.6 --- ingame.txt 8 Aug 2005 20:31:58 -0000 1.7 *************** *** 6,15 **** F2 brings up the options menu F3 switches camera focus ! F4 is fast-forward (speeds up in-game time greatly) F5 displays fleet status F6 is chat (for network games) F7 changes game tic rate (physics quality) F8 changes camera mode ! F9 creates planets (silly "feature") F10 quits (so does ESCAPE) F11 saves screenshots --- 6,15 ---- F2 brings up the options menu F3 switches camera focus ! F4 toggles cruise control mode F5 displays fleet status F6 is chat (for network games) F7 changes game tic rate (physics quality) F8 changes camera mode ! F9 toggles cyborg mode F10 quits (so does ESCAPE) F11 saves screenshots |
From: Rob <geo...@us...> - 2005-08-08 14:36:52
|
Update of /cvsroot/timewarp/source/sc1ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26517/source/sc1ships Modified Files: shpkzedr.cpp Log Message: cosmetic change Index: shpkzedr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpkzedr.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpkzedr.cpp 4 Aug 2005 15:03:58 -0000 1.12 --- shpkzedr.cpp 8 Aug 2005 14:36:43 -0000 1.13 *************** *** 119,125 **** } ! void KzerZaFighter::calculate() { Missile::calculate(); if (!(ship && ship->exists())) { --- 119,129 ---- } ! void KzerZaFighter::calculate() ! { Missile::calculate(); + if (!exists()) + return; + if (!(ship && ship->exists())) { *************** *** 179,183 **** ! int KzerZaFighter::handle_damage(SpaceLocation *source, double normal, double direct){ if (source->isPlanet()) { state = 1; --- 183,188 ---- ! int KzerZaFighter::handle_damage(SpaceLocation *source, double normal, double direct) ! { if (source->isPlanet()) { state = 1; |
From: Rob <geo...@us...> - 2005-08-08 14:36:11
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26360/source/melee Modified Files: mshppan.cpp Log Message: captain panel steering left/right will only show the last of these two actions Index: mshppan.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshppan.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mshppan.cpp 24 Mar 2004 23:51:39 -0000 1.19 --- mshppan.cpp 8 Aug 2005 14:36:03 -0000 1.20 *************** *** 43,46 **** --- 43,47 ---- old_fire_weapon = FALSE; old_fire_special = FALSE; + last_turn_type = 0; deathframe = 0; *************** *** 158,161 **** --- 159,169 ---- if (captain_needs_update) { captain_needs_update = false; + + // ensure that only 1 of the steering pictures will be shown... + if (!old_turn_left && ship->turn_left) + last_turn_type = 1; + if (!old_turn_right && ship->turn_right) + last_turn_type = 2; + old_thrust = ship->thrust; old_turn_left = ship->turn_left; *************** *** 165,173 **** ship->spritePanel->draw(0, 0, 1, captain); ! if(ship->thrust) ship->spritePanel->overlay(1, 2, captain); ! if(ship->turn_right) ship->spritePanel->overlay(1, 3, captain); ! if(ship->turn_left) ship->spritePanel->overlay(1, 4, captain); ! if(ship->fire_weapon) ship->spritePanel->overlay(1, 5, captain); ! if(ship->fire_special) ship->spritePanel->overlay(1, 6, captain); blit (captain, panel, 0, 0, CAPTAIN_X, CAPTAIN_Y, captain->w, captain->h); panel_needs_update = true; --- 173,191 ---- ship->spritePanel->draw(0, 0, 1, captain); ! if(ship->thrust) ! ship->spritePanel->overlay(1, 2, captain); ! ! if(ship->turn_right && (last_turn_type == 2)) ! ship->spritePanel->overlay(1, 3, captain); ! ! if(ship->turn_left && (last_turn_type == 1)) ! ship->spritePanel->overlay(1, 4, captain); ! ! if(ship->fire_weapon) ! ship->spritePanel->overlay(1, 5, captain); ! ! if(ship->fire_special) ! ship->spritePanel->overlay(1, 6, captain); ! blit (captain, panel, 0, 0, CAPTAIN_X, CAPTAIN_Y, captain->w, captain->h); panel_needs_update = true; |
From: Rob <geo...@us...> - 2005-08-08 14:35:14
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26211/source/util Modified Files: random.cpp random.h Log Message: change in the random algorithm Index: random.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/random.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** random.cpp 11 Jul 2005 00:26:16 -0000 1.8 --- random.cpp 8 Aug 2005 14:35:05 -0000 1.9 *************** *** 42,45 **** --- 42,47 ---- return _rng_dist_32_flat(max, raw32()); } + + Uint32 RNG_lcg64a::raw32() { *************** *** 82,85 **** --- 84,88 ---- return s64.s.high; + } Uint64 RNG_lcg64a::raw64() { *************** *** 105,112 **** } ! void RNG_lcg64a::seed( int s ) { s64.s.low = s; s64.s.high = 0; ! return; } void RNG_lcg64a::seed_more( int s ) { --- 108,116 ---- } ! void RNG_lcg64a::seed( int s ) ! { s64.s.low = s; s64.s.high = 0; ! } void RNG_lcg64a::seed_more( int s ) { *************** *** 118,119 **** --- 122,273 ---- + + + + + static unsigned int tw_random_value; + static const int N = 32; + static unsigned int ran_temp[N]; + + + static unsigned int tw_random_value_pushed; + static unsigned int ran_temp_pushed[N]; + + void tw_random_push_state() + { + tw_random_value_pushed = tw_random_value; + + int k; + for ( k = 0; k < N; ++k ) + { + ran_temp_pushed[k] = ran_temp[k]; + } + } + + void tw_random_pop_state() + { + tw_random_value = tw_random_value_pushed; + + int k; + for ( k = 0; k < N; ++k ) + { + ran_temp[k] = ran_temp_pushed[k]; + } + } + + unsigned int tw_random() + { + // some other thingy... + int i; + int carrybit = 0; + for ( i = 0; i < N; ++i ) + { + unsigned int bit1 = tw_random_value & 0x080000000; + unsigned int bit2 = ran_temp[i] & 0x080000000; + if (bit1 && bit2) + ++ carrybit; // preserve the bit; otherwise you may lose information in the lower bit(s) + + tw_random_value += ran_temp[i]; + ran_temp[i] = tw_random_value;// << 1) | (s64.s.high & 1); + } + tw_random_value += carrybit; + + return tw_random_value; + } + + #ifdef _DEBUG + #include "../melee/mview.h" + void test_random() + { + double count[N][4]; + + // a test of the random procedure: + const int Ntest = 1000000; + int i, k; + + for ( k = 0; k < N; ++k ) + { + count[k][0] = 0; + count[k][1] = 0; + count[k][2] = 0; + count[k][3] = 0; + } + + int last_ran = 0; + int new_ran = 0; + for ( i = 0; i < Ntest; ++i ) + { + last_ran = new_ran; + new_ran = tw_random(); + + for ( k = 0; k < N; ++k ) + { + int bit1, bit2; + bit1 = (last_ran >> k) & 1; + bit2 = (new_ran >> k) & 1; + + int b = bit1 + (bit2<<1); + count[k][b] += 1; + + // change observed in bit k: + // i=0: 0 -> 0 + // i=1: 1 -> 0 + // i=2: 0 -> 1 + // i=3: 1 -> 1 + } + + } + + // display results + for ( k = 0; k < N; ++k ) + { + message.print(100, 15, "%2i %4.2lf %4.2lf %4.2lf %4.2lf", + k, count[k][0]/Ntest, count[k][1]/Ntest, count[k][2]/Ntest, count[k][3]/Ntest); + } + message.print(100, 14, "press a key"); + message.animate(0); + readkey(); + + } + #endif + + #include "../melee/mlog.h" + void seed_ohmy() + { + tw_random_value = rand(); + share(-1, &tw_random_value); + + int i; + for ( i = 1; i < N; ++i ) + { + ran_temp[i] = rand(); + share(-1, &ran_temp[i]); + } + share_update(); + + // only for debugging purpose. + //test_random(); + + return; + } + + + double tw_random(double a) + { + double val; + //* ((int*) &val + 0) = tw_random(); + //* ((int*) &val + sizeof(int)) = tw_random(); + val = a * (double(tw_random()) / double(0x0100000000)); + + return val; + } + + double tw_random(double min, double max) + { + return min + tw_random(max - min); + } + + unsigned int tw_random( int a ) + { + return tw_random() % a; + } Index: random.h =================================================================== RCS file: /cvsroot/timewarp/source/util/random.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** random.h 24 Mar 2004 23:51:45 -0000 1.6 --- random.h 8 Aug 2005 14:35:05 -0000 1.7 *************** *** 55,58 **** --- 55,59 ---- extern RNG rng; + /* inline double tw_random(double a) {return rng.randf(a);} *************** *** 65,68 **** --- 66,80 ---- inline int tw_random() {return rng.raw32()&0x7fffffff;} + */ + + + void seed_ohmy(); + double tw_random(double a); + double tw_random(double min, double max); + unsigned int tw_random( int a ); + unsigned int tw_random(); + + void tw_random_push_state(); + void tw_random_pop_state(); |
From: Rob <geo...@us...> - 2005-08-08 14:35:14
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26211/source/melee Modified Files: mlog.cpp mlog.h Log Message: change in the random algorithm Index: mlog.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mlog.cpp 11 Jul 2005 00:25:28 -0000 1.19 --- mlog.cpp 8 Aug 2005 14:35:05 -0000 1.20 *************** *** 618,621 **** --- 618,627 ---- + void share(int player, unsigned int *value, int num) + { + share_buffer(player, value, num, sizeof(unsigned int), TYPE_INT); + } + + void share(int player, short *value, int num) { *************** *** 815,829 **** { ! int i1, i2; ! i1 = rand(); ! i2 = rand(); ! share(-1, &i1); ! share(-1, &i2); ! share_update(); ! rng.seed(i1); ! rng.seed_more(i2); } --- 821,837 ---- { ! //int i1, i2; ! //i1 = rand(); ! //i2 = rand(); ! //share(-1, &i1); ! //share(-1, &i2); ! //share_update(); ! //rng.seed(i1); ! //rng.seed_more(i2); ! ! seed_ohmy(); } Index: mlog.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mlog.h 11 Jul 2005 00:25:28 -0000 1.11 --- mlog.h 8 Aug 2005 14:35:05 -0000 1.12 *************** *** 123,126 **** --- 123,127 ---- */ void share(int netnum, int *value, int num = 1); + void share(int netnum, unsigned int *value, int num = 1); void share(int netnum, short *value, int num = 1); void share(int netnum, char *value, int num = 1); |
From: Rob <geo...@us...> - 2005-08-08 14:34:30
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25918/source/ais Modified Files: c_input.cpp c_wussie.cpp Log Message: ship panel left/right steering, will only show 1 of the two, not both Index: c_input.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_input.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** c_input.cpp 1 Aug 2005 10:46:32 -0000 1.16 --- c_input.cpp 8 Aug 2005 14:33:50 -0000 1.17 *************** *** 24,27 **** --- 24,29 ---- #include "gui.h" + bool cruise_control = false; + #define JOY_DIALOG_BOX 0 *************** *** 125,133 **** extra2 = get_config_int(inisection, "Extra2", 0); communicate = get_config_int(inisection, "Communicate", 0); ! extra4 = get_config_int(inisection, "Extra4", 0); ! extra5 = get_config_int(inisection, "Extra5", 0); suicide = get_config_int(inisection, "Extra6", 0); return; } /*! \brief Save players key \param inifile with players keys --- 127,136 ---- extra2 = get_config_int(inisection, "Extra2", 0); communicate = get_config_int(inisection, "Communicate", 0); ! dec_lag = get_config_int(inisection, "DecLag", 0); ! inc_lag = get_config_int(inisection, "IncLag", 0); suicide = get_config_int(inisection, "Extra6", 0); return; } + /*! \brief Save players key \param inifile with players keys *************** *** 149,154 **** set_config_int(inisection, "Extra2", extra2); set_config_int(inisection, "Communicate", communicate); ! set_config_int(inisection, "Extra4", extra4); ! set_config_int(inisection, "Extra5", extra5); set_config_int(inisection, "Extra6", suicide); return; --- 152,157 ---- set_config_int(inisection, "Extra2", extra2); set_config_int(inisection, "Communicate", communicate); ! set_config_int(inisection, "DecLag", dec_lag); ! set_config_int(inisection, "IncLag", inc_lag); set_config_int(inisection, "Extra6", suicide); return; *************** *** 160,171 **** } /*! \brief Process get input from player */ ! int ControlHuman::think() { int r = 0; ! if (key_pressed(thrust)) r |= keyflag::thrust; if (key_pressed(back)) r |= keyflag::back; ! if (key_pressed(left)) r |= keyflag::left; if (key_pressed(right)) r |= keyflag::right; if (key_pressed(fire)) r |= keyflag::fire; --- 163,260 ---- } + #include "../melee/mview.h" /*! \brief Process get input from player */ ! int ControlHuman::think() ! { int r = 0; ! ! // if you want a computer AI to do the work for you ;) ! if (cyborg_control) ! { ! // BUT you have to be careful to preserve the (synchronized) randomness, because this is a local ! // operation and not synched between computers. ! // you must also be careful at the moment of loading, because "random" is used there, too, to ! // initialize some settings. ! tw_random_push_state(); ! ! if (!cyborg) ! { ! // load and initialize the cyborg AI ! cyborg = getController("WussieBot", "cyborg-human-interface", channel_none); ! cyborg->load("scp.ini", "Config0"); ! ! // needs to check pointers, through the game interface ! physics->add(cyborg); ! ! } ! ! // synchronize the AIs ! if (ship && !cyborg->ship) ! { ! char shipname[6]; ! int n = strlen(ship->type->file); ! strncpy(shipname, &ship->type->file[n-9], 5); ! shipname[5] = 0; ! ! push_config_state(); ! set_config_file(ship->type->file); ! ! cyborg->select_ship(ship, shipname); ! ! pop_config_state(); ! //select_ship(0, 0); ! } ! if (cyborg->ship && !ship) ! select_ship(cyborg->ship, cyborg->ship->data->file); ! ! // determine the key sequence. ! ! r = cyborg->think(); ! ! tw_random_pop_state(); ! ! return r; ! } else { ! // switch the ship control back to this human control... ! if (cyborg && cyborg->ship) ! { ! select_ship(cyborg->ship, cyborg->ship->data->file); ! cyborg->select_ship(0, 0); ! } ! } ! ! // manual thrust or cruise change ! if (key_pressed(thrust)) ! { ! if (!cruise_control) ! { ! // direct control ! r |= keyflag::thrust; ! } else { ! // toggle thrust on/off. ! if (toggle_cruise_thrust_press) ! { ! cruise_control_thrust = !cruise_control_thrust; ! toggle_cruise_thrust_press = false; ! } ! } ! } else { ! toggle_cruise_thrust_press = true; ! } ! ! // automatic thrust ! if (cruise_control_thrust) ! { ! r |= keyflag::thrust; ! } ! if (key_pressed(back)) r |= keyflag::back; ! ! if (key_pressed(left)) ! r |= keyflag::left; ! if (key_pressed(right)) r |= keyflag::right; + if (key_pressed(fire)) r |= keyflag::fire; *************** *** 188,193 **** r |= keyflag::extra2; if (key_pressed(communicate)) r |= keyflag::communicate; ! if (key_pressed(extra4)) r |= keyflag::extra4; ! if (key_pressed(extra5)) r |= keyflag::extra5; if (key_pressed(suicide)) r |= keyflag::suicide; return r; --- 277,282 ---- r |= keyflag::extra2; if (key_pressed(communicate)) r |= keyflag::communicate; ! if (key_pressed(dec_lag)) r |= keyflag::dec_lag; ! if (key_pressed(inc_lag)) r |= keyflag::inc_lag; if (key_pressed(suicide)) r |= keyflag::suicide; return r; *************** *** 199,202 **** --- 288,294 ---- { auto_update = false; // networked player need think() to be called externally, so that it's synched... + + toggle_cruise_thrust_press = true; + cruise_control_thrust = false; } *************** *** 286,294 **** key_to_description ( communicate, s ); s = dialog_string[index]; index += 1; ! s += sprintf ( s, "Extra4: "); ! key_to_description ( extra4, s ); s = dialog_string[index]; index += 1; ! s += sprintf ( s, "Extra5: "); ! key_to_description ( extra5, s ); s = dialog_string[index]; index += 1; s += sprintf ( s, "Suicide: "); --- 378,386 ---- key_to_description ( communicate, s ); s = dialog_string[index]; index += 1; ! s += sprintf ( s, "Decrease Lag: "); ! key_to_description ( dec_lag, s ); s = dialog_string[index]; index += 1; ! s += sprintf ( s, "Increase Lag: "); ! key_to_description ( inc_lag, s ); s = dialog_string[index]; index += 1; s += sprintf ( s, "Suicide: "); *************** *** 330,335 **** case 12: extra2 = t; break; case 13: communicate = t; break; ! case 14: extra4 = t; break; ! case 15: extra5 = t; break; case 16: suicide = t; break; case KEY_DIALOG_OK: save("scp.ini", getDescription()); return; --- 422,427 ---- case 12: extra2 = t; break; case 13: communicate = t; break; ! case 14: dec_lag = t; break; ! case 15: inc_lag = t; break; case 16: suicide = t; break; case KEY_DIALOG_OK: save("scp.ini", getDescription()); return; Index: c_wussie.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_wussie.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** c_wussie.cpp 6 Aug 2005 23:27:48 -0000 1.21 --- c_wussie.cpp 8 Aug 2005 14:33:50 -0000 1.22 *************** *** 959,968 **** STACKTRACE;; ! char tmp[20]; int i, j, k; Control::select_ship (ship_pointer, ship_name); if (ship_name) { ! replace_extension (tmp, ship_name, "ini", 19); char states[20], sstr[20]; const char *w, *s; --- 959,968 ---- STACKTRACE;; ! //char tmp[20]; int i, j, k; Control::select_ship (ship_pointer, ship_name); if (ship_name) { ! //replace_extension (tmp, ship_name, "ini", 19); char states[20], sstr[20]; const char *w, *s; |
From: Rob <geo...@us...> - 2005-08-08 14:34:30
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25918/source Modified Files: ais.h Log Message: ship panel left/right steering, will only show 1 of the two, not both Index: ais.h =================================================================== RCS file: /cvsroot/timewarp/source/ais.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ais.h 4 Aug 2005 02:08:29 -0000 1.11 --- ais.h 8 Aug 2005 14:33:50 -0000 1.12 *************** *** 10,18 **** #define MAX_OPTION 4 //ais/c_input.cpp /*! \brief Human Ship Control */ ! class ControlHuman : public Control { private: int thrust; int left; int right; --- 10,24 ---- #define MAX_OPTION 4 + //ais/c_input.cpp /*! \brief Human Ship Control */ ! class ControlHuman : public Control ! { private: + bool toggle_cruise_thrust_press; + int thrust; + bool cruise_control_thrust; + int left; int right; *************** *** 24,28 **** int prev; int closest; ! int extra1, extra2, communicate, extra4, extra5; int suicide; public: --- 30,34 ---- int prev; int closest; ! int extra1, extra2, communicate, dec_lag, inc_lag; int suicide; public: |
From: Rob <geo...@us...> - 2005-08-08 14:34:06
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25918/source/melee Modified Files: mcontrol.cpp mcontrol.h mshppan.h Log Message: ship panel left/right steering, will only show 1 of the two, not both Index: mcontrol.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mcontrol.h 11 Jul 2005 00:25:28 -0000 1.12 --- mcontrol.h 8 Aug 2005 14:33:57 -0000 1.13 *************** *** 15,18 **** --- 15,20 ---- { public: + bool cyborg_control; + Control *cyborg; /*! \brief controls CANNOT arbitrarily be killed off, because the deal with networking directly */ Index: mcontrol.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mcontrol.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mcontrol.cpp 11 Jul 2005 00:25:13 -0000 1.24 --- mcontrol.cpp 8 Aug 2005 14:33:51 -0000 1.25 *************** *** 451,454 **** --- 451,457 ---- auto_update = true; // for bots. + + cyborg = 0; + cyborg_control = false; } Index: mshppan.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mshppan.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mshppan.h 24 Mar 2004 23:51:39 -0000 1.10 --- mshppan.h 8 Aug 2005 14:33:57 -0000 1.11 *************** *** 35,38 **** --- 35,39 ---- char old_fire_weapon; char old_fire_special; + char last_turn_type; int deathframe; |
From: Rob <geo...@us...> - 2005-08-06 23:31:10
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19048/source/melee Modified Files: manim.cpp Log Message: uhm, unknown change... just some formatting if I remember, while I was glancing over the code. Index: manim.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/manim.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** manim.cpp 1 Aug 2005 10:46:33 -0000 1.12 --- manim.cpp 6 Aug 2005 23:31:00 -0000 1.13 *************** *** 51,64 **** frame_step -= frame_time; ! while (frame_step < 0) { frame_step += frame_size; sprite_index += 1; ! if (sprite_index == sprite->frames()) sprite_index = 0; frame_count -= 1; - if (!frame_count) state = 0; - } - SpaceObject::calculate(); } void Animation::animate(Frame *space) {STACKTRACE --- 51,70 ---- frame_step -= frame_time; ! ! while (frame_step < 0) ! { frame_step += frame_size; sprite_index += 1; ! if (sprite_index == sprite->frames()) ! sprite_index = 0; ! frame_count -= 1; + if (!frame_count) + state = 0; } + + SpaceObject::calculate(); + } void Animation::animate(Frame *space) {STACKTRACE *************** *** 98,111 **** } ! void FixedAnimation::calculate() {STACKTRACE ! if (follow->exists()) { pos = follow->normal_pos(); Animation::calculate(); ! } ! else { state = 0; follow = NULL; - } } PositionedAnimation::PositionedAnimation(SpaceLocation *creator, --- 104,122 ---- } ! void FixedAnimation::calculate() ! { ! STACKTRACE; ! ! if (follow->exists()) ! { pos = follow->normal_pos(); Animation::calculate(); ! } ! else ! { state = 0; follow = NULL; } + } PositionedAnimation::PositionedAnimation(SpaceLocation *creator, |
From: Rob <geo...@us...> - 2005-08-06 23:30:04
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18807/source/melee Modified Files: mgame.cpp mgame.h mnet1.cpp mnet1.h Log Message: network debug code added (to simulate mucho lag on lan) ; also, fixed a bug which caused the event-handler loop to "stop" for new information. Index: mnet1.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mnet1.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mnet1.h 11 Jul 2005 00:25:28 -0000 1.12 --- mnet1.h 6 Aug 2005 23:29:48 -0000 1.13 *************** *** 49,52 **** --- 49,53 ---- };*/ + extern bool debug_net_block; // debug only: if you press space, it's set to true, then it'll add lag. const int max_connections = 100; Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** mgame.cpp 4 Aug 2005 15:03:49 -0000 1.50 --- mgame.cpp 6 Aug 2005 23:29:46 -0000 1.51 *************** *** 1273,1276 **** --- 1273,1323 ---- } + + + static const int max_time_checks = 20; + static int dt = frame_time; + static int N_time_span[max_time_checks]; + static int last_time = 0; + + void Game::iteration_histogram(int time) + { + + int i = (time - last_time) / dt; + last_time = time; + + if (i < 0) + i = 0; + if (i > max_time_checks-1) + i = max_time_checks-1; + + N_time_span[i] += 1; + } + + void Game::iteration_histogram_init(int time) + { + last_time = time; + + int i; + for ( i = 0; i < max_time_checks; ++i ) + { + N_time_span[i] = 0; + } + + dt = frame_time; + } + + void Game::iteration_histogram_writelog() + { + int i; + for ( i = 0; i < max_time_checks; ++i ) + { + log_debug("delay = %5i to %5ims N = %6i\n", + i * dt, (i+1)* dt, N_time_span[i]); + } + } + + + static int base_delay = 0; // for debug (lag-test) purpose only + void Game::play() { *************** *** 1313,1318 **** int time_start = get_time(); // only for debugging/testing purpose. ! int debug_idle_time_animate = 50 + random(50); --- 1360,1368 ---- int time_start = get_time(); + iteration_histogram_init(time_start); + // only for debugging/testing purpose. ! int debug_idle_time_animate = 50 + rand()%50; ! debug_idle_time_animate = 0; *************** *** 1323,1328 **** unsigned int time; - time = get_time(); - // this is used to time animation and physics poll_input(); --- 1373,1376 ---- *************** *** 1340,1343 **** --- 1388,1409 ---- bool idle_iteration = true; + time = get_time(); + // this is used to time animation and physics + + + #ifdef _DEBUG + // if you press space, this will block a "send" on this machine; thus, you can simulate + // the effect of lag, even on a LAN network. + debug_net_block = false; + if (key[KEY_SPACE] != 0) + { + ++base_delay; + if (base_delay >= 50) + base_delay = 0; + + if (base_delay != 0)//(rand()%50) != 0) + debug_net_block = true; + } + #endif // note, you go to the next calculation either because some required time has *************** *** 1384,1387 **** --- 1450,1455 ---- + iteration_histogram(time); //ok, another iteration; update the histogram! + // check if a player was asked to be removed here.. int i; *************** *** 1412,1415 **** --- 1480,1484 ---- if (game_done) { + iteration_histogram_writelog(); return; } *************** *** 1465,1468 **** --- 1534,1538 ---- // crc checking is now only available, if all the games involved run synchronized, + // this is also a (much simpler) desynch test. if (global_lag_synch) network_crc_check(); *************** *** 1519,1543 **** ! if (t_execute < 0.5*(frame_time / turbo)) { // in this case, you can try to have physics in a linear fashion ! if ((hiccup_margin >= 0) && (num_catchups < max_catchups) && (next_tic_time + hiccup_margin > /* < */ time_current)) { - // trying to execute frames in a linear fashion. - next_tic_time += (frame_time / turbo); ! if (next_tic_time < time_current) { //message.print(1500, 15, "Catching up [%i]", num_catchups); catching_up = true; } else { catching_up = false; } } else { catching_up = false; ! next_tic_time = time_current + (frame_time / turbo); // execute as often as possible. } } else { --- 1589,1624 ---- ! ! int frame_time_length = frame_time / turbo; ! if (t_execute < 0.25*(frame_time / turbo)) { // in this case, you can try to have physics in a linear fashion ! if ((hiccup_margin >= 0) ! && (num_catchups < max_catchups) // prevent too many catchups (that will delay graphics update too much) ! && (next_tic_time + hiccup_margin > /* < */ time_current)) { ! if (next_tic_time + frame_time_length < time_current) { //message.print(1500, 15, "Catching up [%i]", num_catchups); + + // trying to make the "gaps" not too small, otherwise... it may be... + // too... unstable? Cause iterations might follow to quickly, and then + // each player will generate bursts of information (to send across the net) + // The follow may be a little more stable in time... catching_up = true; + next_tic_time += frame_time_length / (num_catchups + 2); } else { catching_up = false; + + // trying to execute frames in a linear fashion. + next_tic_time += frame_time_length; // but if there are >1 catchups, then hurry up!! } } else { catching_up = false; ! next_tic_time = time_current + frame_time_length; // execute as often as possible. } } else { *************** *** 1545,1549 **** // is nigh impossible. catching_up = false; ! next_tic_time = time_current + (frame_time / turbo); // execute as often as possible. } --- 1626,1633 ---- // is nigh impossible. catching_up = false; ! next_tic_time += frame_time_length; ! ! if (next_tic_time < time_current) ! next_tic_time = time_current + frame_time_length; // execute as often as possible. } *************** *** 1576,1580 **** { NetLog *l = (NetLog*) glog; ! // l->recv_noblock(); // receive stuff, if you can [not sure if this is required] // this helps to reduce idle-time, cause it doesn't have to wait till --- 1660,1664 ---- { NetLog *l = (NetLog*) glog; ! //l->recv_noblock(); // receive stuff, if you can [is not needed here ; sending has priority] // this helps to reduce idle-time, cause it doesn't have to wait till *************** *** 1594,1598 **** if (!catching_up || time >= next_render_time - msecs_per_render + msecs_per_render_max) { ! if (interpolate_frames || (time >= next_render_time)) { _STACKTRACE("Game::play - Game rendering") --- 1678,1682 ---- if (!catching_up || time >= next_render_time - msecs_per_render + msecs_per_render_max) { ! if (/*interpolate_frames ||*/ (time >= next_render_time)) { _STACKTRACE("Game::play - Game rendering") *************** *** 1629,1632 **** --- 1713,1717 ---- } + } catch (int i) { *************** *** 2452,2455 **** --- 2537,2546 ---- event_player_current = p; // can also be useful. + if (log_empty()) // only try to read the buffer, if there are data in the buffer... + continue; + // that will avoid getting caught inside this loop, while data are only being read outside + // of this loop. + // note that it uses channel_current. + log_resetmode(); // go to default mode. *************** *** 2459,2463 **** // executes a call to the function in the list, with that id-number int req; ! log_int(req); // player index is not stored: it's assumed that each player has its own channel issue(req, p); --- 2550,2554 ---- // executes a call to the function in the list, with that id-number int req; ! log_int(req); //xxx it stopped here, requiring a read... because of the loop ? // player index is not stored: it's assumed that each player has its own channel issue(req, p); Index: mgame.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.h,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** mgame.h 1 Aug 2005 10:46:33 -0000 1.21 --- mgame.h 6 Aug 2005 23:29:48 -0000 1.22 *************** *** 381,384 **** --- 381,389 ---- void test_startit(); // just for testing. + + void iteration_histogram(int time); + void iteration_histogram_init(int time); + void iteration_histogram_writelog(); + }; Index: mnet1.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mnet1.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mnet1.cpp 1 Aug 2005 10:46:33 -0000 1.17 --- mnet1.cpp 6 Aug 2005 23:29:48 -0000 1.18 *************** *** 12,15 **** --- 12,16 ---- #include "../scp.h" + bool debug_net_block = false; static int log_show_num = 0; *************** *** 536,539 **** --- 537,552 ---- STACKTRACE; + #ifdef _DEBUG + if (key[KEY_SPACE] != 0) + { + if ( debug_net_block ) + { + //message.print(1000,15,"blocking network output"); + //message.animate(0); + return; // this introduces a sudden lag... + } + } + #endif + if (log_show_data) { |
From: Rob <geo...@us...> - 2005-08-06 23:28:06
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18553/source/ais Modified Files: c_wussie.cpp Log Message: division-by-zero bug fixed Index: c_wussie.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_wussie.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** c_wussie.cpp 4 Aug 2005 15:03:11 -0000 1.20 --- c_wussie.cpp 6 Aug 2005 23:27:48 -0000 1.21 *************** *** 122,125 **** --- 122,130 ---- //double velship, velshot; + if (!ship->speed_max) + { + return desiredangle; + } + // place the search-circle ahead of the ship, if you move forward that is double r = ship->vel.length() / ship->speed_max; |