Jump to content

[1.16] Creating a W value alongside X, Y, and Z


Recommended Posts

Posted

I'm developing a Minecraft 4th dimension concept mod, so I'm starting by adding a W value (trength) that the game can take into account when generating and rendering blocks, or at least make it show up on the F3 screen. I just wanted to know if this was possible, and where I should even start to look into how I could implement this in my mod. 

Posted
40 minutes ago, B3tcha said:

What would the difference be between a w cord and the World dimension as I feel it already is very hard to miss if you are in overworld or the end?

I'm not making a mod between the normal Minecraft dimensions, but the mod will generate 60 million different alternate versions of your normal world, with many things slightly different, which is why I need a W value. It's kind of complex

Posted

That's basically dimensions.

Also, no computer would be able to run 60 million dimensions at once.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
1 minute ago, Draco18s said:

That's basically dimensions.

Also, no computer would be able to run 60 million dimensions at once.

I don't think you understand. The computer doesn't run all 60 million dimensions at once, just like how a computer doesn't run all 60 million by 60 million blocks in the world at once. It will use the seed and each 60 million W values to generate new terrain in a certain distance from the player, which will probably be 10 chunks. There will definitely be a performance drop, but nothing too severe, maybe only twice the load. 

Also, what I'm making is not normal Minecraft dimensions. It's naturally generating the same world multiple times except with one more variable when generating, which will create a W axis with 60 million blocks. There will be two keys to press on the keyboard to move left and right across this axis, and as you do so, the world will deform just slightly. Rivers may change shape; mountains and valleys may shrink or grow; and forests, lakes, oceans, vegetation, and biomes may also do the same, therefore becoming 3D instead of 2D including the W axis. Structures will get larger and smaller as well depending on your W axis. Try researching into a 4th dimension concept to understand it better. This video perfectly describes it, except that game is in a small, enclosed space, while Minecraft is much larger. 

9 minutes ago, B3tcha said:

Then its a -p cord for parallel is it not?

 

?

Posted

If you don't understand the post above, that makes sense because I suck at explaining things. I just wanted to know if there was some way to add a W axis to the world, or at least in the F3 screen.

Posted

I understand what you mean, its kinda something like shifting between differents planes of existance, where things might change slightly from plane to plane. I suppose when you press your key that moves across the "W" axis you would need to manually recreate the chunks in a certain radius around the player taking into account the elements that were contained into the chunk and applying the new generation accordingly, though the performance would drop critically and i am not sure you would be able to achieve all the modifications you listed above, for example the structures one.

Probably there are better ways to do that (if it is even possibile to do that)? But to me this sound like a very difficult thing to achieve without changing the inner core workings of minecraf itself

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Posted
9 hours ago, BliX5 said:

It will use the seed and each 60 million W values to generate new terrain in a certain distance from the player, which will probably be 10 chunks. There will definitely be a performance drop, but nothing too severe, maybe only twice the load

I don't think you understand the math involved here.

 

Area of a circle:

πr^2

Volume of a sphere:

4/3 πr^3

 

Plugging "5" in as our chunk radius...

Circe: 78

Sphere: 523

 

And I know what Miegakure is, and they've been working on it for literally decades, you're not going to achieve something similar in Minecraft in only a few weeks. Especially if you want to let the player rotate their view in such a way to swap one of X/Z for W.

 

I also don't know how you're going to generate "the same world, but actually not" because that's not how Minecraft seeds work. Even the Miegakure folks don't have a 4D model editor.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
1 hour ago, Draco18s said:

Plugging "5" in as our chunk radius...

Circe: 78

Sphere: 523

Since it's 4D projected into 3D, the entire area of generation won't be projected at once, so the load will maybe be more than twice, but not as much as you would think. 

1 hour ago, Draco18s said:

And I know what Miegakure is, and they've been working on it for literally decades, you're not going to achieve something similar in Minecraft in only a few weeks. Especially if you want to let the player rotate their view in such a way to swap one of X/Z for W.

I didn't say, making the mod would take a few weeks. It could take a year. All I'm saying is Miegakure was a useful resource in making the mod concept. Also, a lot of the time making Miegakure was probably spent on the levels and their 4D counterparts, especially since everything is those levels were made from scratch, while Minecraft should do it instantly. Also, in Miegakure, objects aren't blocks, they're 3d models. Blocks are a lot easier to work with when switching between 4 dimensions because (with enough time) you could possibly make some algorithm that finds different planes around a changing block to deform accordingly. 

