question about out of sync errors
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.
question about out of sync errors
What is wrong in this code?
I have tested this many times.
When 1 player plays and one game side is under control of the "AI" - all works without any errors.
But when 2 players + 1 "AI" plays together, this code works without errors, but the second player always got the next out of sync error: unfound location for source of attack, when "AI" does 4-5 his turn and try to attack any enemy unit.
without this code, second player not receive out of sync, it means that problem is there.
I have tested this many times.
When 1 player plays and one game side is under control of the "AI" - all works without any errors.
But when 2 players + 1 "AI" plays together, this code works without errors, but the second player always got the next out of sync error: unfound location for source of attack, when "AI" does 4-5 his turn and try to attack any enemy unit.
Code: Select all
[event]
name=recruit
first_time_only=no
[store_side]
side=$side_number
variable=storedside
[/store_side]
[if]
[variable]
name=storedside.controller
contains="ai"
[/variable]
[then]
[object]
[filter]
#without this filter - the same error
x,y=$x1,$y1
[/filter]
silent=yes
[effect]
#any effect
[/effect]
[/object]
[/then]
[/if]
#without this clear - the same error
{CLEAR_VARIABLE storedside}
[/event]
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: question about out of sync errors
The controller attribute of sides is ambiguous.
E.g. if you have a mp game on the server with 2 human players and 1 ai, for player 1's (human, host) BfW instance:
side[1].controller -> "human"
side[2].controller -> "network"
side[3].controller -> "ai"
But for player 2's (human but no host) BfW instance:
side[1].controller -> "network"
side[2].controller -> "human"
side[3].controller -> "network"
And side 3 is a true ai.
wml events are executed simultaneously on each of the clients (instances) independently. Thus, if you base in your wml a decision on the value of side.controller, these wml events can get executed differently on the clients => OOS.
EDIT
Yes, it's currently actually this way. It can be tested by starting wesnoth with --debug and using the command line
lua wesnoth.message(wesnoth.sides[3].controller)
(and similar) since this code is then only executed on the client which types it. There is apparently supposed to be a value "NETWORK_AI" so I guess it may be a bug that side[3].controller doesn't shop up as network_ai for player 2 in the above (which would also allow you to detect whether side 3 is ai for the networked clients too).
E.g. if you have a mp game on the server with 2 human players and 1 ai, for player 1's (human, host) BfW instance:
side[1].controller -> "human"
side[2].controller -> "network"
side[3].controller -> "ai"
But for player 2's (human but no host) BfW instance:
side[1].controller -> "network"
side[2].controller -> "human"
side[3].controller -> "network"
And side 3 is a true ai.
wml events are executed simultaneously on each of the clients (instances) independently. Thus, if you base in your wml a decision on the value of side.controller, these wml events can get executed differently on the clients => OOS.
EDIT
Yes, it's currently actually this way. It can be tested by starting wesnoth with --debug and using the command line
lua wesnoth.message(wesnoth.sides[3].controller)
(and similar) since this code is then only executed on the client which types it. There is apparently supposed to be a value "NETWORK_AI" so I guess it may be a bug that side[3].controller doesn't shop up as network_ai for player 2 in the above (which would also allow you to detect whether side 3 is ai for the networked clients too).
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: question about out of sync errors
Can you offer any variant how to replace this check with similar sense but without oos in the network ?
Code: Select all
[if]
[variable]
name=storedside.controller
contains="ai"
[/variable]
[then]
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: question about out of sync errors
If what I guess is a bug would get fixed I guess you could add to that conditionmyav wrote:Can you offer any variant how to replace this check with similar sense but without oos in the network ?
Code: Select all
[if] [variable] name=storedside.controller contains="ai" [/variable] [then]
Code: Select all
[or]
[variable]
name=storedside.controller
equals=network_ai
#...
If you know for a side that it has allow_player=false you could exclude the case that it's a human.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Re: question about out of sync errors
Code: Select all
[or]
[variable]
name=storedside.controller
equals=network_ai
Why this code not works too ?
Spoiler:
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: question about out of sync errors
Of course, due to the bug.myav wrote:It hasn't helped, I have received oos again, because for second player, AI controller is not "network_ai", but: "network" (I have checked this with $variable| in the [message])Code: Select all
[or] [variable] name=storedside.controller equals=network_ai
Did you understand my previous post ?
BfW does not even know about which side is an ai, you cannot detect this in wml.
Anyway, the usage of an ai turn event is a mistake. It's neither synced nor does it fire in replays: http://wiki.wesnoth.org/EventWML
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: question about out of sync errors
If the hosting player controls also side 4 thenAnonymissimus wrote:E.g. if you have a mp game on the server with 2 human players and 1 ai, for player 1's (human, host) BfW instance:
side[1].controller -> "human"
side[2].controller -> "network"
side[3].controller -> "ai"
side[4].controller -> "human"
But what happens if side 5 is another local player on same computer? Is he detected as "human" too? If so then WML can't reliably detect sides controlled by a player.
-----------------------
edit: a related info is here: A way how to limit [scroll_to] to a side?
Last edited by SlowThinker on December 15th, 2011, 7:05 pm, edited 1 time in total.
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: question about out of sync errors
I don't understand that.SlowThinker wrote:But what happens if side 5 is another local player on same computer? Is he detected as "human" too? If so then WML can't reliably detect sides controlled by a player.
What do you think the controller should be ? Are the 2 persons using the same BfW instance ?
And if they are, how could BfW possibly know that it is not the same person who makes the actions for all 3 sides ?
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
-
- Posts: 876
- Joined: November 28th, 2008, 6:18 pm
Re: question about out of sync errors
I tempted to think the option 'local player' in the lobby informed BfW that the hotseat was used. You think there is no real difference between 'SlowThinker' and 'local player'?
So you think every side on the same BfW instance is "human", even if they are in different teams?
So you think every side on the same BfW instance is "human", even if they are in different teams?
I work on Conquest Minus • I use DFoolWide, Retro Terrain Package and the add-on 'High Contrast Water'
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
I moved to Nosebane's corner (Doc Paterson's signature); I am spending my time there, so PM me if I don't answer your post in forums
-
- Inactive Developer
- Posts: 2461
- Joined: August 15th, 2008, 8:46 pm
- Location: Germany
Re: question about out of sync errors
I suggest you do what I'm describing above in BfW 1.9.8 to know what the controllers are in certain various game setups so you can answer your question yourself:
If you know how to do that it's very good for muplitplayer development in general. You can pass command line parameters in windows (for instance) by using a link to the program executable and adding the parameter in the target line in the link's properties.Anonymissimus wrote:It can be tested by starting wesnoth with --debug and using the command line
lua wesnoth.message(wesnoth.sides[3].controller)
(and similar) since this code is then only executed on the client which types it. There is apparently supposed to be a value "NETWORK_AI" so I guess it may be a bug that side[3].controller doesn't shop up as network_ai for player 2 in the above (which would also allow you to detect whether side 3 is ai for the networked clients too).
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
A Simple Campaign: campaign draft for wml starters • Plan Your Advancements: mp mod
The Earth's Gut: sp campaign • Settlers of Wesnoth: mp scenario • Wesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
- Pentarctagon
- Project Manager
- Posts: 5730
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: question about out of sync errors
Moved to the correct forum.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code