Code Monkey home page Code Monkey logo

city-tour's Introduction

City Tour

Visit a procedurally generated city, different each time. Sit back and enjoy the ride!

https://www.joelstrait.com/citytour/

Made using three.js and WebGL.

How It Works

First, blueprints of the world are generated:

  • A terrain map
  • A road network that follows the terrain
  • Empty building lots along roads
  • Buildings in the lots

The results are different each time due to random variation, but follow configurable rules.

Next, this abstract definition is turned into a 3D model that can be rendered with WebGL, with the help of three.js.

Once this is all created, you can move around the city using touch gestures (mobile) or the mouse (desktop). Navigation works similar to Google/Apple Maps. You can also click the "Take a Tour" button to go on an automatic flight/drive through the city.

Local Development

  • city_tour.html requires city_tour.js, which is a minified and concatenated build of the source files. It's not included in this repo. You'll need to generate it locally by running yarn install (if this is your first build) and then yarn run build. Open city_tour.html in your browser and you should be good to go!
  • To automatically re-build when a source file changes:
    • Install the rb-fsevent Ruby gem: gem install rb-fsevent
    • Run ruby build.rb --watch. Each time a file under /src changes, yarn run build will automatically be run.
  • To run the tests, open spec/SpecRunner.html in your browser

city-tour's People

Contributors

jstrait avatar

Watchers

 avatar

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.