Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1200


Ignore:
Timestamp:
Apr 28, 2008, 11:39:23 PM (17 years ago)
Author:
scheusso
Message:

we have compression enabled and working now, hurray

Location:
code/branches/network3/src/network
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network3/src/network/GameStateClient.cc

    r1199 r1200  
    133133          orxonox::Identifier* id = ID((unsigned int)sync.classID);
    134134          if(!id){
    135             COUT(4) << "We could not identify a new object" << std::endl;
     135            COUT(4) << "We could not identify a new object; classid: " << sync.classID << std::endl;
    136136            continue;
    137137          }
     
    192192    r->id = diff->id;
    193193    r->size = dest_length;
    194     r->base_id = diff->base_id;
     194    r->base_id = old->id;
    195195    r->diffed = false;
    196196    r->data = dp;
     
    236236    gamestate->size = normsize;
    237237    gamestate->data = dest;
     238    gamestate->base_id = a->base_id;
    238239    gamestate->diffed = a->diffed;
    239240
     
    252253
    253254  GameState *GameStateClient::decode(GameStateCompressed *x) {
    254     //GameState *t = decompress(x);
    255     GameState *t = new GameState;
     255    GameState *t = decompress(x);
     256    /*GameState *t = new GameState;
    256257    t->base_id = x->base_id;
    257258    t->id = x->id;
    258259    t->diffed = x->diffed;
    259260    t->data = x->data;
    260     t->size = x->normsize;
     261    t->size = x->normsize;*/
    261262    return t;
    262263  }
  • code/branches/network3/src/network/GameStateManager.cc

    r1199 r1200  
    7979    std::map<int,int>::iterator it = gameStateUsed.begin();
    8080    while(it!=gameStateUsed.end()){
     81      if((id_-(*it).first)<KEEP_GAMESTATES)
     82        break;
    8183      if( (*it).second <= 0 ){
    8284        COUT(4) << "GameStateManager: deleting gamestate with id: " << (*it).first << ", uses: " << (*it).second << std::endl;
     
    8688        gameStateUsed.erase(it++);
    8789        continue;
    88       }else if(id_-it->first<=KEEP_GAMESTATES){  //as soon as we got a used gamestate break here because we could use newer gamestates in future but only if we do not exceed KEEP_GAMESTATES # of gamestates in cache
     90      }/*else if(id_-it->first<=KEEP_GAMESTATES){  //as soon as we got a used gamestate break here because we could use newer gamestates in future but only if we do not exceed KEEP_GAMESTATES # of gamestates in cache
    8991        COUT(4) << "breaking " << std::endl;
    9092        break;
    91       }
     93      }*/
    9294      it++;
    9395    }
     
    114116      COUT(4) << "we got a GAMESTATEID_INITIAL for clientID: " << clientID << std::endl;
    115117      GameState *server = reference;
    116       ackGameState(clientID, reference->id);
     118//       ackGameState(clientID, reference->id);
    117119      //head_->findClient(clientID)->setGamestateID(id);
    118120      return encode(server);
     
    203205
    204206  GameStateCompressed *GameStateManager::encode(GameState *a, GameState *b) {
    205     COUT(5) << "G.St.Man: this will be a DIFFED gamestate" << std::endl;
     207    COUT(4) << "G.St.Man: this will be a DIFFED gamestate" << std::endl;
    206208    GameState *r = diff(a,b);
    207     //r.diffed = true;
     209//     r->diffed = true;
    208210//     GameState *r = b;
    209211//     r->diffed = false;
    210     //return compress_(r);
    211     GameStateCompressed *g = new GameStateCompressed;
     212    return compress_(r);
     213    /*GameStateCompressed *g = new GameStateCompressed;
    212214    g->base_id = r->base_id;
    213215    g->id = r->id;
     
    216218    g->normsize = r->size;
    217219    g->compsize = r->size;
    218     return g;
     220    return g*/;
    219221  }
    220222
    221223  GameStateCompressed *GameStateManager::encode(GameState *a) {
    222     COUT(5) << "G.St.Man: this will be a not diffed gamestate" << std::endl;
    223     a->diffed=false;
    224     GameStateCompressed *g = new GameStateCompressed;
     224    COUT(5) << "G.St.Man: encoding gamestate (compress)" << std::endl;
     225    return compress_(a);
     226    /*GameStateCompressed *g = new GameStateCompressed;
    225227    g->base_id = a->base_id;
    226228    g->id = a->id;
     
    229231    g->normsize = a->size;
    230232    g->compsize = a->size;
    231     return g;
     233    return g;*/
    232234  }
    233235
  • code/branches/network3/src/network/GameStateManager.h

    r1199 r1200  
    5050{
    5151
    52 #define KEEP_GAMESTATES 100
     52#define KEEP_GAMESTATES 10
    5353
    5454  /**
Note: See TracChangeset for help on using the changeset viewer.