Speed increase per powered rail is unpredictable #3

Closed
opened 2021-08-23 03:01:28 +00:00 by magneticflux- · 3 comments
magneticflux- commented 2021-08-23 03:01:28 +00:00 (Migrated from github.com)

This technically happens at normal speeds, but it's much less noticeable.

The cause of the issue is that a fast-moving cart may traverse multiple blocks in one tick. If a powered rail is "skipped" in this way, it does not speed up the cart. This causes "dead zones" of speed that depend on the distance between each powered rail.

A way to fix this would be to raycast in the movement direction of the cart and apply the effects of each intersected block in the order. Care must be taken using this technique to avoid "double-counting" blocks (applying the effects of the same block at the end of one tick and the beginning of the next tick at high speeds).

If this raycast technique works well, it could eventually be modified to allow carts to go up and down hills, on diagonals, or around corners at higher speeds.

This technically happens at normal speeds, but it's much less noticeable. The cause of the issue is that a fast-moving cart may traverse multiple blocks in one tick. If a powered rail is "skipped" in this way, it does not speed up the cart. This causes "dead zones" of speed that depend on the distance between each powered rail. A way to fix this would be to raycast in the movement direction of the cart and apply the effects of each intersected block in the order. Care must be taken using this technique to avoid "double-counting" blocks (applying the effects of the same block at the end of one tick and the beginning of the next tick at high speeds). If this raycast technique works well, it could eventually be modified to allow carts to go up and down hills, on diagonals, or around corners at higher speeds.
andrewlalis commented 2021-09-23 18:53:20 +00:00 (Migrated from github.com)

At the moment I do a sort of primitive, orthogonal ray-cast along the horizontal axis the cart is traveling, to look for signs indicating to stop the cart. I could expand this to include searching for powered rails, but the actual application of speedup is still quite convoluted to me, so I don't know how I would scale it based on the number of rails encountered.

At the moment I do a sort of primitive, orthogonal ray-cast along the horizontal axis the cart is traveling, to look for signs indicating to stop the cart. I could expand this to include searching for powered rails, but the actual application of speedup is still quite convoluted to me, so I don't know how I would scale it based on the number of rails encountered.
magneticflux- commented 2021-09-23 20:44:42 +00:00 (Migrated from github.com)

I gave it a shot myself back when I created this issue and didn't make much progress. The vanilla "rail check" method is just a huge mess of logic that I'm afraid to change lol

I gave it a shot myself back when I created this issue and didn't make much progress. The vanilla "rail check" method is just a huge mess of logic that I'm afraid to change lol
Cm4nXD commented 2022-07-23 22:09:31 +00:00 (Migrated from github.com)

perhaps you could use this mod to fix these issues? IDK I'm not a programmer pro

https://github.com/audaki/minecraft-cart-engine

perhaps you could use this mod to fix these issues? IDK I'm not a programmer pro https://github.com/audaki/minecraft-cart-engine
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: andrew/SpeedCarts#3
No description provided.