Johni0702 / BetterPortals

A Minecraft Mod which adds see-through portals usable without any loading screen
GNU General Public License v3.0
106 stars 15 forks source link

How is this implemented? #464

Open io12 opened 4 years ago

io12 commented 4 years ago

This is the coolest mod I've ever seen ever. I'm curious how the portal rendering and physics is implemented. It would be awesome if there were a high-level description of how the mod works in the repo.

MacDue commented 4 years ago

Not this mod exactly but you may find these videos interesting (they explain how these kinds of portals generally work in games -- they're both great videos & are fairly high level): Coding Adventure: Portals - https://www.youtube.com/watch?v=cWpFZbjtSQg&t=736s How were the portals in Portal created? - https://www.youtube.com/watch?v=_SmPR5mvH7w

Designation6of10 commented 4 years ago

I've actually been doing research on this, considering using a similar system in a game I'm working on in Unity. The question I have is this: How do you achieve this effect when either end of the portal are in a separate world space? I wish to implement a similar system using scenes in Unity, but I'm not sure it's possible to load both scenes in separate worldspaces, so they never overlap. Are you simply able to preload the dimension in a different space?

Sorry for the long question.

Johni0702 commented 4 years ago

@Designation6of10 I'm not familiar with Unity but large parts of MC were actually built with multiple worlds loaded at the same time (namely anything running on the server). The client however only expects one active world at any time and BP just swaps out that reference with different World instances as required during client-side ticking, packet handling and rendering. It also fixes various instances of MC expecting there to be only one world, e.g.

And that's probably where you may be out of luck with Unity since you cannot just change any engine code at will.

wrt to the original issue: I intend to write a file with high-level and detailed description (cause for some things it's probably not easy to understand just from the code how they're supposed to work) once I have solved most of the 1.14 issues (so I don't have to re-write the whole thing once that's supported).