tModLoader / tModLoader

A mod to make and play Terraria mods. Supports Terraria 1.4 (and earlier) installations
https://www.tmodloader.net/
MIT License
4.1k stars 1.85k forks source link

[Post 1.4 Roadmap Request] Multiple Dimensions Support #1290

Open Solxanich opened 3 years ago

Solxanich commented 3 years ago

Description

This one is semi-explanatory: providing formal support for implementing custom dimensions outside of the current single world save. May be useful for mods with lots of large structures, or thematic content mods. Examples of 1.3 mods that suggest a desire for this feature include Pinky's Mod (multiple template dimensions) and the Enigma Mod (etheria dimension).

Some possible design considerations: 1) Non-intrusive file management; historically, Pinky mod had used cut and paste, then rename the .wld file to change dimensions. This is fairly intrusive imo, and problematic with some file spaces. A safer design could be to place all world files inside an overarching save folder, and then just use integer id.wld as the dimension files 2) Likewise to dimension files, player maps also would need separate per dimension (also lacking in Pinky Mod at time of writing) 3) Implement a hook to change player dimension from x to y 4) Provide direct support for copy paste dimension .wld 5) API for mod writers to use own custom built gen for dim 6) A means for mod writers to reserve a particular dimension id/identify conflicting ids

What does this proposal attempt to solve or improve?

Formal support: 1) Prevents intrusive, risky, or incompatible file management practices 2) Prevents inconsistent implementation of dimensions 3) Improves the possible and existing mods that can be created or improved with the feature 4) Can fix a large number of issues resulting from mods working around current limitations to add dimensions, such as rendering issues, biome issues, map data issues, etc

Which (other) solutions should be considered?

This is a far future idea IMHO, so solutioning isn't a priority.

direwolf420 commented 3 years ago

A mod providing dimensions already exists: SubworldLibrary, and multiple mods already use it. Its made to handle mod conflicts and boilerplate world switching code. The mods you listed don't, and they are outliars in that regard.

Chicken-Bones commented 3 years ago

I believe the only reasonable way to support multiple dimensions is to run multiple servers. tML could support this by allowing a 'host' server to spawn child servers and facilitating transport between them. Single player could also launch the world as a local server in the background (like host&play)

Solxanich commented 3 years ago

Direwolf - thanks for pointing the mod out. Sorry for delayed response; haven't had a chance to look at it in depth for if it hits all points I've raised. Surface level look suggests the only things I want to double check are how it handles file system, and player maps. Also, per CB's point on multiplayer seamless dimensions... I'm not sure terraria makes sense for us to aim for seamless. A voting system makes sense when the game is significantly boss oriented. See minecrafts ender dragon killing problem with its draconic evolution mod as an exact example of why voting is better to move all players and ensure all players get loot...

Solxanich commented 3 years ago

Just to summarize the discord half of the discussion: "Apologies. Seems I should have clarified the before github comment further; seamless dimensions referred to multiple dimensions could be active, instead of voting system to allow only one dim in subworldLibrary. This means one player may not be fighting boss x because in dim y, but may entitled to loot anyways (or maybe not). Also for multiple hosts, memory usage could be an issue (although servers really don't use much resources in tML), we could also easily overload the CPU usage since single core limitation if not smart about how we handle client not knowing about other dimensions. " "It might be possible to use a separate core for multiplayer to address the latter"

Finally, I'm thinking I'm going to close this unless we feel there is a strong desire for "Seamless multiplayer with more than one dimension", at which point I would say that request should probably instead be coming from SubworldLibrary's dev if that is a feature to implement as they probably have a better idea as to how much its wanted. Open to re-opening as desired.

Chicken-Bones commented 3 years ago

Leaving this open as a long term todo, for whenever anyone wants to pick up on it.

jjohnsnaill commented 3 years ago

Subworld Library developer here. I believe dimensions are beyond tML's scope, for a number of reasons:

  1. Not supported by vanilla whatsoever, and would require altering vanilla immensely. There are many different things that must be changed to account for dimensions, such as gravity in space, water evaporating in the Underworld, the background changing at the top, sides and bottom of the world, and world updating (which results in events occurring, tiles updating, and Town NPCs attempting to move in).
  2. Would expose a lot of vanilla code in many different areas, as a result of the first point.
  3. Would introduce MANY bugs, mostly in Multiplayer. It took me months to get Subworld Library working in Multiplayer, and even then, there are still issues. I imagine running each dimension in a separate server would be even more unstable.

Implementing dimensions and getting them stable would needlessly delay tML 1.4 considerably.

Solxanich commented 3 years ago

Thanks John Snail for taking a look at this issue! Noting the Post-1.4 roadmap tag in the title, we currently aren't planning to do anything on this conceptual feature request until after than, and if we do it, it would be as a monolithic feature release for compatibility reasons. Further still, we would likely opt to use a forwarder method within vanilla to the feature rich calls, and not rewrite large amounts of vanilla itself, where applicable.

All that said, if you have interest in pointing/controlling the direction based on your experience with SubWorld Library, feel free to drop a PR to the 1.4 branch. Note that ModGen changes are being worked on in #1292. Even a simple port of Subworld Library to be added to (ModLoaderMod)[https://github.com/tModLoader/tModLoader/tree/1.4/patches/tModLoader/Terraria/ModLoader/Default] would be a big step on this if this is desired to be before 1.4 release by someone.