Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1694


Ignore:
Timestamp:
Sep 1, 2008, 10:20:24 PM (16 years ago)
Author:
rgrieder
Message:

Added Dedicated game state (name: "dedicated", class: GSDedicated).
It doesn't work at all yet, mainly because of our very poorly designed /objects folder. I tried adding a few "if (Settings::showsGraphics())", but I ran into some serious issues.
I will simply leave this topic up to an eager orxonox developer who wants a dedicated server :D There is A LOT of work to be done…

Location:
code/branches/gui
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gui/src/orxonox/Main.cc

    r1689 r1694  
    4747#include "gamestates/GSServer.h"
    4848#include "gamestates/GSClient.h"
     49#include "gamestates/GSDedicated.h"
    4950#include "gamestates/GSGUI.h"
    5051#include "gamestates/GSIOConsole.h"
     
    9495    GSServer server;
    9596    GSClient client;
     97    GSDedicated dedicated;
    9698    GSGUI gui;
    9799    GSIOConsole ioConsole;
     
    104106
    105107    root.addChild(&ioConsole);
     108    root.addChild(&dedicated);
    106109
    107110    root.start(argc, argv);
  • code/branches/gui/src/orxonox/gamestates/GSLevel.cc

    r1689 r1694  
    3737#include "core/Loader.h"
    3838#include "objects/Backlight.h"
     39#include "objects/Tickable.h"
    3940#include "tools/ParticleInterface.h"
    4041#include "Settings.h"
  • code/branches/gui/src/orxonox/gamestates/GSLevel.h

    r1689 r1694  
    5656        void unloadLevel();
    5757
    58     private:
    59 
    6058        float timeFactor_;       //!< A factor to change the gamespeed
    6159
  • code/branches/gui/src/orxonox/objects/Ambient.cc

    r1653 r1694  
    4444#include "core/XMLPort.h"
    4545#include "core/ConsoleCommand.h"
     46#include "Settings.h"
    4647
    4748namespace orxonox
     
    6566
    6667    bool Ambient::create(){
    67       GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(ambientLight_);
    68       return Synchronisable::create();
     68        if (Settings::showsGraphics())
     69            GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(ambientLight_);
     70        return Synchronisable::create();
    6971    }
    70    
     72
    7173    void Ambient::registerAllVariables(){
    72       registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);
    73      
     74        registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);
     75
    7476    }
    7577
    7678    void Ambient::setAmbientLight(const ColourValue& colour)
    7779    {
    78         GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(colour);
    79       ambientLight_=colour;     
     80        if (Settings::showsGraphics())
     81            GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(colour);
     82        ambientLight_=colour;   
    8083    }
    8184
    8285    /**
    83         @brief XML loading and saving.
    84         @param xmlelement The XML-element
    85         @param loading Loading (true) or saving (false)
    86         @return The XML-element
     86    @brief
     87        XML loading and saving.
     88    @param
     89        xmlelement The XML-element
     90    @param
     91        loading Loading (true) or saving (false)
     92    @return
     93        The XML-element
    8794    */
    8895    void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode)
  • code/branches/gui/src/orxonox/objects/Skybox.cc

    r1653 r1694  
    3939#include "core/Debug.h"
    4040#include "core/XMLPort.h"
     41#include "Settings.h"
    4142
    4243namespace orxonox
     
    5657    void Skybox::setSkybox(const std::string& skyboxname)
    5758    {
    58         GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(true, skyboxname);
     59        if (Settings::showsGraphics())
     60            GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(true, skyboxname);
    5961    }
    6062
     
    9294    {
    9395        BaseObject::changedVisibility();
    94         GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_);
     96        if (Settings::showsGraphics())
     97            GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_);
    9598    }
    9699}
  • code/branches/gui/src/orxonox/objects/SpaceShip.cc

    r1625 r1694  
    4949
    5050#include "GraphicsEngine.h"
     51#include "Settings.h"
    5152#include "RotatingProjectile.h"
    5253#include "ParticleProjectile.h"
     
    193194    void SpaceShip::init()
    194195    {
    195         // START CREATING THRUSTERS
    196         this->tt1_ = new ParticleInterface("Orxonox/thruster1", LODParticle::low);
    197         this->tt1_->createNewEmitter();
    198         this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir());
    199         this->tt1_->getEmitter(0)->setPosition(Vector3(-15, 20, -1));
    200         this->tt1_->getEmitter(1)->setPosition(Vector3(-15, -20, -1));
    201         this->tt1_->setSpeedFactor(3.0);
    202 
    203         Ogre::SceneNode* node2a = this->getNode()->createChildSceneNode(this->getName() + "particle2a");
    204         node2a->setInheritScale(false);
    205         node2a->setScale(1, 1, 1);
    206         tt1_->addToSceneNode(node2a);
    207 
    208         this->tt2_ = new ParticleInterface("Orxonox/thruster2", LODParticle::normal);
    209         this->tt2_->createNewEmitter();
    210         this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0));
    211         this->tt2_->getEmitter(0)->setPosition(Vector3(-30, 40, -2));
    212         this->tt2_->getEmitter(1)->setPosition(Vector3(-30, -40, -2));
    213 
    214         Ogre::SceneNode* node2b = this->getNode()->createChildSceneNode(this->getName() + "particle2b");
    215         node2b->setInheritScale(false);
    216         node2b->setScale(0.5, 0.5, 0.5);
    217         tt2_->addToSceneNode(node2b);
    218 
    219         this->leftThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, -10, -0.5));
    220         this->rightThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, 10, -0.5));
    221 
    222         Ogre::SceneNode* node2c = this->getNode()->createChildSceneNode(this->getName() + "particle2c");
    223         node2c->setInheritScale(false);
    224         node2c->setScale(2, 2, 2);
    225         node2c->attachObject(this->leftThrusterFlare_.getBillboardSet());
    226         node2c->attachObject(this->rightThrusterFlare_.getBillboardSet());
    227         // END CREATING THRUSTERS
    228 
    229         // START CREATING BLINKING LIGHTS
    230         this->redBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
    231         this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1);
    232 
    233         this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.3, 4.0, -0.3));
    234         this->redNode_->setInheritScale(false);
    235         this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.3, -4.0, -0.3));
    236         this->greenNode_->setInheritScale(false);
    237 
    238         this->redNode_->attachObject(this->redBillboard_.getBillboardSet());
    239         this->redNode_->setScale(0.3, 0.3, 0.3);
    240 
    241         this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet());
    242         this->greenNode_->setScale(0.3, 0.3, 0.3);
    243         // END CREATING BLINKING LIGHTS
    244 
    245         // START CREATING ADDITIONAL EFFECTS
    246         this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
    247         this->attachObject(this->backlight_);
    248         this->backlight_->setPosition(-2.35, 0, 0.2);
    249         this->backlight_->setColour(this->getProjectileColour());
    250 
    251         this->smoke_ = new ParticleSpawner();
    252         this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
    253         this->attachObject(this->smoke_);
    254 
    255         this->fire_ = new ParticleSpawner();
    256         this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
    257         this->attachObject(this->fire_);
    258         // END CREATING ADDITIONAL EFFECTS
    259 
    260         if (this->isExactlyA(Class(SpaceShip)))
    261         {
    262             // START of testing crosshair
    263             this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
    264             this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
    265 
    266             this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
    267             this->chNearNode_->setInheritScale(false);
    268             this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
    269             this->chFarNode_->setInheritScale(false);
    270 
    271             this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
    272             this->chNearNode_->setScale(0.2, 0.2, 0.2);
    273 
    274             this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
    275             this->chFarNode_->setScale(0.4, 0.4, 0.4);
    276             // END of testing crosshair
     196        if (Settings::showsGraphics())
     197        {
     198            // START CREATING THRUSTERS
     199            this->tt1_ = new ParticleInterface("Orxonox/thruster1", LODParticle::low);
     200            this->tt1_->createNewEmitter();
     201            this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir());
     202            this->tt1_->getEmitter(0)->setPosition(Vector3(-15, 20, -1));
     203            this->tt1_->getEmitter(1)->setPosition(Vector3(-15, -20, -1));
     204            this->tt1_->setSpeedFactor(3.0);
     205
     206            Ogre::SceneNode* node2a = this->getNode()->createChildSceneNode(this->getName() + "particle2a");
     207            node2a->setInheritScale(false);
     208            node2a->setScale(1, 1, 1);
     209            tt1_->addToSceneNode(node2a);
     210
     211            this->tt2_ = new ParticleInterface("Orxonox/thruster2", LODParticle::normal);
     212            this->tt2_->createNewEmitter();
     213            this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0));
     214            this->tt2_->getEmitter(0)->setPosition(Vector3(-30, 40, -2));
     215            this->tt2_->getEmitter(1)->setPosition(Vector3(-30, -40, -2));
     216
     217            Ogre::SceneNode* node2b = this->getNode()->createChildSceneNode(this->getName() + "particle2b");
     218            node2b->setInheritScale(false);
     219            node2b->setScale(0.5, 0.5, 0.5);
     220            tt2_->addToSceneNode(node2b);
     221
     222            this->leftThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, -10, -0.5));
     223            this->rightThrusterFlare_.setBillboardSet("Flares/ThrusterFlare1", Vector3(-7.5, 10, -0.5));
     224
     225            Ogre::SceneNode* node2c = this->getNode()->createChildSceneNode(this->getName() + "particle2c");
     226            node2c->setInheritScale(false);
     227            node2c->setScale(2, 2, 2);
     228            node2c->attachObject(this->leftThrusterFlare_.getBillboardSet());
     229            node2c->attachObject(this->rightThrusterFlare_.getBillboardSet());
     230            // END CREATING THRUSTERS
     231
     232            // START CREATING BLINKING LIGHTS
     233            this->redBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
     234            this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1);
     235
     236            this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.3, 4.0, -0.3));
     237            this->redNode_->setInheritScale(false);
     238            this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.3, -4.0, -0.3));
     239            this->greenNode_->setInheritScale(false);
     240
     241            this->redNode_->attachObject(this->redBillboard_.getBillboardSet());
     242            this->redNode_->setScale(0.3, 0.3, 0.3);
     243
     244            this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet());
     245            this->greenNode_->setScale(0.3, 0.3, 0.3);
     246            // END CREATING BLINKING LIGHTS
     247
     248            // START CREATING ADDITIONAL EFFECTS
     249            this->backlight_ = new Backlight(this->maxSpeed_, 0.8);
     250            this->attachObject(this->backlight_);
     251            this->backlight_->setPosition(-2.35, 0, 0.2);
     252            this->backlight_->setColour(this->getProjectileColour());
     253
     254            this->smoke_ = new ParticleSpawner();
     255            this->smoke_->setParticle("Orxonox/smoke5", LODParticle::normal, 0, 0, 3);
     256            this->attachObject(this->smoke_);
     257
     258            this->fire_ = new ParticleSpawner();
     259            this->fire_->setParticle("Orxonox/fire3", LODParticle::normal, 0, 0, 1);
     260            this->attachObject(this->fire_);
     261            // END CREATING ADDITIONAL EFFECTS
     262
     263            if (this->isExactlyA(Class(SpaceShip)))
     264            {
     265                // START of testing crosshair
     266                this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
     267                this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
     268
     269                this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
     270                this->chNearNode_->setInheritScale(false);
     271                this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
     272                this->chFarNode_->setInheritScale(false);
     273
     274                this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
     275                this->chNearNode_->setScale(0.2, 0.2, 0.2);
     276
     277                this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
     278                this->chFarNode_->setScale(0.4, 0.4, 0.4);
     279                // END of testing crosshair
     280            }
    277281        }
    278282
     
    414418            this->cam_->tick(dt);
    415419
    416         if (this->smoke_)
    417             this->smoke_->setVisible(this->isVisible() && this->health_ < 40);
    418         if (this->fire_)
    419             this->fire_->setVisible(this->isVisible() && this->health_ < 20);
    420 
    421         if (this->backlight_)
    422         {   // (there's already fire ||                 we're to slow                 ||                  we're moving backwards                  )
    423             if (this->health_ < 20   || this->getVelocity().squaredLength() < 150*150 || this->getVelocity().dotProduct(this->getInitialDir()) < 0)
    424                 this->backlight_->setActive(false);
    425             else
    426                 this->backlight_->setActive(true);
    427         }
    428 
    429         if (this->redNode_ && this->greenNode_)
    430         {
    431             this->blinkTime_ += dt;
    432             float redScale = 0.15 + 0.15 * sin(this->blinkTime_ * 10.0);
    433             float greenScale = 0.15 - 0.15 * sin(this->blinkTime_ * 10.0);
    434             this->redNode_->setScale(redScale, redScale, redScale);
    435             this->greenNode_->setScale(greenScale, greenScale, greenScale);
     420        if (Settings::showsGraphics())
     421        {
     422            if (this->smoke_)
     423                this->smoke_->setVisible(this->isVisible() && this->health_ < 40);
     424            if (this->fire_)
     425                this->fire_->setVisible(this->isVisible() && this->health_ < 20);
     426
     427            if (this->backlight_)
     428            {   // (there's already fire ||                 we're to slow                 ||                  we're moving backwards                  )
     429                if (this->health_ < 20   || this->getVelocity().squaredLength() < 150*150 || this->getVelocity().dotProduct(this->getInitialDir()) < 0)
     430                    this->backlight_->setActive(false);
     431                else
     432                    this->backlight_->setActive(true);
     433            }
     434
     435            if (this->redNode_ && this->greenNode_)
     436            {
     437                this->blinkTime_ += dt;
     438                float redScale = 0.15 + 0.15 * sin(this->blinkTime_ * 10.0);
     439                float greenScale = 0.15 - 0.15 * sin(this->blinkTime_ * 10.0);
     440                this->redNode_->setScale(redScale, redScale, redScale);
     441                this->greenNode_->setScale(greenScale, greenScale, greenScale);
     442            }
    436443        }
    437444
  • code/branches/gui/src/orxonox/objects/SpaceShipAI.cc

    r1608 r1694  
    3939#include "core/XMLPort.h"
    4040#include "tools/ParticleInterface.h"
     41#include "Settings.h"
    4142
    4243#define ACTION_INTERVAL 1.0f
     
    102103            newenemy->XMLPort(xmlelement, XMLPort::LoadObject);
    103104
    104             ParticleSpawner* spawneffect = new ParticleSpawner("Orxonox/fairytwirl", LODParticle::normal, 2.0, 0, 0, newenemy->getOrth());
    105             spawneffect->setPosition(newenemy->getPosition() - newenemy->getOrth() * 50);
    106             spawneffect->create();
     105            if (Settings::showsGraphics())
     106            {
     107                ParticleSpawner* spawneffect = new ParticleSpawner("Orxonox/fairytwirl", LODParticle::normal, 2.0, 0, 0, newenemy->getOrth());
     108                spawneffect->setPosition(newenemy->getPosition() - newenemy->getOrth() * 50);
     109                spawneffect->create();
     110            }
    107111        }
    108112    }
     
    182186    void SpaceShipAI::kill()
    183187    {
    184         ParticleSpawner* explosion = new ParticleSpawner("Orxonox/BigExplosion1part1", LODParticle::low, 3.0);
    185         explosion->setPosition(this->getPosition());
    186         explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
    187         explosion->setScale(4);
    188         explosion->create();
    189 
    190         explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::normal, 3.0);
    191         explosion->setPosition(this->getPosition());
    192         explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
    193         explosion->setScale(4);
    194         explosion->create();
    195         explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::high, 3.0);
    196         explosion->setPosition(this->getPosition());
    197         explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
    198         explosion->setScale(4);
    199         explosion->create();
    200 
    201         Vector3 ringdirection = Vector3(rnd(), rnd(), rnd());
    202         ringdirection.normalise();
    203         explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::normal, 3.0, 0.5, 0, ringdirection);
    204         explosion->setPosition(this->getPosition());
    205         explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
    206         explosion->setScale(4);
    207         explosion->create();
    208         explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::high, 3.0, 0.5, 0, ringdirection);
    209         explosion->setPosition(this->getPosition());
    210         explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
    211         explosion->setScale(4);
    212         explosion->create();
     188        if (Settings::showsGraphics())
     189        {
     190            ParticleSpawner* explosion = new ParticleSpawner("Orxonox/BigExplosion1part1", LODParticle::low, 3.0);
     191            explosion->setPosition(this->getPosition());
     192            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
     193            explosion->setScale(4);
     194            explosion->create();
     195
     196            explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::normal, 3.0);
     197            explosion->setPosition(this->getPosition());
     198            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
     199            explosion->setScale(4);
     200            explosion->create();
     201            explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::high, 3.0);
     202            explosion->setPosition(this->getPosition());
     203            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
     204            explosion->setScale(4);
     205            explosion->create();
     206
     207            Vector3 ringdirection = Vector3(rnd(), rnd(), rnd());
     208            ringdirection.normalise();
     209            explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::normal, 3.0, 0.5, 0, ringdirection);
     210            explosion->setPosition(this->getPosition());
     211            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
     212            explosion->setScale(4);
     213            explosion->create();
     214            explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::high, 3.0, 0.5, 0, ringdirection);
     215            explosion->setPosition(this->getPosition());
     216            explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true);
     217            explosion->setScale(4);
     218            explosion->create();
     219        }
    213220
    214221        delete this;
  • code/branches/gui/src/orxonox/tools/Mesh.cc

    r1653 r1694  
    3131
    3232#include <sstream>
    33 
    3433#include <OgreSceneManager.h>
    35 
    3634#include "GraphicsEngine.h"
     35#include "Settings.h"
    3736
    3837namespace orxonox
     
    4948        std::ostringstream name;
    5049        name << (Mesh::meshCounter_s++);
    51         this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + name.str(), file);
     50        if (Settings::showsGraphics())
     51            this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + name.str(), file);
    5252    }
    5353
    5454    Mesh::~Mesh()
    5555    {
    56         if (this->entity_)
     56        if (this->entity_ && Settings::showsGraphics())
    5757            GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_);
    5858    }
  • code/branches/gui/visual_studio/vc8/orxonox.vcproj

    r1688 r1694  
    496496                                </File>
    497497                                <File
     498                                        RelativePath="..\..\src\orxonox\gamestates\GSDedicated.cc"
     499                                        >
     500                                </File>
     501                                <File
    498502                                        RelativePath="..\..\src\orxonox\gamestates\GSGraphics.cc"
    499503                                        >
     
    747751                                <File
    748752                                        RelativePath="..\..\src\orxonox\gamestates\GSClient.h"
     753                                        >
     754                                </File>
     755                                <File
     756                                        RelativePath="..\..\src\orxonox\gamestates\GSDedicated.h"
    749757                                        >
    750758                                </File>
Note: See TracChangeset for help on using the changeset viewer.