Skip to content
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

Seed Search Enhancements #169

Closed
wants to merge 6 commits into from

Conversation

jmessenger235
Copy link
Collaborator

Implemented a number of features discussed in #120. This PR does the following:

Sets structure filters to have the setting minimum defaulted to 1 to make usage easier.

Set continuousSearch to default to false so it is not a required setting.

Added a search setting to allow a user to set the starting seed for a search so that searches can be done without concerns of PRNG problems for longer searches.

Added the ability to search for witch hut clusters of 2-4.

Buffered the biome data on a search basis for better performance and lower memory usage. In some test cases memory usage was reduced by 7/8ths.

Added search groups and scoring for different filters to enhance traceability of logged results and to allow multiple searches to be run on the seed without having to do multiple separate searches.

Added a higher detail log (SearchResults.txt) that is created or appended to when a search is running.

Added a search name to improve the traceability of search in the log.

All behavior has also been documented here and can be moved to the wiki when the PR is merged.

The code changes were tested with the following filters and have comments on the reason:

// basic test to check that scoring, naming, and grouping were working correctly
{
  "continuousSearch": true,
  "searchName": "Test Search",
  "biomeFilters": [
    {"distance": 512, "biomes": ["Mushroom Island", "Mushroom Island M"]},
    {"distance": 512, "biomes": ["Ice Plains Spikes"], "group": "Ice"},
    {"distance": 512, "biomes": ["Mega Spruce Taiga", "Mega Spruce Taiga (Hills)"], "group": "Ice"}
  ],
  "structureFilters": [
    {"distance": 1024, "structure": "Village", "minimum": 1},
    {"distance": 512, "structure": "Village", "minimum": 1, "scoreValue": 10}
  ]
}

//test to ensure that witch hut clusters were working.
{
  "continuousSearch": true,
  "searchName": "Test Quad Search",
  "structureFilters": [
    {"distance": 4096, "structure": "Dual Witch Hut", "minimum": 1},
    {"distance": 4096, "structure": "Triple Witch Hut", "minimum": 1, "scoreValue": 10},
    {"distance": 4096, "structure": "Quad Witch Hut", "minimum": 1, "scoreValue": 100}
  ]
}

//test to ensure that witch hut clusters were working without the double hut match noise
{
  "continuousSearch": true,
  "searchName": "Test Quad Search2",
  "structureFilters": [
    {"distance": 4096, "structure": "Triple Witch Hut", "minimum": 1},
    {"distance": 4096, "structure": "Quad Witch Hut", "minimum": 1, "scoreValue": 10}
  ]
}

// tested in debug to make sure that all structures were still supported properly
// this was done to make sure the structure provider was still working after the tweaks
// that were made to get the Temple provider type filters working properly
{
  "continuousSearch": true,
  "searchName": "Test struc ct",
  "structureFilters": [
    {"distance": 8192, "structure": "Witch Hut", "minimum": 1},
    {"distance": 8192, "structure": "Stronghold", "minimum": 1},
    {"distance": 8192, "structure": "Jungle Temple", "minimum": 1},
    {"distance": 8192, "structure": "Desert Temple", "minimum": 1},
    {"distance": 8192, "structure": "Village", "minimum": 1},
    {"distance": 8192, "structure": "Witch Hut", "minimum": 1},
    {"distance": 8192, "structure": "Ocean Monument", "minimum": 1},
    {"distance": 8192, "structure": "Igloo", "minimum": 1},
    {"distance": 8192, "structure": "Mineshaft", "minimum": 1},
    {"distance": 4096, "structure": "Dual Witch Hut", "minimum": 1, "scoreValue": 1},
    {"distance": 4096, "structure": "Triple Witch Hut", "minimum": 1, "scoreValue": 10},
    {"distance": 4096, "structure": "Quad Witch Hut", "minimum": 1, "scoreValue": 100}
  ]
}

// tested to ensure defaults were correct
{
  "structureFilters": [
    {"distance": 4096, "structure": "Dual Witch Hut"},
  ]
}

Implemented a number of features:
Searching for witch hut clusters
Buffering biome data for better performance
Search groups and score to help review matches
A separate log for searches that will always be created.
Names for filters to help distinguish results.
Added a search setting to allow a user to set the starting seed for a
search.
Changed continuousSearch to default to false.
Changed the default minimum requirements for structures.
@maciekmm
Copy link

Very cool addition although:

  • crashes when range is not a multiply of 512 - IMO should give a message
  • multi-threading would be perfect for this.

@jmessenger235
Copy link
Collaborator Author

Multi-threading should be discussed on #120. As to the error message, I can see a way to improve that. Thank you for the feedback. We are expecting some code conflicts so I will add that when I resolve the conflicts from some other work that @stefandollase is doing.

Changed the handling of search parameters so they do not throw an ugly
exception when they are not a multiple of 512. The exception is now
caught and handled.
@jmessenger235
Copy link
Collaborator Author

@maciekmm I fixed the message so it will be a bit better. We still have not set the permanent url so it is just a place holder, but you can see the link above.

As a workaround for multi-threading right now, you can just use multiple instances of amidst.

Added a return optimization in the event of an early match.
@awilliamson
Copy link

@jmessenger235 I've been looking into making Quad Witch Hut search utility for a little while, and came across this. I've had to check out your original master branch, as the current state of conflicts is too large for somebody new to this project to decipher and correctly fix without extensive studying.

Whilst structure filters appear nice, why is it that they are only used in a binary check 'isValid'. If you have a SearchResults output log, surely it follows sense that you should be outputting the Hut locations? You have variable distances to search for, it could be such that a user inputs a significantly large number ( as is my use-case ) and thus needs to go manually viewing for Quads themselves.
Additionally, our use-case is for large search of our server seed for Quad Huts on 1.12-pre7; I understand Witch Hut spawn mechanics changed moving forwards starting from 1.9. ( I am using 1.9 client with your master branch ).

A recommendation to improve the efficiency of the Algorithm from O(n^4) would be use to Fixed-Radius NN Search.

I am very excited by this feature, however, with it not being utilised for over a year it is proving rather difficult to crack and understand. Just trying to bring it up to date is providing a whole host of headaches and issues, with world building mechanics changing etc.

@moulins moulins mentioned this pull request May 5, 2018
@jmessenger235
Copy link
Collaborator Author

@awilliamson Take a look at this. It's a full list of all the QWH in the 2048 radius of zero. Frankly amidst will only ever be a validator of QWH the calculations are simply too intensive and the seeds to rare. The scicraft seed finder that he used and that I've used for comparable are simply orders of magnitude better than even the absolute best we could implement in Amidst. However, I appreciate the notes on the better search and will look at that closer given time.

@jmessenger235
Copy link
Collaborator Author

Given this is vastly out of date and out of line with the hierarchical model(s) discussed in #228 I'm going to close this request. If I am able to find time at some point in the future to generate this feature off of a more proper set of specs, I'll open a new PR off of the current content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants