[Spoiler] Display Actual Seed (Patch r27)


#1

A quick one for all who are curious what seed they are playing with, i.e. which random generated number was used to create the world.

There is only one folder relevant for us which includes three files (all will be edited):

"..\Stonehearth\mods\stonehearth\ui\shell\loading_screen"

:one: ** Adjusting “loading_screen.html”:**

Simply add a placeholder to display the seed and some text, let’s give it the ID “seed”:

  ...
<div id="message">{{i18n stonehearth:loading_map}}</div>
<div id="seed"></div>                                       // ADD THIS LINE
</div>
...

:two: ** Adjusting “loading_screen.less”:**

In this file we only have to add some CSS-details on how to display / format the text, e.g.:

  #seed {
    .controlFont;
    position: absolute;
    top: 125px;
    width: 100%;
    color: #fff;
    font-size: 18px;
}

:three: ** Adjust “loading_screen.js”:**

Finally we have to do two changes in the JavaScript-file. First locate the line:

  var seed = Math.floor(Math.random() * 10000);

… and delete “var” at the beginning which will turn the local variable into a global one (probably not the nicest solution, but works :wink:). We need to access the variable “seed” in another method. Look for the following entry:

  $('#randomScreen').css('background-image', 'url(' + imageUrl + ')');

… and add just behind that one this line:

  $('#seed').html('Map Seed: ' + seed);

If you start a new game you should see now on the loading screen which seed is used to generate the world.


Voxel Pirate's Tutorials n' Stuff (Overview)
#2

technically, i helped… and by “helped”, i mean i was pestering @voxel_pirate on Steam, while he was laboring away… i consider it a great accomplishment… on my part…

:smile:

cant wait to see where you go with this next… :wink:


#3

… the logical next step would be to add an input-field where you can enter your seed and which is used to override the random one :wink:.


#4

well… thats what I want… and given that i fully represent .000014% of this effort, i demand you make it so… however, i didnt want to provide any undue pressure… :stuck_out_tongue:


#5

So we can collect your great wisdom through steam?

@voxel_pirate Good work. Would be nice if we could select the seed ourselves.


#6

Bravo. Maybe I should just put the seed input back into the game in the next release, eh?


#7

i’ll just answer, on behalf of the internet:


#8

@Tom, although it would be a bit of cheating in the final game (using “the perfect” seed)… I would like to see the option back again. This way we could share especially challenging seeds or re-play the favorite ones.


#9

yes sir… this is precisely why I think it would be great to bing this back (and enable the player to load a specific seed)…