Hi! I think rewinding the clock is not a good idea.. It would introduce problems if the status of an object change while we rewind the clock, or we would need to monitor every event and provide methods to revert them. For example: t=0 : we get an action_jump with a time stamp (ts) = 0 ->the character jump t=1 : the character is floating in the air during the jump t=2 : the character reach the ground t=3 : we receive an action shoot with a ts = 1 -> if we revert the clock we need a way u put the character back in the air
To handle this, I think the playing computer should sent events to validate how much time have passed on his computer. This will introduce a bit of lag on distant computer, but that will happen mostly only at the beginning of its turn ! Lodesi On Fri, Nov 17, 2006 at 11:30:25AM +0100, PERRE Y SiseProIsaTig wrote: > 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 -- _______________________________________________ Wormux-dev mailing list Wormux-dev@gna.org https://mail.gna.org/listinfo/wormux-dev