Tommy Ming Tang Wing Wai Danial Cheung What: A space flight simulator taking place in a solar system with realistic, to-scale planet sizes and distances. The extra features we have implemented are particle systems, collision detection, and level of detail. How: This game allows the play to fly around the solar system and approach planets and moons closely. To enhance the precision of the ship's movements near planets, we automatically re-parent the ship to the closest planet when close enough ("sphere of infuence"). We wrote the re-parenting logic in TypeScript (.ts files). In the actual code, the ship stays at (0, 0, 0) but the planets positions relative to the ship are calculated. The camera uses a logarithmic depth buffer to properly render close and far bodies. The camera moves like the free flight mode in Project 2, except the controls are different. The ship can fly faster than light, and its speed is limited around a planet to make approaching a planet easier. Picking: The player can click on a body to get its info displayed on bottom-left. Each clickable body has a hidden geometry that's larger than the body itself to make them easier to click. Level of detail: The program chooses the complexity of sphere (number of vertices) based on the angular diameter (radius / distance) of the body. The level of detail meshes are generated and destroyed on-demand. The highest levels of details are textured and bump mapped. Particle system: The particle system is in the ship's exhaust. We used THREE.js Points renderer to create the particle system. The opacity of the system is determined by the acceleration of the ship. Press V to see the ship. Collision detection: We compute the ship's position relative to the planet, and cancel out the radial component of the ship's velocity so the ship stops moving toward the planet (using vector projection). The ship's position is also clamped so it's always above the planet. How To: - W A S D Q E keys to rotate the ship - R F to move forward/backward - Hold Shift with a movement key to move in smaller increments - Z to slow down - O to toggle orbit lines - V to change camera views - [ ] to change field of view - , . to change simulation speed - G toggle near-planet speed limiter - M to mute/unmute background music - Click to select/deselect a body - Enter to select/deselect the body on the crosshair In the objectives mode, you fly to planets to earn points. If you don't like objectives, put "?free" at end of the URL. Tip: Reduce field of view and use Shift key plus movement keys to target a planet precisely. This game loads external textures therefore requires correct crossdomain settings. You can use a local web server to do that. Danial made the background music. Sources: - https://en.wikipedia.org/wiki/Category:Space_trading_and_combat_simulators - http://gamedev.stackexchange.com/a/13108/1966 - Orbiter and Kerbal Space Program - CPSC 314 Project 2 (our code) - ASTR 101 for the concept of angular diameter - http://threejs.org/examples/webgl_camera_logarithmicdepthbuffer.html - See bower.json "dependencies" for list of third-party packages installed - Planet and moon data: http://www.wolframalpha.com - Planet Textures: http://www.celestiamotherlode.net/catalog/solarsystem.php - Implementing elliptical orbits: https://en.wikipedia.org/wiki/Kepler%27s_equation - Orientation of orbits: https://en.wikipedia.org/wiki/Orbital_elements - Saturn ring texture: https://commons.wikimedia.org/wiki/File:Saturn%27s_rings_dark_side_mosaic.jpg - UV mapping for Saturn ring: http://stackoverflow.com/questions/24634971/how-can-i-apply-a-radial-texture-to-a-ring-with-three-js-r67