Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 12015 for code


Ignore:
Timestamp:
May 30, 2018, 2:23:47 PM (6 years ago)
Author:
patricwi
Message:

Added RacingBots

Location:
code/branches/PresentationFS18
Files:
15 edited
1 copied

Legend:

Unmodified
Added
Removed
  • code/branches/PresentationFS18

  • code/branches/PresentationFS18/data/levels/newnewnewspacerace.oxw

    r11783 r12015  
    2121
    2222  include("templates/spaceshipAssff.oxt")
    23   include("templates/pickupRepresentationTemplates.oxt")
     23  include("templates/SpaceRaceTemplates.oxt")
    2424
    2525?>
     
    214214  </StaticEntity>
    215215
    216 <StaticEntity position="10000,-70,200" direction="-1,0,0" yaw=90 pitch=0 roll=-30 collisionType="static">
     216<StaticEntity position="11000,-60,200" direction="-1,0,0" yaw=90 pitch=0 roll=-30 collisionType="static">
    217217    <attached>
    218218      <Model scale="20" mesh="Board2.mesh" />
     
    229229   
    230230    <!-- distance = how far from the middle point of a check point do i have to fly ? distance variable answers this question   -->
     231   
     232
     233     
    231234
    232235
     
    242245    </collisionShapes>
    243246    </RaceCheckPoint>
    244 
    245 
     247            <Model mesh="cube.mesh" scale=2 position="3000,200,100"/>
     248            <Model mesh="cube.mesh" scale=2 position="5000,100,500"/>
    246249
    247250<RaceCheckPoint name="checkpoint2" yaw=90 pitch=90 position="3000,200,100" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="1" islast="false" nextcheckpoints="2,-1,-1">
     
    258261
    259262
    260 <RaceCheckPoint name="checkpoint3" yaw=90 pitch=90 position="5000,100,500" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="2" islast="false" nextcheckpoints="3,-1,-1">
     263<RaceCheckPoint name="checkpoint3" yaw=90 pitch=90 position="5000,80,500" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="2" islast="false" nextcheckpoints="3,-1,-1">
    261264        <attached>
    262265      <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
     
    284287
    285288
    286 <RaceCheckPoint name="checkpoint5"  yaw=90 pitch=90 position="10000,-200,200" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="4" islast="false" nextcheckpoints="5,-1,-1">
    287         <attached>
    288       <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
    289     </attached>
    290     <collisionShapes>
    291         <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
    292         <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
    293         <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
    294         <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
    295     </collisionShapes>
    296     </RaceCheckPoint>
    297 
    298 
    299 
    300 <RaceCheckPoint name="checkpoint6" yaw=90 pitch=90 position="13000,200,400" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="5" islast="false" nextcheckpoints="6,-1,-1">
    301         <attached>
    302       <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
    303     </attached>
    304     <collisionShapes>
    305         <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
    306         <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
    307         <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
    308         <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
    309     </collisionShapes>
    310     </RaceCheckPoint>
    311 
    312 
    313 
    314 <RaceCheckPoint name="checkpoint7" yaw=90 pitch=90 position="15000,0,0" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="6" islast="false" nextcheckpoints="7,-1,-1">
     289<RaceCheckPoint name="checkpoint5"  yaw=90 pitch=90 position="11000,-200,200" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="4" islast="false" nextcheckpoints="5,-1,-1">
     290        <attached>
     291      <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
     292    </attached>
     293    <collisionShapes>
     294        <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
     295        <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
     296        <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
     297        <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
     298    </collisionShapes>
     299    </RaceCheckPoint>
     300
     301
     302
     303<RaceCheckPoint name="checkpoint6" yaw=90 pitch=90 position="13000,-70,350" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="5" islast="false" nextcheckpoints="6,-1,-1">
     304        <attached>
     305      <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
     306    </attached>
     307    <collisionShapes>
     308        <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
     309        <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
     310        <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
     311        <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
     312    </collisionShapes>
     313    </RaceCheckPoint>
     314
     315
     316
     317<RaceCheckPoint name="checkpoint7" yaw=90 pitch=90 position="15500,0,0" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="6" islast="false" nextcheckpoints="7,-1,-1">
    315318        <attached>
    316319      <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
     
    349352    </collisionShapes>
    350353    </RaceCheckPoint>
    351 
    352354<RaceCheckPoint name="checkpoint10" yaw=90 pitch=90 position="24000,-150,-80" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="9" islast="false" nextcheckpoints="10,-1,-1">
    353355        <attached>
     
    376378
    377379
    378 <RaceCheckPoint name="checkpoint12" yaw=90 pitch=90 position="30000,-300,900" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="11" islast="false" nextcheckpoints="12,-1,-1">
    379         <attached>
    380       <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
    381     </attached>
    382     <collisionShapes>
    383         <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
    384         <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
    385         <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
    386         <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
    387     </collisionShapes>
    388     </RaceCheckPoint>
    389 
    390 
    391 <RaceCheckPoint name="checkpoint13" yaw=90 pitch=90 position="33000,600,60" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="12" islast="false" nextcheckpoints="13,-1,-1">
    392         <attached>
    393       <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
    394     </attached>
    395     <collisionShapes>
    396         <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
    397         <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
    398         <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
    399         <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
    400     </collisionShapes>
    401     </RaceCheckPoint>
    402 
    403 
    404 
    405 <RaceCheckPoint name="checkpoint14" yaw=90 pitch=90 position="35000,120,20" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="13" islast="false" nextcheckpoints="14,-1,-1">
    406         <attached>
    407       <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
    408     </attached>
    409     <collisionShapes>
    410         <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
    411         <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
    412         <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
    413         <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
    414     </collisionShapes>
    415     </RaceCheckPoint>
    416 
    417 <RaceCheckPoint name="checkpoint15" yaw=90 pitch=90 position="38000,-200,0" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="14" islast="false" nextcheckpoints="15,-1,-1">
     380<RaceCheckPoint name="checkpoint12" yaw=90 pitch=90 position="30000,-250,670" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="11" islast="false" nextcheckpoints="12,-1,-1">
     381        <attached>
     382      <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
     383    </attached>
     384    <collisionShapes>
     385        <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
     386        <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
     387        <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
     388        <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
     389    </collisionShapes>
     390    </RaceCheckPoint>
     391
     392
     393<RaceCheckPoint name="checkpoint13" yaw=90 pitch=90 position="33000,150,600" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="12" islast="false" nextcheckpoints="13,-1,-1">
     394        <attached>
     395      <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
     396    </attached>
     397    <collisionShapes>
     398        <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
     399        <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
     400        <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
     401        <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
     402    </collisionShapes>
     403    </RaceCheckPoint>
     404
     405
     406
     407<RaceCheckPoint name="checkpoint14" yaw=90 pitch=90 position="35000,500,300" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="13" islast="false" nextcheckpoints="14,-1,-1">
     408        <attached>
     409      <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
     410    </attached>
     411    <collisionShapes>
     412        <BoxCollisionShape position="0,0,70"      halfExtents="70, 10, 10" />
     413        <BoxCollisionShape position="0,0,-70"     halfExtents="70, 10, 10" />
     414        <BoxCollisionShape position="70,0,0"      halfExtents="10, 10, 70" />
     415        <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
     416    </collisionShapes>
     417    </RaceCheckPoint>
     418
     419<RaceCheckPoint name="checkpoint15" yaw=90 pitch=90 position="38000,150,150" direction="0,1,0" roll="0" collisionType="static" scale="1" distance="60" checkpointindex="14" islast="false" nextcheckpoints="15,-1,-1">
    418420        <attached>
    419421      <Model position="0,0,0" scale="70" mesh="Checkpoint_InnerRing.mesh"/>
     
    473475        <BoxCollisionShape position="-70,0,0"     halfExtents="10, 10, 70" />
    474476    </collisionShapes>
    475     </RaceCheckPoint>
     477    </RaceCheckPoint> 
    476478
    477479<!-- the last checkpoint is bigger and red -->
     
    486488        <BoxCollisionShape position="-90,0,0"     halfExtents="13, 13, 90" />
    487489    </collisionShapes>
    488     </RaceCheckPoint>
     490    </RaceCheckPoint> 
    489491
    490492
    491493</checkpoints>
    492494</SpaceRaceManager>
    493 
     495   <Arrow>
     496      <attached>
     497       <Model scale="5" mesh="botpointer4.mesh"/>
     498      </attached>
     499      <controller>
     500        <ArrowController accuracy = 10000>
     501          <gpspoints>
     502            <Model mesh="cube.mesh" scale=0 position="1000,30,0"/>
     503            <Model mesh="cube.mesh" scale=0 position="3000,200,100"/>
     504            <Model mesh="cube.mesh" scale=0 position="5000,80,500"/>
     505            <Model mesh="cube.mesh" scale=0 position="8000,-150,150"/>
     506            <Model mesh="cube.mesh" scale=0 position="11000,-200,200"/>
     507            <Model mesh="cube.mesh" scale=0 position="13000,-70,350"/>
     508            <Model mesh="cube.mesh" scale=0 position="15500,0,0"/>
     509            <Model mesh="cube.mesh" scale=0 position="18000,150,-150"/>
     510            <Model mesh="cube.mesh" scale=0 position="21000,200,-120"/>
     511            <Model mesh="cube.mesh" scale=0 position="24000,-150,-80"/>
     512            <Model mesh="cube.mesh" scale=0 position="27000,-200,0"/>
     513            <Model mesh="cube.mesh" scale=0 position="30000,-250,670"/>
     514            <Model mesh="cube.mesh" scale=0 position="33000,150,600"/>
     515            <Model mesh="cube.mesh" scale=0 position="35000,500,300"/>
     516            <Model mesh="cube.mesh" scale=0 position="38000,150,150"/>
     517            <Model mesh="cube.mesh" scale=0 position="41000,30,-50"/>
     518            <Model mesh="cube.mesh" scale=0 position="44000,90,0"/>
     519            <Model mesh="cube.mesh" scale=0 position="47000,120,30"/>
     520            <Model mesh="cube.mesh" scale=0 position="50000,0,100"/>
     521            <Model mesh="cube.mesh" scale=0 position="53000,0,0"/>
     522
     523           
     524
     525
     526           
     527
     528                </gpspoints>
     529        </ArrowController>
     530      </controller>
     531    </Arrow>
    494532
    495533
    496534<!-- ---------------------PickUps---------------------- -->
    497535
    498     <PickupSpawner pickup=smallshrinkpickup position="10000,-200,200" triggerDistance="60" respawnTime="10" maxSpawnedItems="10" scale="8"/>
    499     <PickupSpawner pickup=mediumboostpickup position="24000,-150,-80" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
    500     <PickupSpawner pickup=smallboostpickup position="38000,-200,0" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
    501 
    502     <PickupSpawner pickup=smallspeedpickup position="7000,-200,100" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
    503     <PickupSpawner pickup=mediumshinkpickup position="16000,150,50" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
    504     <PickupSpawner pickup=triplehealthspeedinvisibilitypickup position="41000,-300,100" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
     536   
     537    <PickupSpawner pickup=mediumboostpickup position="24000,-165,-80" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
     538   
     539    <PickupSpawner pickup=smallboostpickup position="42000,70,-30" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
     540    <PickupSpawner pickup=smallspeedpickup position="32000,0,650" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
     541
     542    <PickupSpawner pickup=smallspeedpickup position="9000,-185,66" triggerDistance="60" respawnTime="10" maxSpawnedItems="8" scale="10"/>
     543 
    505544  </Scene>
    506545</Level>
  • code/branches/PresentationFS18/data/levels/presentationHS12.oxw

    r10624 r12015  
    6161
    6262    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    63     <SpawnPoint team=0 position="-900,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
     63    <SpawnPoint team=0 position="-900,0,0" lookat="0,0,0" primaryThrust=1000 spawnclass=SpaceShip pawndesign=spaceshipescort />
    6464    <!--SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=bigship /-->
    6565    <!--SpawnPoint team=0 position="-900,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipcollateraldamage /-->
     
    328328        roll                = "180"
    329329        name                = "collateralDamage"
    330         radarname           = "Collateral Damage" >
    331         <!--
     330        radarname           = "Collateral Damage"
    332331        pitch               = "90"
    333         yaw                 = "0"-->
     332        yaw                 = "100"
     333        primaryThrust       = "2000">
    334334      <attached>
    335335        <DockingTarget name="spaceShip" />
  • code/branches/PresentationFS18/data/levels/templates/fastship.oxt

    r11783 r12015  
    2121   rotationThrust    = 50
    2222
    23    lift = 0;
    24    stallSpeed = 220;
     23   lift = 0
     24   stallSpeed = 220
    2525
    2626
    27    boostPower            = 8
     27   boostPower            = 7.5 
    2828   boostPowerRate        = 3
    29    boostRate             = 8
     29   boostRate             = 7.5
    3030   boostCooldownDuration = 6
    3131
  • code/branches/PresentationFS18/data/levels/templates/spaceshipCollateralDamage.oxt

    r11052 r12015  
    1919   shieldrechargewaittime = 1
    2020
    21    primaryThrust     = 100
     21   primaryThrust     = 1000
    2222   auxilaryThrust    = 30
    2323   rotationThrust    = 50
     
    2929   boostPowerRate        = 1
    3030   boostRate             = 5
    31    boostCooldownDuration = 10
     31   boostCooldownDuration = 1
    3232
    3333   shakeFrequency = 15
     
    3636   collisionType     = "dynamic"
    3737   mass              = 100
    38    linearDamping     = 0.7
     38   linearDamping     = 0.5
    3939   angularDamping    = 0.9999999
    4040  >
  • code/branches/PresentationFS18/src/libraries/tools/Timer.cc

    r11071 r12015  
    199199        executor->getFunctor()->setSafeMode(true);
    200200    }
     201
    201202
    202203    /**
  • code/branches/PresentationFS18/src/libraries/tools/Timer.h

    r11071 r12015  
    113113            void run();
    114114
     115
    115116            /// Re-starts the timer: The executor will be called after @a interval seconds.
    116117            inline void startTimer()
  • code/branches/PresentationFS18/src/modules/gametypes/SpaceRace.cc

    r11721 r12015  
    6969#include "SpaceRaceBot.h"
    7070#include "items/Engine.h"
    71 #include <vector>
     71#include <vector>
     72#include <iostream>
     73#include <string>
    7274
    7375
     
    8385        this->cantMove_ = false;
    8486        this->bTimeIsUp_ = false;
    85 
    8687        this->numberOfBots_ = 5; // quick fix: don't allow default-bots to enter the race
     88        this->bLost =false;
    8789        //we fixed the number of bots in order to have the same starting position all the time !
    8890    }
     
    101103        startpos[4] =-40;
    102104        startpos[5] =100;
    103        
     105         
    104106        startpos[6] =100;
    105107        startpos[7] =-40;
     
    117119
    118120        this->spawnPlayersIfRequested();
     121        this->countdown_mode=true;
    119122        this->cantMove_ = true;
    120123        //players are unable to move while countdown is running
     
    122125        {
    123126            engine->setActive(false);
     127            engine->addSpeedMultiply(1.7);
    124128        }
    125129
     
    138142        }
    139143
    140         std::string message("Use headphones to hear the countdown!");
    141         this->getGametypeInfo()->sendAnnounceMessage(message);
    142         ChatManager::message(message);
    143 
    144         //after 11 seconds , countdownFinished function is called to activate bots` engines
    145         Timer* countdownTimer = new Timer();
    146         countdownTimer->setTimer(11, false, createExecutor(createFunctor(&SpaceRace::countdownFinished, this)));
    147     }
    148 
    149 
    150 
     144        std::string message("Use headphones to hear the countdown! Press W for forward acceleration, press W+space for boost!");
     145
     146        this->getGametypeInfo()->sendAnnounceMessage(message);
     147        ChatManager::message(message);
     148       
     149
     150
     151       
     152    }
     153
     154    // Counter in the beginning of the game
     155    void SpaceRace::tick(float dt) {
     156        SUPER(SpaceRace, tick, dt);
     157       
     158        //countdown_mode is set true,when spawnIfRequested is called
     159        if (countdown_mode) {
     160            //10 seconds will be counted
     161            this->time_passed -= dt;
     162
     163            //orxout() << "time: " <<(int) time_passed << "s" << endl;
     164
     165            std::string message=std::to_string((int)time_passed);
     166            this->getGametypeInfo()->sendAnnounceMessage(message);
     167            if (time_passed <= 1) {
     168
     169                this->countdownFinished();
     170                this->countdown_mode = false;
     171            }
     172        }
     173
     174    }
     175       
     176    void SpaceRace::startmessage(int second){
     177
     178        std::string message=std::to_string(second);
     179        this->getGametypeInfo()->sendAnnounceMessage(message);
     180        ChatManager::message(message);
     181       
     182       
     183
     184    }
    151185
    152186    void SpaceRace::end()
    153187    {
     188       
    154189        this->clock_.capture();
    155190        int s = this->clock_.getSeconds();
    156191        int ms = static_cast<int>(this->clock_.getMilliseconds() - 1000*s);
    157192        std::string message;
    158 
    159193        if (this->bTimeIsUp_)
    160194        {
    161             message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
    162                         + "You lose!";
    163         }
     195            message =  "TIME IS UP! YOU LOOSE!";
     196        }
     197       else if(this->bLost){
     198            message = "YOU LOOSE!";
     199
     200       }       
     201       
    164202        else
    165203        {
     
    167205                        + "." + multi_cast<std::string>(ms) + " seconds.";
    168206        }
     207       
    169208        if (!this->hasEnded())
    170209        {
     210
    171211            this->getGametypeInfo()->sendAnnounceMessage(message);
    172212            ChatManager::message(message);
     
    183223        int ms = this->clock_.getMilliseconds() % 1000;
    184224
    185        
    186    
    187         const std::string& message = player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
     225
     226        std::string message(player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
     227        + " after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds.");
     228
     229        this->getGametypeInfo()->sendAnnounceMessage(message);
     230        ChatManager::message(message);
     231      /*  const std::string& message = player->getName() + " reached the checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1)
    188232        + "after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds.";
    189233        this->getGametypeInfo()->sendAnnounceMessage(message);
    190         ChatManager::message(message);
     234        ChatManager::message(message);*/
     235       
    191236
    192237    }
     
    195240    {
    196241
    197         std::string message("RACE STARTED ");
    198         this->getGametypeInfo()->sendAnnounceMessage(message);
    199         ChatManager::message(message);
     242        std::string message("RACE STARTED");
     243        this->getGametypeInfo()->sendAnnounceMessage(message);
     244        ChatManager::message(message);
     245       
    200246
    201247
    202248        for (Engine* engine : ObjectList<Engine>())
    203249            engine->setActive(true);
     250
     251        std::string message2("Press W for forward acceleration, press W+space for boost!");
     252        this->getGametypeInfo()->sendAnnounceMessage(message2);
     253        ChatManager::message(message2);
    204254    }
    205255
  • code/branches/PresentationFS18/src/modules/gametypes/SpaceRace.h

    r11720 r12015  
    4242#include "SpaceRaceManager.h"
    4343
     44
    4445namespace orxonox
    4546{
     
    5455
    5556        public:
    56             SpaceRace(Context* context);
     57            SpaceRace(Context* context);//, SpaceRace* parentRace);
    5758            virtual ~SpaceRace() {}
    5859
     
    6061            virtual void end() override;
    6162            virtual void countdownFinished();
     63           
    6264            virtual void addBots(unsigned int amount) override; //<! overwrite function in order to bypass the addbots command.
     65            virtual void tick(float dt) override;
     66            virtual void startmessage(int second);
    6367
    6468
     
    7983            inline Clock& getClock()
    8084                { return this->clock_; }
     85            //inline void setParentRace(SpaceRace* parentRace) { this->parentRace = parentRace; }
    8186
    8287            virtual bool allowPawnHit(Pawn* victim, Pawn* originator) override;
    8388            virtual bool allowPawnDamage(Pawn* victim, Pawn* originator) override;
    8489            virtual bool allowPawnDeath(Pawn* victim, Pawn* originator) override;
     90            bool countdown_mode = false;
     91            float time_passed = 11.0f;
     92           
     93            bool bLost=false;
    8594
    8695        private:
    8796            bool cantMove_;                                            ///< Helper variable, used to stall the engines before the race starts.
    8897            std::map<PlayerInfo*, RaceCheckPoint*> checkpointReached_; ///< The number of the last check point reached by each player.
    89             bool bTimeIsUp_;                                           ///< True if one of the check points is reached too late.
     98            bool bTimeIsUp_;    ///< True if one of the check points is reached too late.
    9099
    91100            Clock clock_; ///< The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
  • code/branches/PresentationFS18/src/modules/gametypes/SpaceRaceController.cc

    r11720 r12015  
    2020 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    2121 *
    22  *  Created on: Oct 8, 2012
     22 *  Created on: Oct 8, 2012findCheck
    2323 *      Author: purgham
    2424 */
     
    3030#include "collisionshapes/CollisionShape.h"
    3131#include "BulletCollision/CollisionShapes/btCollisionShape.h"
     32#include "SpaceRace.h"
    3233
    3334
     
    3839    const int ADJUSTDISTANCE = 500;
    3940    const int MINDISTANCE = 5;
     41
    4042    /*
    4143     * Idea: Find static Point (checkpoints the spaceship has to reach)
     
    4547    {
    4648        RegisterObject(SpaceRaceController);
     49        //this->parentRace = nullptr;
     50
    4751        std::vector<RaceCheckPoint*> checkpoints;
    4852
     
    6367
    6468        int i;
    65         for (i = -2; findCheckpoint(i) != nullptr; i--)
     69        for (i = -2; findCheckpoint(i) != nullptr; i--)     // WIESO?
    6670        {
    6771            continue;
     
    103107        return returnVec;
    104108    }
    105 
     109    void SpaceRaceController::endtheGame() const {
     110        SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype());
     111        assert(gametype)
     112;        if (!gametype)
     113        return;
     114        gametype->bLost=true;
     115        gametype->end();
     116
     117    }
    106118    /*
    107119     * called from 'findStaticCheckpoints'
     
    122134            for (int checkpointIndex : currentCheckpoint->getNextCheckpoints())
    123135            {
     136                if (findCheckpoint(checkpointIndex) == nullptr){
     137                    orxout(internal_warning) << "Problematic Point: " << checkpointIndex << endl;
     138                }
    124139                if (currentCheckpoint == findCheckpoint(checkpointIndex))
    125140                {
    126                     //orxout() << currentCheckpoint->getCheckpointIndex()<<endl;
     141                    orxout() << currentCheckpoint->getCheckpointIndex()<<endl;
    127142                    continue;
    128143                }
    129                 if (findCheckpoint(checkpointIndex) == nullptr)
    130                     orxout(internal_warning) << "Problematic Point: " << checkpointIndex << endl;
     144             
    131145                else
    132146                    numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(checkpointIndex), zaehler);
     147
    133148            }
    134149            zaehler[currentCheckpoint] += numberOfWays;
     
    162177        {
    163178            RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(checkpointIndex);
     179
    164180            float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition());
    165181
     
    168184                minDistance = distance;
    169185                minNextRaceCheckPoint = nextRaceCheckPoint;
    170             }
    171 
    172         }
    173 
     186
     187            }
     188            //There is a bug. If the user passes through the 19th checkpoint with the opponents, the game will end immediately
     189            if(nextRaceCheckPoint->isLast())
     190                endtheGame();
     191
     192        }
     193        if(minNextRaceCheckPoint == nullptr) { orxout()<<"nullptr found @192 SpaceRaceController" << endl;}
    174194        return minNextRaceCheckPoint;
    175195    }
     
    208228
    209229        {
     230            if(nextRaceCheckpoint_ == nullptr) orxout()<<"nullptr found @218 SpaceRaceController" << endl;
     231
    210232            return nextRaceCheckpoint_;
    211233        }
     
    213235
    214236        {
     237            if(nextRaceCheckpoint_ == nullptr) orxout()<<"nullptr found @223 SpaceRaceController" << endl;
     238
    215239            return nextRaceCheckpoint_;
    216240        }
     
    221245    }
    222246
     247
     248
     249
     250   
     251
    223252    RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const
    224253    {
    225         for (RaceCheckPoint* checkpoint : this->checkpoints_)
    226             if (checkpoint->getCheckpointIndex() == index)
    227                 return checkpoint;
    228         return nullptr;
    229     }
     254        RaceCheckPoint* res = nullptr;
     255        for (RaceCheckPoint* checkpoint : this->checkpoints_){
     256            //conclusion: index=20 is not
     257            if (checkpoint->getCheckpointIndex() == index){
     258                //if(checkpoint == nullptr) orxout()<<"returned nullptr @line 234 SpaceRaceController"<<endl;
     259                //orxout()<< "index of the checkpoint "<< index <<endl;
     260                res = checkpoint;
     261                return res;
     262            }
     263        }
     264    /* if(index>2 )   
     265        this->endtheGame();*/
     266
     267        return res;
     268    }
     269   
     270
    230271
    231272    /*RaceCheckPoint* SpaceRaceController::addVirtualCheckPoint( RaceCheckPoint* previousCheckpoint, int indexFollowingCheckPoint , const Vector3& virtualCheckPointPosition )
     
    282323    void SpaceRaceController::tick(float dt)
    283324    {
     325       
     326
    284327        if (this->getControllableEntity() == nullptr || this->getControllableEntity()->getPlayer() == nullptr )
    285328        {
     
    312355        {
    313356            nextRaceCheckpoint_ = adjustNextPoint();
     357            if(nextRaceCheckpoint_ == nullptr) orxout()<<"nullptr found @327 SpaceRaceController" << endl;
     358
    314359            lastPositionSpaceship = this->getControllableEntity()->getPosition();
    315360        }
     
    325370        }
    326371        //orxout(user_status) << "dt= " << dt << ";  distance= " << (lastPositionSpaceship-this->getControllableEntity()->getPosition()).length() <<std::endl;
    327         lastPositionSpaceship = this->getControllableEntity()->getPosition();
    328        
     372        /*lastPositionSpaceship = this->getControllableEntity()->getPosition();
     373       
     374        SpaceRace obj=new SpaceRace();
     375        obj.setParentRace(parentRace);
     376        this->parentRace=obj.parentRace;*/
     377       
    329378        this->boostControl();
     379
     380        /*if(nextRaceCheckpoint_ == nullptr){
     381            this->parentRace->bLost=true;
     382            this->parentRace->end();
     383        }*/
     384        // if(nextRaceCheckpoint_ == nullptr ){
     385        //    // if( nextRaceCheckpoint_->getCheckpointIndex()==19)
     386        //     orxout()<<"nullptr @351 Line"<<endl;
     387        // }
     388
     389       
    330390        this->moveToPosition(nextRaceCheckpoint_->getPosition());
     391
    331392        this->boostControl();
    332393    }
    333394
     395
     396    /*void SpaceRaceController::setParentRace(parentRace){
     397        this->parentRace=parentRace;
     398    }*/
    334399    // True if a coordinate of 'pointToPoint' is smaller then the corresponding coordinate of 'groesse'
    335400    bool SpaceRaceController::vergleicheQuader(const Vector3& pointToPoint, const Vector3& groesse)
  • code/branches/PresentationFS18/src/modules/gametypes/SpaceRaceController.h

    r11099 r12015  
    4747    {
    4848        public:
    49             SpaceRaceController(Context* context);
     49            SpaceRaceController(Context* context);//, SpaceRace* parentRace);
    5050            virtual ~SpaceRaceController();
    5151            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    5252            virtual void tick(float dt) override;
     53           
    5354
    5455        private:
     
    5758            RaceCheckPoint* nextPointFind(RaceCheckPoint*);
    5859            RaceCheckPoint* adjustNextPoint();
     60            void endtheGame() const;
     61
    5962            std::vector<RaceCheckPoint*> findStaticCheckpoints(RaceCheckPoint*, const std::vector<RaceCheckPoint*>&);
    6063            std::vector<RaceCheckPoint*> staticCheckpoints();
     
    7477            Vector3 lastPositionSpaceship;
    7578            int virtualCheckPointIndex;
     79            //SpaceRace* parentRace;
    7680    };
    7781
  • code/branches/PresentationFS18/src/modules/gametypes/SpaceRaceManager.cc

    r11071 r12015  
    113113    RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const
    114114    {
    115         for (RaceCheckPoint* checkpoint : this->checkpoints_)
     115        /*for (RaceCheckPoint* checkpoint : this->checkpoints_)
    116116        if (checkpoint->getCheckpointIndex() == index)
    117117        return checkpoint;
     118        return nullptr;*/
     119        for (RaceCheckPoint* checkpoint : this->checkpoints_){
     120            if (checkpoint->getCheckpointIndex() == index)
     121                return checkpoint;
     122        }
     123        orxout()<<"returned checkpoint @line 123 SpaceRaceManager"<<endl;
    118124        return nullptr;
    119125    }
  • code/branches/PresentationFS18/src/orxonox/items/Engine.cc

    r11071 r12015  
    5454        this->relativePosition_ = Vector3::ZERO;
    5555
    56         this->boostFactor_ = 1.5f;
     56        this->boostFactor_ = 1.2f;
    5757
    5858        this->maxSpeedFront_ = 0.0f;
     
    6161        this->maxSpeedUpDown_ = 0.0f;
    6262
    63         this->accelerationFront_ = 0.0f;
     63        this->accelerationFront_ = 1.0f;
    6464        this->accelerationBrake_ = 0.0f;
    6565        this->accelerationBack_ = 0.0f;
     
    6868
    6969        this->speedAdd_ = 0.0f;
    70         this->speedMultiply_ = 1.0f;
     70        this->speedMultiply_ = 1.0f;                       //////////////////////////////////////////
    7171
    7272        this->setConfigValues();
  • code/branches/PresentationFS18/src/orxonox/worldentities/pawns/SpaceShip.cc

    r11083 r12015  
    6565        this->boostPowerRate_ = 1.0f;
    6666        this->boostRate_ = 5.0f;
    67         this->boostCooldownDuration_ = 5.0f;
     67        this->boostCooldownDuration_ = 10.0f;
    6868
    6969        this->shakeFrequency_ = 15.0f;
  • code/branches/PresentationFS18/src/orxonox/worldentities/pawns/SpaceShip.h

    r11052 r12015  
    103103            */
    104104            virtual void moveFrontBack(const Vector2& value)
    105                 { this->steering_.z -= value.x; }
     105                { this->steering_.z -= (0.6)*value.x; }
    106106            /**
    107107            @brief Move right or left.
     
    109109            */
    110110            virtual void moveRightLeft(const Vector2& value)
    111                 { this->steering_.x += value.x; }
     111                { this->steering_.x += (0.6)*value.x; }
    112112            /**
    113113            @brief Move up or down.
     
    115115            */
    116116            virtual void moveUpDown(const Vector2& value)
    117                 { this->steering_.y += value.x; }
     117                { this->steering_.y += (0.6)*value.x; }
    118118
    119119            virtual void rotateYaw(const Vector2& value); // Rotate in yaw direction.
Note: See TracChangeset for help on using the changeset viewer.