Coder Social home page Coder Social logo

niklas20114552 / uv-transit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from girlinpurple/uv-transit

0.0 0.0 0.0 161 KB

Google Maps for the UltraVanilla Minecraft server

Home Page: https://girlinpurple.github.io/uv-transit/

License: GNU Affero General Public License v3.0

HTML 75.37% CSS 6.29% JavaScript 18.34%

uv-transit's Introduction

UVDOT UltraVanilla Transit Router

This page was moved from the original UV website due to the amount of upkeep it needs, along with not having to bother the admins to accept a PR every week or so to update the graph.
It was also partly rewritten to make it slightly easier to maintain, this time around taking full advantage of jQuery and proper nesting/scoping.\

Licensed under AGPL v3 as to keep compatibility with UltraVanilla/uvweb, 416.png is CC-BY-SA ©UltraVanilla 2024.

Technical Info

There is a single function that controls all the routing processes, from data manipulation to tracking how long it takes. This is activated by the user clicking the "Route!" button.

The function then takes all the settings from the user, along with the location graph, and creates a node graph that is parsable by A-Star. This is the longest part of the base process due to the sheer amount of data it needs to handle.
During this stage, weights can be altered in either direction, up or down, depending on the factors the user chooses. This is primarily used to avoid tolls and for the alternative routing methods.

The AStar function is the part where the actual routing happens, based on the A* pathing algorithm. It sends back a list of nodes and methods it followed to get this route, or an error message if one occurs.

From here, all the data from the pathing and compiling functions get passed into the rendering functions. This is a text based explanation similar to

Adding Location Nodes

Here is an example of a location node:

const routes = {
    // ...
    "Outpost": [
        [-1890764,-1894658],
        {
            roadways: {
                "UV-OP-201 UV-OP-2 Intersection": [["UV-OP-2"], 1200],

                "Evergreen": [["UV-OP-1", "UV-VY"], 1200],
                "Stonehelm": [["UV-OP-1", "UV-OP-2", "UV-VY"], 1200],
            },
            railways: {
                "Outpost UltraStar Station": [["Toll"], 0, {
                    currency: "Emerald",
                    price: 4,
                    pass: "SeaCard",
                    passPrice: 2
                }]
            },
            iceways: {
                "Illyria": [["OPE Ouest"], 1200],
                "Stonehelm": [["EGRK Expressway"], 1200],
            },
        },
    ]
    // ...
}

Lets go from top to bottom:

  • First is the node name. If its a town or destination it should be the same as the one in the places variable, and the name has to be unique.
  • Next is the coordinates, the Y coordinate is dropped due to it not being useful to us.
  • Lastly, the routes
    • Each route is formatted in this manner:
      • Node Name
      • Transit Name(s)
      • Distance in Blocks/Meters
      • Toll (if applicable)
        • The toll is again split up into 4 sections:
          • currency is the type of currency the toll requires. Common currencies are Diamond, Emerald, and Paper.
          • price is the amount of that currency needed to pass the toll.
          • pass is the name of the pass that allows you to skip the toll. Currently only SeaCard and EasyPass are options.
          • passPrice is the price that is paid if the user checked the box saying they have a specific pass.
    • The roadways section is for connected roadways, be it UVDOT highways or other nearby roads that aren't numbered.
      • The space between "UV-OP-201 UV-OP-2 Intersection" and "Evergreen" is to tell people who are adding onto the network graph that the "UV-OP-201 UV-OP-2 Intersection" node can not be selected from the UI, but still exists. Same thing with the "Outpost UltraStar Station" node, but this time there are no other connections so the space doesnt make sense to add.
    • The railways and iceways sections are for minecart railways and ice boat tunnels respectively.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.