Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-12 Thread Notabilis
I compiled the game revision of the other bug report with the changes of this 
branch applied and it indeed seems to fix the issues there.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-12 Thread noreply
The proposal to merge lp:~widelands-dev/widelands/bug-1811030-desync-ai into 
lp:widelands has been updated.

Status: Needs review => Merged

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
-- 
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-12 Thread Klaus Halfmann
as travis had only unrelated Issues with OSX / homebrew:

@bunnybot merge force

kapputnik: that savegame from #1800366 shoud be to old,
but it smells just like thes situation I had.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-12 Thread bunnybot
Refusing to merge, since Travis is not green. Use @bunnybot merge force for 
merging anyways.

Travis build 4391. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/478537625.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-12 Thread kaputtnik
Notabilis, is this bug maybe also fixed with this branch?

https://bugs.launchpad.net/widelands/+bug/1800366
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-12 Thread Klaus Halfmann
Review: Approve compile test

Tested this now, Notabilis hint was 100% correct, I got a desync right at the 
start.

This can go in.

@bunnybot merge
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-12 Thread kaputtnik
I am compiling this branch. Klaus, i will try to be in the lobby the next days.

Playing the map 'Crossing the Horizon' may speed up testing.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-11 Thread Notabilis
You should be able to test it with the savegame attached to the linked bug 
report. With trunk, the savegame desyncs immediately. With this branch you can 
continue playing. I tested it with two widelands instances running on my 
system, so no second computer/human should be required for testing.

If trying to reproduce the desync in a new game you have to wait until the AI 
starts expeditions, which might take some time.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-11 Thread Klaus Halfmann
Review: Approve review

That code looks perfectly clear and should fix the bug.

Nonetheless I will try to reproduce it in the next days.
So this requires a Network game with at least two Humans and one AI player.
Anyone else with that branch on Disk?

Travis has only problems on OSX with homebrew, as I am compiling on OSX
using MacPorts I will verify OSX, too.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is subscribed to branch 
lp:~widelands-dev/widelands/bug-1811030-desync-ai.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-11 Thread bunnybot
Continuous integration builds have changed state:

Travis build 4391. State: errored. Details: 
https://travis-ci.org/widelands/widelands/builds/478537625.
Appveyor build 4182. State: success. Details: 
https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1811030_desync_ai-4182.
-- 
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands.

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp


[Widelands-dev] [Merge] lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands

2019-01-11 Thread Notabilis
Notabilis has proposed merging 
lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands.

Commit message:
Replacing logic_rand() with std::rand() in seafaring code of AI.
Should fix desyncs while network gaming.


Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1811030-desync-ai/+merge/361689

Calls of logic_rand() have to be done on all participants of a network game. 
Since the AI code is only executed on the host, calling logic_rand() leads to 
different random numbers on the participants computers later on, resulting in 
desynchronized games.
-- 
Your team Widelands Developers is requested to review the proposed merge of 
lp:~widelands-dev/widelands/bug-1811030-desync-ai into lp:widelands.
=== modified file 'src/ai/defaultai_seafaring.cc'
--- src/ai/defaultai_seafaring.cc	2018-09-04 15:48:47 +
+++ src/ai/defaultai_seafaring.cc	2019-01-11 21:07:24 +
@@ -455,7 +455,7 @@
 }
 
 Widelands::IslandExploreDirection DefaultAI::randomExploreDirection() {
-	return game().logic_rand() % 20 < 10 ? Widelands::IslandExploreDirection::kClockwise :
+	return std::rand() % 20 < 10 ? Widelands::IslandExploreDirection::kClockwise :
 	   Widelands::IslandExploreDirection::kCounterClockwise;
 }
 
@@ -486,7 +486,7 @@
 		spot_score);
 
 		// we make a decision based on the score value and random
-		if (game().logic_rand() % 8 < spot_score) {
+		if (std::rand() % 8 < spot_score) {
 			// we build a port here
 			game().send_player_ship_construct_port(*so.ship, so.ship->exp_port_spaces().front());
 			so.last_command_time = gametime;
@@ -579,15 +579,15 @@
 	assert(possible_directions.size() >= new_teritory_directions.size());
 
 	// If only open sea (no unexplored sea) is found, we don't always divert the ship
-	if (new_teritory_directions.empty() && game().logic_rand() % 100 < 80) {
+	if (new_teritory_directions.empty() && std::rand() % 100 < 80) {
 		return false;
 	}
 
 	if (!possible_directions.empty() || !new_teritory_directions.empty()) {
 		const Direction direction =
 		   !new_teritory_directions.empty() ?
-		  new_teritory_directions.at(game().logic_rand() % new_teritory_directions.size()) :
-		  possible_directions.at(game().logic_rand() % possible_directions.size());
+		  new_teritory_directions.at(std::rand() % new_teritory_directions.size()) :
+		  possible_directions.at(std::rand() % possible_directions.size());
 		game().send_player_ship_scouting_direction(*so.ship, static_cast(direction));
 
 		log("%d: %s: exploration - breaking for %s sea, dir=%u\n", pn,

___
Mailing list: https://launchpad.net/~widelands-dev
Post to : widelands-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~widelands-dev
More help   : https://help.launchpad.net/ListHelp