{"action":"created","issue":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13965","labels_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13965/labels{/name}","comments_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13965/comments","events_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13965/events","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/issues/13965","id":116036471,"number":13965,"title":"Broken weather generation","user":{"login":"tinoreo","id":15765848,"avatar_url":"https://avatars.githubusercontent.com/u/15765848?v=3","gravatar_id":"","url":"https://api.github.com/users/tinoreo","html_url":"https://github.com/tinoreo","followers_url":"https://api.github.com/users/tinoreo/followers","following_url":"https://api.github.com/users/tinoreo/following{/other_user}","gists_url":"https://api.github.com/users/tinoreo/gists{/gist_id}","starred_url":"https://api.github.com/users/tinoreo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tinoreo/subscriptions","organizations_url":"https://api.github.com/users/tinoreo/orgs","repos_url":"https://api.github.com/users/tinoreo/repos","events_url":"https://api.github.com/users/tinoreo/events{/privacy}","received_events_url":"https://api.github.com/users/tinoreo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-10T06:19:14Z","updated_at":"2015-11-10T17:09:23Z","closed_at":null,"body":"Weather generation seems to be broken in https://github.com/CleverRaven/Cataclysm-DDA/commit/16041b8b46820ca48f006bcfe07020392fc68cfb and newer.\r\nIt's always Flurries/Drizzle. No Perlin noise is generated, as you can see using «Display weather» tool in debug menu.\r\nSavefile: https://mega.nz/#!Q50ChCIS!I4i6aLNZUsVF-gkjJeGAucycxtWrpCubyeYBoQo9My4\r\nMirror: https://yadi.sk/d/saY3OOWNkM6ai\r\nPrevious versions handle it well, creating dynamic weather.\r\n\r\nI have tested different seed values in *.weather savefile.\r\nIf I change it to something like 10000, all works perfectly, but as it approaches to 100000000, non-drizzle areas become smaller and then disappear completely.\r\nMy build on GNU/Linux has MAX_RAND=2^31-1, so seed is nearly always greater than 100000000. Windows builds are not affected by this issue; it looks like they use MAX_RAND=2^15-1 and will never generate such seed. But if you load Linux-generated world in Windows client, you'll see the same constant Drizzle weather.\r\nTested on Debian 8 (g++ 4.9) curses and latest Windows curses/SDL builds from http://dev.narc.ro/cataclysm/jenkins-latest/Windows/\r\n\r\nSimple fix in game.cpp:\r\n```diff\r\n- weatherGen.set_seed( rand() )\r\n+ weatherGen.set_seed( rand() % 32767 )\r\n```\r\nI'm not sure if this is a good idea as I can't understand why large seed values was acceptable before this commit, but not after."},"comment":{"url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/comments/155489668","html_url":"https://github.com/CleverRaven/Cataclysm-DDA/issues/13965#issuecomment-155489668","issue_url":"https://api.github.com/repos/CleverRaven/Cataclysm-DDA/issues/13965","id":155489668,"user":{"login":"DanmakuDan","id":9610892,"avatar_url":"https://avatars.githubusercontent.com/u/9610892?v=3","gravatar_id":"","url":"https://api.github.com/users/DanmakuDan","html_url":"https://github.com/DanmakuDan","followers_url":"https://api.github.com/users/DanmakuDan/followers","following_url":"https://api.github.com/users/DanmakuDan/following{/other_user}","gists_url":"https://api.github.com/users/DanmakuDan/gists{/gist_id}","starred_url":"https://api.github.com/users/DanmakuDan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanmakuDan/subscriptions","organizations_url":"https://api.github.com/users/DanmakuDan/orgs","repos_url":"https://api.github.com/users/DanmakuDan/repos","events_url":"https://api.github.com/users/DanmakuDan/events{/privacy}","received_events_url":"https://api.github.com/users/DanmakuDan/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T17:09:23Z","updated_at":"2015-11-10T17:09:23Z","body":"Some of the algorithm treats the values in a way that looks scaled relative to the 4 different inputs it gets. The seed could be modded by 32k or scaled by RAND_MAX at the point of input to the noise function, but it would cause inconsistent weather behavior if the save is moved between different OS's."}}