Code Monkey home page Code Monkey logo

group21wildliferefuge's Introduction

Development Environment:

To run this project, you need NodeJS installed on your platform of choice. Visit NodeJS for instructions on how to install Node.

Type npm install at the root level of the project to install node dependencies. This is required prior to trying to run the project.

Run the Simulation:

Type 'npm start' to build and run the development version of the project. This should automatically open a browser pointed to https://localhost:3000 once the development server starts.

The page will reload changes made when you save your code.
You will also see errors and warnings in the terminal where you ran npm start.

Build the production version:

Create React App, the cli tool used to spawn this project, comes with a script to package and build the project. Type npm run build to do this. It will create a build directory that includes bundled CSS files, a JS bundle, and an index.html file. There will also be any assets included, such as images or model files.

This folder can be hosted by any server as needed: it is all client side code.

Run using Docker:

If you'd like, you can use docker to run a production version of this project. The relevant files are Dockerfile, docker-compose.yml and index.js. The dockerfile specifies the build and host needed and creates an image for it. The docker-compose file will set up the environment variables and copy in the needed files to run the application. Finally, index.js is a small ExpressJS server meant to host the build directory.

Docker can take a bit to set up, depending on your environment. If you have it installed properly all that's needed is to type docker-compose up in the root directory.

The server is set up to only work with SSL, since SmartSparrow will only work with SSL. Certificates are not included and you will need to go through a service like Let's Encrypt to get them.

The Dockerfile is expecting the certs to be in ./sslcerts and to be called privkey.pem for the private key and cert.pem for the certificate. The filenames are in index.js towards the top.

Adding new assets (like models):

Currently the only asset using a model is GrassField.js. The model was taken from an fbx file and converted to a gltf file using Facebook's FBX2GLTF project.

We only have support for GLTF loading in the application, though ThreeJS has other loaders out there if something else is desired. To load a new asset and use it, you would go to the model where you want to use the asset and create a new loader, then use that loader to load the file you want, making sure to wrap it in a promise.

const loader = new THREE.GLTFLoader(new THREE.LoadingManager());

const myModel = new Promise((resolve, reject) => {
  loader.load(
    "models/mymodel.gltf",
    model => resolve(model.scene || null),
    undefined,
    reject
  );
});

At this point your model is ready to use, similar to how you would use other models. The complexity comes with managing multiple async operations and making sure the simulator waits for all of them to finish before loading. These are the ThreeJS Docs used for the GLTFLoader.

group21wildliferefuge's People

Contributors

efrance1 avatar jcerda94 avatar maxwellheller avatar ryleysill93 avatar tduangbo avatar

Watchers

 avatar  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.