non MP-safe WML
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
non MP-safe WML
The folowing functions are known to possibly cause Out of Sync errors in multiplayer :
*) Random
[variable]
name=var
random=1..X
[variable]
(Usually via the {RANDOM 1..X} macro)
You can get a pseudorandom replacement macro here, but this will not work before turn 2
*) Random_traits=yes
[unit]
type=Peasant
side=1
x=5
y=5
random_traits=yes
[/unit]
In general everything that uses randomness is evaluated with possibly different values on each computer of a multiplayer games. If this affect terrain, stats or the scenario itself it can cause Out of Sync errors.
So avoid thoses things if you make a multiplayer scenario.
*) Custom units
[units] don't travel across the network so unless you get all the player to download the same version :
- units with modified stats will have differents stats for every players if they don't have the same version ... => This can cause OOS because of the stats mismatch.
- new custom units won't be found if the player did not install it => They won't be able to play because the unit is missing.
*) Random
[variable]
name=var
random=1..X
[variable]
(Usually via the {RANDOM 1..X} macro)
You can get a pseudorandom replacement macro here, but this will not work before turn 2
*) Random_traits=yes
[unit]
type=Peasant
side=1
x=5
y=5
random_traits=yes
[/unit]
In general everything that uses randomness is evaluated with possibly different values on each computer of a multiplayer games. If this affect terrain, stats or the scenario itself it can cause Out of Sync errors.
So avoid thoses things if you make a multiplayer scenario.
*) Custom units
[units] don't travel across the network so unless you get all the player to download the same version :
- units with modified stats will have differents stats for every players if they don't have the same version ... => This can cause OOS because of the stats mismatch.
- new custom units won't be found if the player did not install it => They won't be able to play because the unit is missing.
Last edited by Noyga on February 21st, 2006, 2:54 am, edited 2 times in total.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Re: non MP-safe WML
Correction: It will work after a fasion, butNoyga wrote:but this will not work before turn 2
I, on the PSEUDORANDOM page, wrote:PSEUDORANDOM will give the same sequence each game if you don't use the macro {GENERIC_PSEUDORANDOM_INIT} (it goes straight in your [multiplayer] tag). It will still give identical sequences when you use it before turn 2 starts.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Also - [+units] don't travel across the network, you can't use custom units in MP. (unless you get all players to download them)
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
Also, having any options in a multiplayer start or turn event message will cause OOS (since different players may select different options). Thanks to Roze/Flamie for pointing this one out.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Re: non MP-safe WML
I think that the 'random' function doesn't cause OoS if it is called in a prestart event. It didn't cause any problems for me in neither hotseat mode nor the actual network game. I'm glad about it!Noyga wrote:*) Random
[variable]
name=var
random=1..X
[variable]
(Usually via the {RANDOM 1..X} macro)
You can get a pseudorandom replacement macro here, but this will not work before turn 2
Random function did cause OOS errors for me even when used in a prestart event. Hm.
I also cannot change the canrecruit status of a unit during a side turn event - it causes massive oos because the other clients don't think the unit can recruit. Is there any other event which would allow a change of canrecruit?
I also cannot change the canrecruit status of a unit during a side turn event - it causes massive oos because the other clients don't think the unit can recruit. Is there any other event which would allow a change of canrecruit?
Try some Multiplayer Scenarios / Campaigns
After all it did cause it for me too...Rhuvaen wrote:Random function did cause OOS errors for me even when used in a prestart event. Hm.
I only thought that the OOS would have appeared when the random-function was executed. Instead it appeared, when the unit that was created by using the random-function attacked another unit.
Right.zookeeper wrote:That's when the games go out of sync. It's just not detected until you actually do something with the unit (in this case, attacking).deserter wrote:I only thought that the OOS would have appeared when the random-function was executed.
BTW, Why is the random-function causing OOS errors?
Does each client generate it's own version of the variable or something? (which should be the same variable for every client, but instead each client has it's own random variable)
Just a guess, I know next to nothing about coding.
If this, however, was the reason, couldn't the server generate the variable for all the clients? Where does the RNG get the numbers to determine hits and misses and why doesn't it cause the OOS error?
Two more:
[story] tags don't show across the network (only the host will see 'em).
Select events fire only for the particular client and cause OOS if they affect game-relevant data.
[story] tags don't show across the network (only the host will see 'em).
Select events fire only for the particular client and cause OOS if they affect game-relevant data.
Try some Multiplayer Scenarios / Campaigns
For the record, have any of these been fixed in the new, stable 1.2?
Try some Multiplayer Scenarios / Campaigns