Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 12, 2011, 7:50:43 PM (13 years ago)
Author:
jo
Message:

Ai and tutorial improvements merged back to the trunk. AI features: all weapons are used, the ai-firestrength is configurable, bots are able to collect pickups . I've set the tutorial level as default level.

Location:
code/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/orxonox/controllers/ArtificialController.h

    r8706 r8891  
    3232#include "OrxonoxPrereqs.h"
    3333
    34 #include <vector>
     34#include <map>
    3535
    3636#include "util/Math.h"
    3737#include "Controller.h"
    3838#include "controllers/NewHumanController.h"
     39#include "weaponsystem/WeaponSystem.h"
    3940
    4041namespace orxonox
     
    7879            static void formationsize(const int size);
    7980
     81            virtual void doFire();
     82            void setBotLevel(float level=1.0f);
     83            inline float getBotLevel() const
     84                { return this->botlevel_; }
     85            static void setAllBotLevel(float level);
     86            //WAYPOINT FUNCTIONS
     87            void addWaypoint(WorldEntity* waypoint);
     88            WorldEntity* getWaypoint(unsigned int index) const;
     89
     90            inline void setAccuracy(float accuracy)
     91                { this->squaredaccuracy_ = accuracy*accuracy; }
     92            inline float getAccuracy() const
     93                { return sqrt(this->squaredaccuracy_); }
     94            void updatePointsOfInterest(std::string name, float distance);
     95            void manageWaypoints();
     96
    8097        protected:
    8198
     
    96113            void moveToPosition(const Vector3& target);
    97114            void moveToTargetPosition();
     115            void absoluteMoveToPosition(const Vector3& target);
    98116
    99117            virtual void positionReached() {}
     
    135153
    136154            static bool sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype); // hack
     155            void boostControl(); //<! Sets and resets the boost parameter of the spaceship. Bots alternate between boosting and saving boost.
    137156
    138157            bool bHasTargetPosition_;
     
    141160            bool bShooting_;
    142161
    143         private:
     162            float botlevel_; //<! Makes the level of a bot configurable.
     163            enum Mode {DEFAULT, ROCKET, DEFENCE, MOVING};//TODO; implement DEFENCE, MOVING modes
     164            Mode mode_; //TODO: replace single value with stack-like implementation: std::vector<Mode> mode_;
     165            void setPreviousMode();
     166
     167            //WEAPONSYSTEM DATA
     168            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode- managed by setupWeapons()
     169            //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()
     170            float timeout_; //<! Timeout for rocket usage. (If a rocket misses, a bot should stop using it.)
     171            void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
     172            bool bSetupWorked; //<! If false, setupWeapons() is called.
     173            int getFiremode(std::string name);
     174
     175            //WAYPOINT DATA
     176            std::vector<WeakPtr<WorldEntity> > waypoints_;
     177            size_t currentWaypoint_;
     178            float squaredaccuracy_;
     179            WorldEntity* defaultWaypoint_;
    144180    };
    145181}
Note: See TracChangeset for help on using the changeset viewer.