orangeadam3 / terra121

A Minecraft Terrain Generating Mod for Cubic Chunks 1.12.2. attempting to generate real terrain, biomes, and features on a 1:1 scale
MIT License
280 stars 41 forks source link

Tunnels and Bridges #119

Open taeko-chan opened 4 years ago

taeko-chan commented 4 years ago

what does it do? This pull request adds tunnels and bridges to Terra 1 to 1. It is done by getting the start and end points of an OSM way as well as the start and end heights, and calculating the height using: y = y1 + (c/d) * Δy1 where c is the distance along the tunnel, d is the length of the tunnel and y1 is the origin y.

As of current, all (famous last words) bugs have been fixed. Tunnels and bridges both generate correctly (outside of the edge cases listed below). The pavement is standard asphalt, although one photo has orange asphalt because it was taken before I changed it back.

Here are some photos of the results (more coming soon):

Near Airolo, Switzerland: Terra 1 to 1: Screenshot (6)

Real life: Screenshot (8)

Gubrist Tunnel, Switzerland Terra 1 to 1: Screenshot (10)

Real Life: Screenshot (14)

Lærdalstunnelen, Norway (World's longest tunnel): Terra 1 to 1: Screenshot (11)

Real Life: Screenshot (13)

view from inside mountain of Lærdalstunnelen: Screenshot (12)

Gotthard Pass (Ticino Side), Switzerland (no companion irl photo yet): Screenshot (9)

Keep in mind the orange parts are asphalt in the pull request.

what still needs to be done?

  1. Edge cases include: -tunnels & bridges with multiple ways (e.g. one that crosses a border) don't work properly -tunnels & bridges that dip down to below a certain level after becoming one on OSM.

CHANGE LOG (major stuff):

  1. Added new class "dataset/Pathway" which contains a lot of the new populator's methods & classes
  2. New generator VectorPathGenerator replaces RoadGenerator.
  3. Added a couple methods to OpenStreetMaps.java I order to get the lat & lon from nodes of tunnels
  4. Road material is now based on OSM data (asphalt, concrete, cobble etc.)

i left the class itself in just in case, but the osm path generation is now done by VectorPathGenerator.

Also important: Because there hasn't been a grounding fix yet it may be best to wait until after that is fixed to avoid conflicts in OpenStreetMaps.java.

If you want to try out a complied version with tunnels and bridges, here it is (this version is a commit behind): https://drive.google.com/open?id=1YaFy01VRi-lPOT-ccfkaYenwbSE1eQcV

That pretty much summarizes it, if anyone has any suggestions around this basic feature set, go ahead and comment and I may implement them as well.

AidanLovelace commented 4 years ago

I love this. Can't wait for it to be merged so I can start working on adding lane markings. Honestly it seems like a bad idea to add an additional option for "advanced roads." This seems like a feature that should be built in to the default road generation.

taeko-chan commented 4 years ago

I love this. Can't wait for it to be merged so I can start working on adding lane markings. Honestly it seems like a bad idea to add an additional option for "advanced roads." This seems like a feature that should be built in to the default road generation.

I ended up writing a new populator that uses the Vec3d object to store coordinates, as I saw it more fitting. It also lets you do vector math easier. We could possibly just use VectorPathGenerator instead of RoadGenerator from now on, as it does the same thing RoadGenerator does + the tunnels/bridges and road surfaces.