Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10515 in orxonox.OLD


Ignore:
Timestamp:
Jan 30, 2007, 8:57:58 PM (17 years ago)
Author:
patrick
Message:

ai fix, mp fix

Location:
trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ai/ai_team.cc

    r10376 r10515  
    5454
    5555                                Vector targetPos=target->getAbsCoor();
     56                                float distanceToPlayer=(targetPos-position).len();
     57
    5658                                int zNorm=(position.z>targetPos.z)?1:-1;
    5759
    58                                 if((position.z-targetPos.z)*zNorm>60){  //go to start position
    59                                         //std::cout << "Go Start Position\n";
     60                                if(distanceToPlayer<attackDistance+60){ //### change wakeup distance here
     61                                        std::cout << "AI Sleeps \n";
     62                                        changeSwarmModule(it, new SwarmWait);
     63                                        maxTime=1000;   //sleep 2 seconds..
     64                                }else{
     65                                /*if((position.z-targetPos.z)*zNorm>60){        //go to start position
     66                                        std::cout << "Go Start Position\n";
    6067                                        changeSwarmModule(it, new SwarmGoRel);
    6168                                        zNorm=1-(rand()%2)*2;   //1 or -1
     
    6370                                        speed=60;
    6471                                }else if(position.x > targetPos.x+attackDistance+40){   //go to attack position
    65                                         //std::cout << "Go Attack Position\n";
     72                                        std::cout << "Go Attack Position\n";
    6673                                        changeSwarmModule(it, new SwarmGoRel);
    67                                         newPosition=Vector(attackDistance+30,0,0);
     74                                        newPosition=Vector(attackDistance+30,0,0)
    6875                                        speed=60;
    69                                 }else if(position.x > targetPos.x+attackDistance+20){   //go to attack mode
    70                                         //std::cout << "Go Attack Mode\n";
     76                                }else if(position.x > targetPos.x+attackDistance+20){   //go to attack mode;
     77                                        std::cout << "Go Attack Mode \n";*/
     78                                        std::cout << "AI Attacks \n";
    7179                                        changeSwarmModule(it, new SwarmAttack);
    7280                                        newPosition=Vector(attackDistance,0,0);
    7381                                        speed=60;
    74                                         maxTime=(rand()%11)+4;//4-14 Sekunden
    75                                 }else{                                                                                          //go to fallback point
    76                                         //std::cout << "Go  Fallback Point\n";
     82                                        maxTime=(1000);//rand()%11)+4;//4-14 Sekunden
     83                                /*}else{                                                                                                //go to fallback point
     84                                        std::cout << "Go  Fallback Point\n";
    7785                                        changeSwarmModule(it, new SwarmGoRel);
    7886                                        newPosition=Vector(80,0,zNorm*90);
    79                                         speed=80;
     87                                        speed=80;*/
    8088                                }
    81                         }else{
     89                        //}else{
    8290
    8391                        }
  • trunk/src/ai/attack_module.cc

    r10499 r10515  
    5454void AttackModule::process(float dt)
    5555{
     56        //PRINTF(0)("attack process\n");
     57
    5658        if(npc == NULL)return;
    5759
     
    116118        Vector vectorToDestination=destination-myPosition;
    117119
    118         Vector correction=              playerCollision*50*3 *6/myRadius
     120        Vector correction=              playerCollision*40*3 *6/myRadius
    119121                                                                +       npcCollision*50*3 *6/myRadius
    120122                                                                +       destinationMovement*2//-movement
     
    147149
    148150        view = target->getAbsCoor()+randomView-myPosition;
    149         view = view.cross( Vector(0,1,0) ).getNormalized();
     151        view = view.cross( Vector(0,-1,0) ).getNormalized();
    150152
    151153        npc->setAbsDirSoft( Quaternion( view, Vector(0,1,0)),8/myRadius);
     
    156158                if(fireTimeout<=0){
    157159                        fireTimeout=(rand()%21)/10+1;
    158                         std::cout << "Fiiiiirrreee!\n";
     160                        //std::cout << "Fiiiiirrreee!\n";
    159161                        NPC* npc2 = static_cast<NPC*>(npc);
    160162                        npc2->fire();
  • trunk/src/ai/movement_module.cc

    r10376 r10515  
    140140
    141141        //rotate NPC
    142         view = movement.cross( Vector(0,1,0) ).getNormalized();
     142        view = movement.cross( Vector(0,-1,0) ).getNormalized();
    143143        npc->setAbsDirSoft( Quaternion( view, Vector(0,1,0)),10/myRadius);
    144144
  • trunk/src/ai/swarm_wait.cc

    r10376 r10515  
    1919void SwarmWait::process(float dt)
    2020{
     21        if(taskRelObject!=NULL){
     22                Vector distVect=taskRelObject->getAbsCoor()-getSwarmPosition();
     23                float distance=distVect.len();
     24                if(distance<attackDistance+60)taskComplete=true;                //### change wakeup distance here
     25        }
     26
    2127        taskMaxTime-=dt;
    2228        if(taskMaxTime<=0)taskComplete=true;
  • trunk/src/story_entities/game_world.cc

    r10473 r10515  
    331331    /* network synchronisation */
    332332    this->synchronize ();
     333
     334         /* perform ai check*/
     335         this->checkAI();
     336
     337         this->update ();
    333338    /* process time */
    334339    this->tick ();
     
    344349    /* collision reaction */
    345350    this->collisionReaction ();
    346 
    347     /* perform ai check*/
    348     this->checkAI();
    349351
    350352    /* check the game rules */
  • trunk/src/world_entities/particles/particle_system.cc

    r9869 r10515  
    135135    {
    136136      if (emitter->isA(ParticleEmitter::staticClassID()))
     137      {
     138        // init the emitertter with the coordinates of the system
     139        dynamic_cast<ParticleEmitter*>(emitter)->setAbsCoor(this->getAbsCoor());
    137140        this->addEmitter(dynamic_cast<ParticleEmitter*>(emitter));
     141      }
    138142      else
    139143      {
Note: See TracChangeset for help on using the changeset viewer.