As for the rotation, I have an idea to have all of the axes visible, as well as the W, but that's not important right now. 

 

7 hours ago, Beethoven92 said:

Probably there are better ways to do that (if it is even possibile to do that)? But to me this sound like a very difficult thing to achieve without changing the inner core workings of minecraf itself

I'm not sure if this is possible, which is one of the reasons I asked this question here in the first place. 

Posted
13 minutes ago, BliX5 said:

It could take a year.

It too me a year to make a standard mod that did things that Minecraft and Forge already supported. You're doing something that requires completely rewriting whole swaths of the codebase to do something it doesn't already do.

 

15 minutes ago, BliX5 said:

while Minecraft should do it instantly.

No.

No it will not. Minecraft's world generation system is not in any way set up to handle 4D terrain in a sensible manner. Yes it is "just cubes" but no, there is not some "easy to write" code that will do what you want. And you're going to need to write that code yourself.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Here's my dumb rotation diagram idea:eeeee.thumb.png.b59a9d128a76817c0a7c9c98fd28f7cc.png

I don't know how long this thing will take me and I don't even think I'll finish it. If it requires a good PC, then that's fine because the mod is just for me and my friends anyways. I'll just do some research on displaying a value on the F3 screen

Posted

A fourth dimensional concept is problematic for many reasons. You would almost need to rip out all physics handled by minecraft to write a custom engine that can handle all the data properly. Graphics-wise, yes, the computations would be the same in regular world movement. However, transition spaces would cause a terrible amount of lag as chunks would be loaded and unloaded and drawn every time you move along this axis. This is not even to discount the fact that Draco is completely right on the math there. In three dimensional space, all you have to is load a circle of the required information. Four dimensional space requires a sphere to be loaded at all times which is a dramatic increase.

 

For reference, there is no nth-dimensional tool out there for rendering or physics. Closest that's been achieved is through 4d Toys, and that barely meets that requirement. It would take an expert in either field upwards of about 10 years to get a semi-efficient concept working well with current day technology. A non-euclidean environment in minecraft would take less time and work much more efficiently and that requires a good amount of work too.

 

You can attempt to make one, but you're better off writing an entirely new game instead.

Posted
2 hours ago, ChampionAsh5357 said:

For reference, there is no nth-dimensional tool out there for rendering or physics. Closest that's been achieved is through 4d Toys, and that barely meets that requirement. It would take an expert in either field upwards of about 10 years to get a semi-efficient concept working well with current day technology.

4D toys was made by the same guy as Miegakure, he published a paper about it, and had it accepted to SIGGRAPH within the last year, and oh yes, it took him 10 years. 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • 1 month later...
Posted

I know this topic is kinda dead, but I wanted to bring a different way to implement this mod. I'm removing all of my ideas before as well. 

 

Each W value can be a dimension, and this may sound extremely CPU-intensive, but there is a solution. 60,000,000 total dimensions is possible. Granted, the player won't be going through every single dimension, just as the player doesn't go through every single Minecraft chunk. The game doesn't register every dimension on startup, but it generates these dimensions like chunks. Take Minecraft's April Fools snapshot from this year. You can write anything in a book and chuck it into a portal, and as soon as you jump through, it generates a completely random dimension. If I could come up with some method to make a 3D biome map and I just made every generated dimension a new overworld, this could be possible, of course with some major tweaks to structures and mob AIs. 

The gameplay will act similar to Miegakure's, so instead of clicking two buttons to move left and right across the W axis, there are two buttons to rotate left and right, or rather, ana and kata. I'm still deciding whether I should make the rotation a full 360 degrees or just 4 selections of rotation: XYZ, WYZ, XWZ, and XYW. A 360 degree rotation function would have a mix of all the values depending on how long the player holds each button for. While I don't entirely know how the splicing of dimensions will be done, I'm sure there's some way to do this. 

While this idea is most likely nearly impossible for Forge, I'm not dropping the concept just yet. I've been working with datapacks recently, and since dimensions are written in json now, most of these concepts will be performed via a datapack. 

For now, the rendering is the least of my worries. 

 

I'm not giving up on this concept, and I'm not dropping any of these ideas unless anyone has any better method, which is likely the case. 

Posted
6 hours ago, BliX5 said:

While I don't entirely know how the splicing of dimensions will be done, I'm sure there's some way to do this. 

The Miegakure team had to write a custom rendering engine for it.

Have fun.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.