Page 1 of 1

Fixed Seed instead of RNG - Need Help

Posted: Thu Aug 11, 2016 3:06 pm
by Bourne
Hi,

I used to play this game a lot and just realized nvs was helping develop a new open-source version.

For a long time, I've been curious what a "perfect" run would look like. That is, fixing the RNG so the best possible gems were acquired every round (i.e. Malachite lvl1, Spell slate lvl 5, Elder slate lvl 6, Bryvx gem level 20, etc.).

I'd be keen on trying to code this myself, but I've looked through the source and have some trouble understanding everything. As it appears, almost the entire game is written in gem-3_1.j, but the code is very hard to understand as it's extremely long and function names aren't intuitive, etc.

Would anyone with a better understanding of the code be able to help me out with this?

Many thanks,

-Jason

Re: Fixed Seed instead of RNG - Need Help

Posted: Fri Aug 12, 2016 12:04 am
by nvs
The best advice I can give you is to look at the `src/main.j` file, and use that as a table of contents of sorts. Once you look there and understand that most of the existing code base was generated using GUI triggers, things make a bit more sense.

Re: Fixed Seed instead of RNG - Need Help

Posted: Fri Aug 12, 2016 6:48 pm
by Bourne
Thank you for your reply. I've looked through main.j and it's much more readable -- I probably should have started there in the first place. I need to become more familiar with compiling the map and using World Editor before I start making any changes. In the mean time, could you give me any clue as to where the actual RNG for the game is coded?

Re: Fixed Seed instead of RNG - Need Help

Posted: Fri Aug 12, 2016 6:51 pm
by nvs
Most of the code was just copy/pasted from a single player setup, and adjusted accordingly it seems. You're looking for 'Reworked Placing Gems'.

Re: Fixed Seed instead of RNG - Need Help

Posted: Mon Aug 15, 2016 2:13 pm
by Bourne
Thanks. I'm working on compiling from source now. Is there a specific place on the Linux system where the Warcraft III installation should be placed so the script can find the MPQ files?

Re: Fixed Seed instead of RNG - Need Help

Posted: Tue Aug 16, 2016 1:45 am
by nvs
My setup is probably different than most, as I use many wine prefixes. But pretty much all that matters is the following registry key is set properly: `HKEY_CURRENT_USER\Software\Blizzard Entertainment\Warcraft III\InstallPath`. You may or may not need to create it. The value should point to the location of your Warcraft III installation. I don't actually have Warcraft 3 installed in the prefix that has all my tools for the map. However, I do know some of the tools expect this value to be set properly.

Anyways, I've considered implementing a fixed seed for some time. A few of my thoughts in are these issues: #189 and #65.

Re: Fixed Seed instead of RNG - Need Help

Posted: Tue Aug 16, 2016 8:28 pm
by Bourne
Slightly confused here, perhaps you can help me. I'm using a Linux system to build the map, as recommended in the readme. As far as I'm aware, there's no registry equivalent in Linux.

To clarify, my process so far has been:

1) Install LUA and all other prerequesits.
2) Configure etc/gem.lua as required.
3) Run bin/map data etc/gem.lua
4) Get the message that required Warcraft III MPQ files could not be found.

Re: Fixed Seed instead of RNG - Need Help

Posted: Tue Aug 16, 2016 8:51 pm
by nvs
If you're using Wine, then there is a registry. Wine has a 'regedit' command. You need to set the registry key I mentioned, unless you have a valid Warcraft III installation in the same prefix, in which case the key should already be set.

Also, I do not recommend using Linux anywhere. I merely state that it is setup to use Wine on Linux. Wine can be used on Mac as well. The binaries included in the repository would work natively on Windows. Anyways, I will clarify that point.