Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 27, 2009, 7:11:30 PM (15 years ago)
Author:
landauf
Message:

Improved PongAI - it tries to predict the position of the ball (but does some random mistakes, depending on the AI's strength) and moves to this position (with a reaction delay, also depending on the strength). Additionally fixed some inaccuracies caused by the hysteresis avoidance system.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/controllers/PongAI.h

    r2857 r2860  
    3232#include "OrxonoxPrereqs.h"
    3333
     34#include <list>
     35
    3436#include "Controller.h"
    3537#include "objects/Tickable.h"
     38#include "util/Math.h"
    3639
    3740namespace orxonox
     
    4144        public:
    4245            PongAI(BaseObject* creator);
    43             virtual ~PongAI() {}
     46            virtual ~PongAI();
    4447
    4548            void setConfigValues();
     
    5255        protected:
    5356            void calculateRandomOffset();
     57            void calculateBallEndPosition();
     58            void move(char direction);
     59            void delayedMove();
    5460
    5561            PongBall* ball_;
     62            Vector2 ballDirection_;
     63            float ballEndPosition_;
    5664            float randomOffset_;
    5765            float relHysteresisOffset_;
    5866            float strength_;
     67
     68//            Timer<PongAI> randomOffsetTimer_;
     69//            Timer<PongAI> ballEndPositionTimer_;
     70            std::list<std::pair<Timer<PongAI>*, char> > reactionTimers_;
     71            char movement_;
    5972    };
    6073}
Note: See TracChangeset for help on using the changeset viewer.