-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix world DSL coordinate bug #1988
Conversation
dcd2539
to
04e5bd8
Compare
There are actually a few scenarios that use
shows
In fact I do recall some bewilderment about the horizontal and vertical directions while authoring |
@kostmo Oh, right, of course! I just observed that all the tests still passed and assumed that meant nothing was using them. I'll go through and fix these up so the worlds look the same as before. |
@kostmo should be all fixed up now! |
It turns out that the `hash` primitive was always computing the same deterministic hash of the coordinates regardless of the seed. This meant that *e.g.* any world features placed in a way that depended on the hash were always in the same locations, and if you created a world that only relied on `hash` and not on, say, Perlin noise, it would always look the same regardless of the seed. This does not seem desirable. This PR fixes the DSL interpreter by passing the seed to the `murmur3` hash function (we used to always pass the constant seed 0). In theory, this does mean that all the "classic" worlds are now slightly different than what they used to be (except for seed 0). However, there's no way to tell the difference between one random placement and another. The only scenario where we really depend on the particular locations of entities for a particular seed is the `world101` tutorial, but that used seed 0 anyway, which did not change. Depends on merging #1988 first.
The special variables
x
andy
in the world DSL did not refer to the correct thing --- in the interpreter apparently I forgot to convert fromCoords
toLocation
and just used the row, column inCoords
as thex
andy
. I have also fixed up all the scenarios which usedx
andy
in their world description so that they now look identical to before, by replacing every use ofx
with-y
and every use ofy
withx
(though in some cases where the result would be algebraically equal I did not literally do this replacement, e.g.(x + y) % 2
is equal to((-y) + x) % 2
, so I left it alone).