non MP-safe WML

The place to post your WML questions and answers.

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.
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

non MP-safe WML

Post by Noyga »

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.
Last edited by Noyga on February 21st, 2006, 2:54 am, edited 2 times in total.
User avatar
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

Post by Elvish_Pillager »

Noyga wrote:but this will not work before turn 2
Correction: It will work after a fasion, but
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.
Boucman
Inactive Developer
Posts: 2119
Joined: March 31st, 2004, 1:04 pm

Post by Boucman »

these should be filled as bug if it's not already done, thx for the list
Fight key loggers: write some perl using vim
User avatar
Elvish_Pillager
Posts: 8137
Joined: May 28th, 2004, 10:21 am
Location: Everywhere you think, nowhere you can possibly imagine.
Contact:

Post by Elvish_Pillager »

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.
User avatar
Noyga
Inactive Developer
Posts: 1790
Joined: September 26th, 2005, 5:56 pm
Location: France

Post by Noyga »

Thank you, i did not think about [units].
I updated the first post.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

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."
deserter
Art Contributor
Posts: 291
Joined: September 12th, 2005, 9:48 am
Location: Finland

Re: non MP-safe WML

Post by deserter »

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
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! :)
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

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?
deserter
Art Contributor
Posts: 291
Joined: September 12th, 2005, 9:48 am
Location: Finland

Post by deserter »

Rhuvaen wrote:Random function did cause OOS errors for me even when used in a prestart event. Hm.
After all it did cause it for me too...

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.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

deserter wrote:I only thought that the OOS would have appeared when the random-function was executed.
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
Art Contributor
Posts: 291
Joined: September 12th, 2005, 9:48 am
Location: Finland

Post by deserter »

zookeeper wrote:
deserter wrote:I only thought that the OOS would have appeared when the random-function was executed.
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).
Right. :)

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?
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

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.
qk
Inactive Developer
Posts: 57
Joined: September 4th, 2006, 5:47 pm
Location: Prague, CZ
Contact:

Post by qk »

events in era doesn`t work in MP. I must fix it :oops:
User avatar
Baufo
Inactive Developer
Posts: 1115
Joined: January 29th, 2006, 4:53 pm
Location: Vienna, Austria

Post by Baufo »

Just for the record, random variables will work in 1.3.
I was working on the proof of one of my poems all the morning, and took out a comma. In the afternoon I put it back again. -- Oscar Wilde
Rhuvaen
Inactive Developer
Posts: 1272
Joined: August 27th, 2004, 8:05 am
Location: Berlin, Germany

Post by Rhuvaen »

For the record, have any of these been fixed in the new, stable 1.2? :)
Post Reply