Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 459


Ignore:
Timestamp:
Dec 12, 2007, 12:35:52 AM (16 years ago)
Author:
scheusso
Message:

preparing clone mode for game (one server steers, all clients view ;) )

Location:
code/branches/FICN/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/Client.cc

    r448 r459  
    151151   * Performs a GameState update
    152152   */
    153   void Client::update(){
     153  void Client::tick(float time){
    154154    ENetPacket *packet;
    155155    // stop if the packet queue is empty
  • code/branches/FICN/src/network/Client.h

    r438 r459  
    2020#include "GameStateClient.h"
    2121#include "orxonox/core/IdentifierIncludes.h"
     22//#include "NetworkFrameListener.h"
    2223
    2324
    2425namespace network{
    2526
     27
     28 
    2629/**
     30  network::Client *client;
    2731 * The network/Client class
    2832 * This class implements all necessary function for the network communication
     
    4852  bool sendPackets();
    4953 
    50   void update();
     54  void tick(float time);
    5155
    5256  private:
     
    6266};
    6367
     68
    6469}
    6570
  • code/branches/FICN/src/network/Server.cc

    r444 r459  
    9595   * Run this function once every tick
    9696   * calls processQueue and updateGamestate
     97   * @param time time since last tick
    9798   */
    98   void Server::tick(){
     99  void Server::tick(float time){
    99100    processQueue();
    100101    updateGamestate();
  • code/branches/FICN/src/network/Server.h

    r440 r459  
    2121#include "enet/enet.h"
    2222#include "ClientInformation.h"
     23//#include "NetworkFrameListener.h"
     24
    2325
    2426namespace network{
    2527
     28 
    2629  /**
    2730   * This class is the root class of the network module for a server.
     
    3740    bool sendMSG(std::string msg);
    3841    bool sendMSG(const char *msg);
    39     void tick();
     42    void tick(float time);
    4043    protected:
    4144    void processQueue();
     
    4952    ClientInformation *clients;
    5053  };
    51 
    52 
     54 
    5355
    5456
  • code/branches/FICN/src/network/Synchronisable.h

    r346 r459  
    1717
    1818#include "orxonox/core/IdentifierIncludes.h"
     19#include "orxonox/core/OrxonoxClass.h"
    1920
    2021namespace network {
     
    3940 * @author Oliver Scheuss
    4041*/
    41 class Synchronisable{
     42class Synchronisable : public orxonox::OrxonoxClass{
    4243public:
    4344  Synchronisable();
  • code/branches/FICN/src/network/dummyclient3.cc

    r448 r459  
    2323
    2424  while (true) {
    25           client.update();
     25          client.tick(0);
    2626          std::cout << "your message: ";
    2727          std::getline( std::cin, str );
     
    5050
    5151  while (true) {
    52           client.update();
     52          client.tick(0);
    5353          usleep(100);
    5454  }
  • code/branches/FICN/src/orxonox/orxonox.cc

    r458 r459  
    5757
    5858audio::AudioManager* auMan;
     59
     60//network stuff
     61//#include "network/Server.h"
     62//#include "network/Client.h"
     63#include "network/NetworkFrameListener.h"
    5964
    6065// some tests to see if enet works without includsion
     
    194199      void go()
    195200      {
     201        if(function==0)
     202          standalone();
     203        else if(function==1)
     204          server();
     205        else
     206          client();
     207      }
     208     
     209      OrxApplication(int func){
     210        function = func;
     211      }
     212      OrxApplication(){
     213        function = 0;
     214      }
     215
     216      ~OrxApplication()
     217      {
     218        mInputManager->destroyInputObject(mKeyboard);
     219        OIS::InputManager::destroyInputSystem(mInputManager);
     220
     221//        delete mRenderer;
     222//        delete mSystem;
     223
     224//         delete mListener;
     225//         delete mRoot;
     226      }
     227
     228    private:
     229      Ogre::Root *mRoot;
     230      OIS::Keyboard *mKeyboard;
     231      OIS::Mouse *mMouse;
     232      OIS::InputManager *mInputManager;
     233      //CEGUI::OgreCEGUIRenderer *mRenderer;
     234      //CEGUI::System *mSystem;
     235      OrxExitListener *mListener;
     236      int function; // 0 for standalone, 1 for server, 2 for client
     237
     238      void client()
     239      {
     240       client_g = new network::Client(); // address here
     241        mRoot->addFrameListener(new network::ClientFrameListener());
    196242        createRoot();
    197243        defineResources();
     
    202248        setupScene();
    203249        setupInputSystem();
    204 //         setupCEGUI();
     250//        setupCEGUI();
    205251        createFrameListener();
    206252        startRenderLoop();
    207253      }
    208 
    209       ~OrxApplication()
    210       {
    211         mInputManager->destroyInputObject(mKeyboard);
    212         OIS::InputManager::destroyInputSystem(mInputManager);
    213 
    214 //        delete mRenderer;
    215 //        delete mSystem;
    216 
    217 //         delete mListener;
    218 //         delete mRoot;
    219       }
    220 
    221     private:
    222       Ogre::Root *mRoot;
    223       OIS::Keyboard *mKeyboard;
    224       OIS::Mouse *mMouse;
    225       OIS::InputManager *mInputManager;
    226       //CEGUI::OgreCEGUIRenderer *mRenderer;
    227       //CEGUI::System *mSystem;
    228       OrxExitListener *mListener;
    229 
     254      void server()
     255      {
     256        server_g = new network::Server(); // add some settings if wanted
     257        mRoot->addFrameListener(new network::ServerFrameListener());
     258        createRoot();
     259        defineResources();
     260        setupRenderSystem();
     261        createRenderWindow();
     262        initializeResourceGroups();
     263        createScene();
     264        setupScene();
     265        //setupInputSystem();
     266        //setupCEGUI();
     267        //createFrameListener();
     268        //startRenderLoop();
     269      }
     270      void standalone()
     271      {
     272        createRoot();
     273        defineResources();
     274        setupRenderSystem();
     275        createRenderWindow();
     276        initializeResourceGroups();
     277        createScene();
     278        setupScene();
     279        setupInputSystem();
     280        setupCEGUI();
     281        createFrameListener();
     282        startRenderLoop();
     283      }
     284     
    230285      void createRoot()
    231286      {
     
    377432      mRoot->addFrameListener(mListener);
    378433    }
    379       void startRenderLoop()
    380       {
    381         mRoot->startRendering();
    382       }
     434    void startRenderLoop()
     435    {
     436      mRoot->startRendering();
     437    }
    383438  };
    384439}
     
    397452  try
    398453  {
    399     orxonox::OrxApplication orxonox;
    400     orxonox.go();
     454    if(argc >=2 && strcmp(argv[1], "server")==0){
     455      orxonox::OrxApplication orxonox(1);
     456      orxonox.go();
     457    }
     458    else if(argc >=2 && strcmp(argv[1], "client")==0){
     459      orxonox::OrxApplication orxonox(2);
     460      orxonox.go();
     461    }
     462    else{
     463      orxonox::OrxApplication orxonox(0);
     464      orxonox.go();
     465    }
    401466  }
    402467  catch(Exception& e)
Note: See TracChangeset for help on using the changeset viewer.