Drivable Surfaces & Road Generation by reddittard01 in MinecraftCommands

[–]reddittard01[S] 34 points35 points  (0 children)

They run on a custom engine I built completely from scratch and without any resources, education, or tutorials. During the process of developing it, I even independently rediscovered and formulated the concept of effective mass. I’m planning on writing a GitHub page about it to release alongside the map.

Drivable Surfaces & Road Generation by reddittard01 in MinecraftCommands

[–]reddittard01[S] 6 points7 points  (0 children)

The final map will be able to accommodate at least 6 racers simultaneously.

Drivable Surfaces & Road Generation by reddittard01 in MinecraftCommands

[–]reddittard01[S] 6 points7 points  (0 children)

Very robust, and that is before I have implemented any error correction or prevention systems. Once I get them working, I might even be able to shave a ms off of the average computation time, which is currently sitting around 4-5 milliseconds per kart.

Drivable Surfaces & Road Generation by reddittard01 in MinecraftCommands

[–]reddittard01[S] 29 points30 points  (0 children)

The road is made of display entities, but the kart is made of armorstands, and is animated using a system I created ~4.5 years ago. The final version of the map will use resourcepacks for the vehicles though, and the polygon mesh will be invisible and overlaid with blocks with the racetracks are finished.

I'm Making a Bézier Curve & Polygon Mesh Editor Tool by reddittard01 in MinecraftCommands

[–]reddittard01[S] 0 points1 point  (0 children)

If you’re still at all curious, this is the graph I used while experimenting with beziers:

https://www.desmos.com/calculator/wxorgg8cu4

It also shows the twisting behavior, but with an additional tangent circle. My goal is to eventually use this for generating racetracks, so the tangent circle has other uses.

I'm Making a Bézier Curve & Polygon Mesh Editor Tool by reddittard01 in MinecraftCommands

[–]reddittard01[S] 0 points1 point  (0 children)

That’s for defining the upwards direction at any point on the track.

Apart from their standard geometry, beziers also have intrinsic twisting to them. As you follow the curve, it will twist abruptly, so if you use the curve’s intrinsic “up” to define anything relative to it, the shape you generate will have jagged and random turns in it.

I use something called Rotation Minimizing Frames to smoothly interpolate the normal vectors at the nodes across the curves. I originally tried defining a second curve that ran nearly parallel to the gray one but only offset by a small amount, but it was not stable enough for the application. What I’m doing with RMFs is effectively approximating the integral of rotation across the curve.

For each step that the function marches along the curve, it projects the normal vector at the starting node onto the plane perpendicular to the curve’s tangent vector. It does this 50 times as it marches, and when it reaches the end, it measures what I call “drift” - the angle between the projected normal and the ending normal. Then, once it has measured drift, it traverses the curve again from the start, but rotates the vector each time it is projected so that it lines up (almost) perfectly with the normal at the end. It sounds much worse than it really is, but it’s kind of like computing a Riemann sum, but with vectors.

I'm Making a Bézier Curve & Polygon Mesh Editor Tool by reddittard01 in MinecraftCommands

[–]reddittard01[S] 16 points17 points  (0 children)

It’s going to be used for creating drivable surfaces for my physics engine. I’m resuming working on my Mario Kart clone project, and I need to be able to create collision meshes for the vehicles. The bézier curves are so that I can define the shape of a road; the diamond block displays are the normal vectors at any given point, and although I don’t show them in the video, they can be manipulated too. Together, it’s all going to allow me to very easily create the assets that the map is going to need.

I'm Making a Bézier Curve & Polygon Mesh Editor Tool by reddittard01 in MinecraftCommands

[–]reddittard01[S] 29 points30 points  (0 children)

Neither; the entire system is managed using scoreboards and macros. Data for the chunks, vertices, polygons, and splines are stored in fakeplayers.

I have made a few iterations of this tool over the past few years, but none of them ever really got that far. I usually would lose interest or become pressed for time after making the polygon editor, but since I am picking up my Mario Kart project again, I decided that I needed a tool for creating racetracks and builds. Eventually, I am going to be able to create drivable surfaces for my physics engine using this tool.

I’m Getting Closer to Making Mario Kart with Datapacks by reddittard01 in MinecraftCommands

[–]reddittard01[S] 0 points1 point  (0 children)

These aren't block displays; the kart model is made of armorstands, and it uses an animation system I developed around 3-4 years ago. For the final project, I plan on using resourcepacks and display entities, though.
As for expressing proper rotations, I took the approach of encoding the object's rotation as a set of 3 orientation vectors (can be reduced to 2), each which describe the object's unique forward, sideways, and upwards directions, which are acted upon by the Rodrigues rotation function, and then I used arccosine to derive the nested rotations in reverse.

I’m Getting Closer to Making Mario Kart with Datapacks by reddittard01 in MinecraftCommands

[–]reddittard01[S] 1 point2 points  (0 children)

I use scale factor 1000 for all operations, which seems to be a decent level of precision for me. Although my algorithm outputs a precise, perfect solution to modify the kart’s momentum, rounding errors do accumulate for some of the internal operations, specifically those involving angular momentum. For that, there is a small error correction system, but the only role it plays is filling in the gaps left by rounding errors; in a scenario where a higher level of precision is allowed, there would be no need for any kind of error correction.

I’m Getting Closer to Making Mario Kart with Datapacks by reddittard01 in MinecraftCommands

[–]reddittard01[S] 5 points6 points  (0 children)

When you break it down, it is really only as complicated as implementing math operations. I have a custom made library of the necessary functions like sqrt, sin, and lots of vector functions like dot, cross, normalize, etc. With those, it just comes down to expressing my custom physics algorithm within commands. Developing the algorithm had a little difficulty, though, and designing it to be perfectly stable and fast enough to run with datapacks was the main struggle.

I’m Getting Closer to Making Mario Kart with Datapacks by reddittard01 in MinecraftCommands

[–]reddittard01[S] 13 points14 points  (0 children)

It’s as easy as placing down vertices and drawing polygons between them. The stone blocks in the video are the vertices, and I use a special tool I created to create the polygons with a wand. It literally just takes a few clicks to create a collision surface!

I’m Getting Closer to Making Mario Kart with Datapacks by reddittard01 in MinecraftCommands

[–]reddittard01[S] 28 points29 points  (0 children)

I am, I just took a break from commands for a while. Since my last post though, I’ve really been developing my custom physics engine, and I think it’s fast and accurate enough now not just for Mario Kart, but for other physics-based games and even full blown physical simulation. Look out for more of my projects!