Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10045 in orxonox.OLD for branches/ai/src/ai


Ignore:
Timestamp:
Dec 12, 2006, 10:43:36 PM (17 years ago)
Author:
tfahrni
Message:
 
Location:
branches/ai/src/ai
Files:
3 added
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • branches/ai/src/ai/ai_engine.cc

    r10041 r10045  
    5555
    5656
    57 void AIEngine::process()
     57void AIEngine::tick(float dtS)
    5858{
     59        this->dtS=dtS;
    5960        int teamCount=teams.size();
    6061        for(int i=0; i < teamCount; i++ )
    6162        {
    62         //std::cout << "Processing Team " << i <<  "...\n";
     63                //std::cout << "hello";
     64        //std::cout << "DT " << dtS <<  "...\n";
    6365        teams.at(i)->process();
    6466        }
  • branches/ai/src/ai/ai_engine.h

    r10041 r10045  
    1313   static AIEngine* getInstance() { if( singletonRef == NULL) singletonRef = new AIEngine(); return singletonRef; }
    1414
    15    void process();
     15   void tick(float dtS);
    1616   AITeam* getTeam(int);
    1717        int newTeam();
     18        float dtS;
    1819 private:
    1920        AIEngine();
  • branches/ai/src/ai/ai_module.cc

    r10029 r10045  
    1212
    1313   ### File Specific:
    14    main-programmer: Patrick Boenzli
     14   main-programmer: Thomas Fahrni
    1515   co-programmer:
    1616*/
    17 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
    1818
    1919#include "ai_module.h"
     20#include "ai_engine.h"
     21#include "debug.h"
    2022
    2123
    22 AIModule::AIModule(){
    23 }
    2424
    25 AIModule::~AIModule(){
     25AIModule::AIModule()
     26{
    2627}
    2728
    2829
    29 void AIModule::process()
    30 {}
     30AIModule::~AIModule()
     31{
     32}
    3133
    3234
     35
     36void AIModule::process()
     37{
     38std::cout << "Processing Module...\n";
     39}
     40
     41
     42
     43void AIModule::setDifficulty(int newDifficulty)
     44{
     45        difficulty=newDifficulty;
     46}
     47
     48
     49
     50void AIModule::setOwner(AITeamMember* newOwner)
     51{
     52        owner=newOwner;
     53}
     54
  • branches/ai/src/ai/ai_module.h

    r10029 r10045  
    33#define _AI_MODULE_H
    44
     5class AITeamMember;
    56
    67class AIModule{
     
    910   ~AIModule();
    1011   void process();
     12   void setDifficulty(int newDifficulty);
     13   void setOwner(AITeamMember* newOwner);
    1114 private:
    1215   int difficulty;
     16   AITeamMember* owner;
    1317};
    1418
  • branches/ai/src/ai/ai_team.cc

    r10041 r10045  
    1212
    1313   ### File Specific:
    14    main-programmer: Patrick Boenzli
     14   main-programmer: Thomas Fahrni
    1515   co-programmer:
    1616*/
  • branches/ai/src/ai/ai_team_member.cc

    r10041 r10045  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
    1717#include "ai_team_member.h"
     18#include "movement_module.h"
    1819#include "ai_engine.h"
     20#include "debug.h"
     21
    1922
    2023AITeamMember::AITeamMember()
     
    3134        for(int i=0; i < moduleCount; i++ )
    3235        {
    33         std::cout << "Processing AIModule " << i <<  "...\n";
     36        std::cout << "Processing AIModule " << i << " (" << moduleCount << ")\n";
    3437        modules.at(i)->process();
    3538        }
     
    4144void AITeamMember::addToTeam(int aiTeamNumber)
    4245{
    43         //funktionniert nur so pseudomässig...
     46        //macht nicht so ganz das was es eigntlich machen sollte..
    4447        AIEngine* aiEngine=AIEngine::getInstance();
    4548        int teamNumber=aiEngine->newTeam();
    4649        aiEngine->getTeam(teamNumber)->addMember(this);
     50        MovementModule* nMod=new MovementModule;
     51        nMod->process();
     52        modules.push_back(nMod);
     53        modules.at(0)->process();
    4754}
    4855
     
    5057
    5158
    52 void AITeamMember::addModule(AIModule* newModule){
     59void AITeamMember::addModule(AIModule* newModule)
     60{
     61                std::cout << "AIModule added\n";
    5362                modules.push_back(newModule);
     63                newModule->setOwner(this);
    5464}
  • branches/ai/src/ai/ai_team_member.h

    r10041 r10045  
    66#include "ai_module.h"
    77
     8//class AIModule;
    89
    910class AITeamMember : public WorldEntity{
  • branches/ai/src/ai/movement_module.cc

    r10041 r10045  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    1210
    1311   ### File Specific:
    14    main-programmer: Patrick Boenzli
     12   main-programmer: Thomas Fahrni
    1513   co-programmer:
    1614*/
    17 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     15#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
    1816
    1917#include "movement_module.h"
     18#include "ai_engine.h"
     19#include "state.h"
     20#include "debug.h"
     21
     22//class AIEngine;
    2023
    2124MovementModule::MovementModule(){
     25        //std::cout << "MovementModule created...\n";
    2226}
    2327
     
    2832void MovementModule::process()
    2933{
     34        //float dt=AIEngine::getInstance()->dtS;
     35        std::cout << "///////////////////Processing Movement Module/////////////////////\n";
    3036
    3137        //How does the Module know the AITeamMember it belongs to??
    32        
    33         /*Vector absPosition = this->getAbsCoor();
     38        //partialy solved...
     39        /*
     40        Vector absPosition = owner->getAbsCoor();
    3441
    3542        PRINTF(0)(" npc abs coor: %f, %f, %f\n", absPosition.x, absPosition.y, absPosition.z);
    3643
    37         Player* pl = State::getPlayer();
    38         Vector playerAbsPos = pl->getPlayable()->getAbsCoor();
     44        //Player* pl = State::getPlayer();
     45        /*Vector playerAbsPos = pl->getPlayable()->getAbsCoor();
    3946
    40         PRINTF(0)(" player abs coor: %f, %f, %f\n", playerAbsPos.x, playerAbsPos.y, playerAbsPos.z);
     47        //PRINTF(0)(" player abs coor: %f, %f, %f\n", playerAbsPos.x, playerAbsPos.y, playerAbsPos.z);
    4148
    4249
     
    4855        float speed = 10.0f;
    4956
    50         this->shiftCoor( distanceVector * speed * dt);*/
     57        owner->shiftCoor( distanceVector * speed * dt);*/
    5158}
    5259
  • branches/ai/src/ai/movement_module.h

    r10029 r10045  
    1111   virtual void process();
    1212 private:
     13        //AITeamMember* owner;
    1314};
    1415
  • branches/ai/src/ai/shooting_module.cc

    r10029 r10045  
    1212
    1313   ### File Specific:
    14    main-programmer: Patrick Boenzli
     14   main-programmer: Thomas Fahrni
    1515   co-programmer:
    1616*/
    17 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
     17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_AI
     18#include "debug.h"
     19#include "shooting_module.h"
    1820
    19 #include "shooting_module.h"
    2021
    2122ShootingModule::ShootingModule()
     
    2829
    2930void ShootingModule::process()
    30 {}
     31{
     32        //std::cout << "Processing Shooting Module...\n";
     33        return;
     34}
    3135
    3236
Note: See TracChangeset for help on using the changeset viewer.