Hi! As most of you have noticed the network code is a real pain to maintain. It's too intrusive, complicated and new network bugs are easily added if we are not careful enough. The main network code asserts that any events will have the same effect on each computer, but in fact it doesn't works because most of the code depends on the FPS rate ! For instance, the physic engine tries to be fps independant by computing new parameters each 20ms ... but it fails as soon as a collision with the ground happen.. That's the reason why there is some code that refresh the position of each character at the end of each turn, or during explosions. Key refresh events can't be treated as events in the network code as their effect depends on the FPS rate. It leads to the need of network specific code to handle weapon shoots (for weapons using the strength bar) and more specific code for the jetpack, supertux and the worst one, the ninja-rope. Another big problem is caused because events don't happen at the same time on the computer currently playing, and on distant computers. For example if we throw a dynamite when we are jumping, the elapsed time between the jump and the shoot events won't be the same on all computers. Same kinds of problems happens during 2 moving objects collisions, or when the turn ends at slightly different times (see bug #7248:after turn-end you can control other team)
I propose we solve those issues with 2 modifications : - Run the game loop at a constant rate by refreshing the main clock (the Time class) at a constant rate, instead of having the physic engine do it. This way we are sure the behaviour is the same on every computer and it would also allow big simplification in the physic engine, as it removes the need to use differential equation.. - Send actions with a time stamp so we can replay them exactly like they was generated, and it's also a first step to have replay at the end of the turn.. So, what do you think about it ? Thanks for reading. Lodesi -- _______________________________________________ Wormux-dev mailing list Wormux-dev@gna.org https://mail.gna.org/listinfo/wormux-dev