Hi all,

I would like to talk with you about a thought about time handling in Wormux. I 
think we need to synchronize time each time we receive a new action. It's quite 
easy doing it as we receive the timestamp each time we execute an action. 
Something like :

void ActionHandler::ExecActions()
{
  assert(mutex!=NULL);
  while (queue.size() != 0)
  {
    SDL_LockMutex(mutex);
    Action *action = queue.front();
    // If action is in the future, wait for next refresh
    if(action->GetTimestamp() > Time::GetInstance()->Read()) {
      SDL_UnlockMutex(mutex);
+      return; // Maybe continue instead ?
    }
    // Synchronize game with time receive in action to avoid desync.
+    Time::GetInstance()->SetTimestamp(action->GetTimestamp());
    queue.pop_front();
    SDL_UnlockMutex(mutex);
    Exec (action);
    delete action;
  }
}

It's shall introduce some drawback (in particle handling for example) but I 
think it's the only solution if we want to be sure that every player on the 
internet execute the action with the same context at the same time. As a simple 
solution, I think we may need to introduce another call in Time class for time 
in particle not sync with other players.

I would like some feedback about this idea and if it sounds crazy or not.

Regards,

Drayan


=======================================================

Ce message et toutes les pieces jointes (ci-apres le "message") 
sont confidentiels et etablis a l'intention exclusive de ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite. 
Tout message electronique est susceptible d'alteration. 
La SOCIETE GENERALE et ses filiales declinent toute responsabilite
au titre de ce message s'il a ete altere, deforme ou falsifie.
                                 
=======================================================

This message and any attachments (the "message") are confidential
and intended solely for the addressees.
Any unauthorized use or dissemination is prohibited. 
E-mails are susceptible to alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates
shall be liable for the message if altered, changed or falsified. 

=======================================================

_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à