Giter VIP home page Giter VIP logo

Comments (9)

sab39 avatar sab39 commented on May 18, 2024 2

I've not made any attempt to look in the code or do any kind of scientific investigation, but based on my experience so far I have a few data points regarding the generation of the gateways.

The locations of the inner ends of the gateways seem to be precisely predictable: they are in an exact circle with radius 96 and at Y=75. The (X,Z) coordinates are (96,0), (91,29) and (77,56) and all the flipped/negated versions of those to make a circle.

The order in which they generate is not any straightforwardly obvious pattern: in my world the first six to generate in order were (-56,77), (91,29), (0,96), (29,91), (77,-56), (29,-91). If there's a logic to that order I'm not seeing it! However, I think the order of generation is based on the seed, because I made copies of my world to test the dragon fight in the 1.9 snapshots several times, and the (-56,77) gateway was always the first one generated, and always took me to the same place.

The coordinates of the outer points also seem to be somewhat unpredictable but all in the approximate range of the inner coordinates multiplied by 11ish. Specifically, my six gateways go to (-576,832), (984,312), (7,1016), (387,1217), (823,-577) and (304,1069).

For reference, my seed is -416870298798402092.

from amidst.

Treer avatar Treer commented on May 18, 2024

I think the order of generation is based on the seed, because I made copies of my world to test the dragon fight in the 1.9 snapshots several times, and the (-56,77) gateway was always the first one generated, and always took me to the same place.

Excellent. I'm pretty sure that means it can be done.

The generation order pattern can be found by picking apart the code, I tried a few weeks back but ran out of time before I found whether it was determined by the seed, now we know!

I did find how the outer gateways are calculated though - it casts a ray out until it hits land and builds the gateway there. If it goes too far without hitting land it creates one of the miniature islands for the portal to be above. The problem with this is Amidst only has a rough idea of the land (we know the island cores, but not their exact coastline), so while we should be able to get the inner gateways perfect and in the correct order, the outer ones will be an estimate.

It will also be worth checking if the height the ray is cast at can intersect with the miniature islands, since they can't be mapped from the seed. Hopefully it's cast at a height which the miniature islands don't spawn.

Regarding the outer gateways coords not being perfect... I never looked into how coastlines are generated, it might be possible to make the map more accurate but that's not on my list of priorities - it's probably lots of work with a large chance of no payoff.

from amidst.

sab39 avatar sab39 commented on May 18, 2024

How did you get to look at the code to pick it apart? I'd be interested in seeing if I could figure out how the generation order is determined.

from amidst.

Treer avatar Treer commented on May 18, 2024

I've been using Enigma to deobfuscate the code.

I think it's been mostly abandoned, and it has a few bugs, but it does a nice job of helping you make the code readable. (AFAIK it's not designed to make compilable source, just readable code, they recommend MCP if you want compilable source)

I should mention I'm not a java expert and don't know if this is the best tool.

The problem with finding the generation order was that lots of code in 1.9 is new - including everything to do with the End, so mappings from previous versions can't be used to help deobfuscate the new code, I had to slowly pick my way in directions which might lead to the area of code that the generation order code would be located in.

I see the last post in that Enigma thread is a link to someone's attempt at mappings for 1.9, I've not looked at these, perhaps they already map the classes we need. If not then I imagine it's still a good starting point.

(A lot of the stuff in my own 1.9 mapping file is wrong - I tried to automatically bring mappings over from a previous version and it got the order of a lot of fields and enums wrong. Tip: get the enums right because then when you see a class that adds Blocks.BEDROCK and Blocks.ENDSTONE it gives you a pretty good idea of what you might be looking at)

from amidst.

MattSturgeon avatar MattSturgeon commented on May 18, 2024

IIRC the gateway portal on the outer ring side is generated dynamically the first time a main island gateway is used. It essentially searches for endstone that is closes to a spot x blocks on the line that goes from 0,0 through the gateway being used.

The location of the generated portal can actually be manipulated by players by placing blocks carefully before using the portal on the main island, however since this is unlikely, it is fair to assume the location will be roughly 1000 blocks from the main island gateway, on the line from the center through the gateway.

from amidst.

burgerindividual avatar burgerindividual commented on May 18, 2024

I've been trying to figure this out, and it seems like it relies on other features being generated first, which modifies the Random. We'd have to do some sort of workaround with random advancing to get an accurate location of the gateways. If anyone else wants to implement this for if I fail, I'll attach the icon for them that I made.
end_gateway

from amidst.

MattSturgeon avatar MattSturgeon commented on May 18, 2024

from amidst.

burgerindividual avatar burgerindividual commented on May 18, 2024

I got the random gateways to generate mostly correctly, now all I need are the normal ones.

from amidst.

MattSturgeon avatar MattSturgeon commented on May 18, 2024

The normal ones are a bit simpler. There's 20 fixed positions spread evenly around the main island. Each one generates its return portal when it is first used, and depends on the actual terrain rather than the seed (i.e. it's possible to manipulate the position by flying to the outer islands and changing the terrain, originally shown by Gnembon). This is shown visually by the image in the op, from the wiki. The exact code is in the end gateway tile entity class, but it basically ray traces out 1024 blocks and then looks for the first non-empty chunk along that ray.

from amidst.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.