Giter VIP home page Giter VIP logo

javascript-racer's Introduction

Javascript Pseudo 3D Racer

An Outrun-style pseudo-3d racing game in HTML5 and Javascript

Incrementally built up in 4 parts:

With detailed descriptions of how each part works:

A note on performance

The performance of this game is very machine/browser dependent. It works quite well in modern browsers, especially those with GPU canvas acceleration, but a bad graphics driver can kill it stone dead. So your mileage may vary. There are controls provided to change the rendering resolution and the draw distance to scale to fit your machine.

Currently supported browsers include:

  • Firefox (v12+) works great, 60fps at high res - Nice!
  • Chrome (v19+) works great, 60fps at high res... provided you dont have a bad GPU driver
  • IE9 - ok, 30fps at medium res... not great, but at least it works

The current state of mobile browser performance is pretty dismal. Dont expect this to be playable on any mobile device.

NOTE: I havent actually spent anytime optimizing for performance yet. So it might be possible to make it play well on older browsers, but that's not really what this project is about.

A note on code structure

This project happens to be implemented in javascript (because its easy for prototyping) but is not intended to demonstrate javascript techniques or best practices. In fact, in order to keep it simple to understand it embeds the javascript for each example directly in the HTML page (horror!) and, even worse, uses global variables and functions (OMG!).

If I was building a real game I would have much more structure and organization to the code, but since its just a racing game tech demo, I have elected to KISS.

FUTURE

It's quite astounding what it takes to actually finish a game, even a simple one. And this is not a project that I plan on polishing into a finished state. It should really be considered just how to get started with a pseudo-3d racing game.

If we were to try to turn it into a real game we would have to consider:

  • car sound fx
  • better synchronized music
  • full screen mode
  • HUD fx (flash on fastest lap, confetti, color coded speedometer, etc)
  • more accurate sprite collision
  • better car AI (steering, braking etc)
  • an actual crash when colliding at high speed
  • more bounce when car is off road
  • screen shake when off-road or collision
  • throw up dirt particles when off road
  • more dynamic camera (lower at faster speed, swoop over hills etc)
  • automatic resolution & drawDistance detection
  • projection based curves ? x,y rotation
  • sub-pixel aliasing artifacts on curves
  • smarter fog to cover sprites (blue against sky, cover sprites)
  • multiple stages, different maps
  • a lap map, with current position indicator
  • road splits and joins
  • day/night cycle
  • weather effects
  • tunnels, bridges, clouds, walls, buildings
  • city, desert, ocean
  • add city of seattle and space needle to background
  • 'bad guys' - add some competetor drivers to race against as well as the 'traffic'
  • different game modes - fastest lap, 1-on-1 racing, collect coins ? shoot bad guys ?
  • a whole lot of gameplay tuning
  • ...
  • ...

Related Links

License

MIT license.

NOTE: the music tracks included in this project are royalty free resources paid for and licensed from Lucky Lion Studios. They are licensed ONLY for use in this project and should not be reproduced.

NOTE: the sprite graphics are placeholder graphics borrowed from the old genesis version of outrun and used here as teaching examples. If there are any pixel artists out there who want to provide original art to turn this into a real game please get in touch!

javascript-racer's People

Contributors

jakesgordon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascript-racer's Issues

Adding Tunnel

Your source is very useful to build 2.5D racing game
But unfortunately, I was looking for Racing Game that includes tunnel.

Please attach it if you have made new version with tunnel or please write reference links

Thanks very much for your sharing gold source

Quadnix Plugins: Including launch link in README.

Hello racers,

Let me first say its a great game :)

I am working on a project which can run/host/deploy github projects without any server configuration or provisions. I have used this repository as a demo for you.

Project: http://ppib-dev.us-east-1.elasticbeanstalk.com/docs
Your racer game launch link: http://ppib-dev.us-east-1.elasticbeanstalk.com/launch?id=racer-game

I was hoping if you can evaluate this project, and if you like, can include the launch link in this repo's README.

My aim is to give small projects a "build & run" platform so that you don't have to spend time, money, or energy in maintaining servers or managing deployments.

Regards.

Game crash in background render

Sometimes, after 9 seconds of playing (the first curve to the left of the array of towers), all the sprites dissappear and I have this in Firefox console:
IndexSizeError: Index or size is negative or greater than the allowed amount
in common.js, line 287:
ctx.drawImage(background, sourceX, sourceY, sourceW, sourceH, destX, destY, destW, destH);

captura de pantalla de 2015-06-01 09 25 08

Math and step-by-step race game tutorial.

This is awesome! I'm trying to understand the math behind scenes. But its hard to understand formulas. I took a look at (http://www.extentofthejam.com/pseudo/) but its not enough to see formulas, its hard to put that working programaticaly! Would be awesome a step-by-step tutorial on how create a race game (from begining to end), on how all these things work, using your race game. So we can learn all the steps taken in order. Just a suggestion.

Nice work.

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.