|
1 |
| -# Racer-Mania |
2 |
| -Simple JavaScript Racing game with physics implementation and real-time adjustments |
| 1 | +Javascript Pseudo 3D Racer |
| 2 | +========================== |
| 3 | + |
| 4 | +An Outrun-style pseudo-3d racing game in HTML5 and Javascript |
| 5 | + |
| 6 | + * [play the game](http://codeincomplete.com/projects/racer/v4.final.html) |
| 7 | + * view the [source](https://github.com/jakesgordon/javascript-racer) |
| 8 | + * read about [how it works](http://codeincomplete.com/posts/2012/6/22/javascript_racer/) |
| 9 | + |
| 10 | +Incrementally built up in 4 parts: |
| 11 | + |
| 12 | + * play the [straight road demo](http://codeincomplete.com/projects/racer/v1.straight.html) |
| 13 | + * play the [curves demo](http://codeincomplete.com/projects/racer/v2.curves.html) |
| 14 | + * play the [hills demo](http://codeincomplete.com/projects/racer/v3.hills.html) |
| 15 | + * play the [final version](http://codeincomplete.com/projects/racer/v4.final.html) |
| 16 | + |
| 17 | +With detailed descriptions of how each part works: |
| 18 | + |
| 19 | + * read more about [v1 - straight roads](http://codeincomplete.com/posts/2012/6/23/javascript_racer_v1_straight) |
| 20 | + * read more about [v2 - curves](http://codeincomplete.com/posts/2012/6/24/javascript_racer_v2_curves/) |
| 21 | + * read more about [v3 - hills](http://codeincomplete.com/posts/2012/6/26/javascript_racer_v3_hills/) |
| 22 | + * read more about v4 - final (coming soon) |
| 23 | + |
| 24 | +A note on performance |
| 25 | +===================== |
| 26 | + |
| 27 | +The performance of this game is **very** machine/browser dependent. It works quite well in modern |
| 28 | +browsers, especially those with GPU canvas acceleration, but a bad graphics driver can kill it stone |
| 29 | +dead. So your mileage may vary. There are controls provided to change the rendering resolution |
| 30 | +and the draw distance to scale to fit your machine. |
| 31 | + |
| 32 | +Currently supported browsers include: |
| 33 | + |
| 34 | + * Firefox (v12+) works great, 60fps at high res - Nice! |
| 35 | + * Chrome (v19+) works great, 60fps at high res... provided you dont have a bad GPU driver |
| 36 | + * IE9 - ok, 30fps at medium res... not great, but at least it works |
| 37 | + |
| 38 | +The current state of mobile browser performance is pretty dismal. Dont expect this to be playable on |
| 39 | +any mobile device. |
| 40 | + |
| 41 | +>> _NOTE: I havent actually spent anytime optimizing for performance yet. So it might be possible to |
| 42 | + make it play well on older browsers, but that's not really what this project is about._ |
| 43 | + |
| 44 | +A note on code structure |
| 45 | +======================== |
| 46 | + |
| 47 | +This project happens to be implemented in javascript (because its easy for prototyping) but |
| 48 | +is not intended to demonstrate javascript techniques or best practices. In fact, in order to |
| 49 | +keep it simple to understand it embeds the javascript for each example directly in the HTML |
| 50 | +page (horror!) and, even worse, uses global variables and functions (OMG!). |
| 51 | + |
| 52 | +If I was building a real game I would have much more structure and organization to the |
| 53 | +code, but since its just a racing game tech demo, I have elected to [KISS](http://en.wikipedia.org/wiki/KISS_principle). |
| 54 | + |
| 55 | +FUTURE |
| 56 | +====== |
| 57 | + |
| 58 | +It's quite astounding what it takes to actually [finish](http://codeincomplete.com/posts/2011/9/21/defining_finished/) |
| 59 | +a game, even a simple one. And this is not a project that I plan on polishing into a finished state. It should |
| 60 | +really be considered just how to get started with a pseudo-3d racing game. |
| 61 | + |
| 62 | +If we were to try to turn it into a real game we would have to consider: |
| 63 | + |
| 64 | + * car sound fx |
| 65 | + * better synchronized music |
| 66 | + * full screen mode |
| 67 | + * HUD fx (flash on fastest lap, confetti, color coded speedometer, etc) |
| 68 | + * more accurate sprite collision |
| 69 | + * better car AI (steering, braking etc) |
| 70 | + * an actual crash when colliding at high speed |
| 71 | + * more bounce when car is off road |
| 72 | + * screen shake when off-road or collision |
| 73 | + * throw up dirt particles when off road |
| 74 | + * more dynamic camera (lower at faster speed, swoop over hills etc) |
| 75 | + * automatic resolution & drawDistance detection |
| 76 | + * projection based curves ? x,y rotation |
| 77 | + * sub-pixel aliasing artifacts on curves |
| 78 | + * smarter fog to cover sprites (blue against sky, cover sprites) |
| 79 | + * multiple stages, different maps |
| 80 | + * a lap map, with current position indicator |
| 81 | + * road splits and joins |
| 82 | + * day/night cycle |
| 83 | + * weather effects |
| 84 | + * tunnels, bridges, clouds, walls, buildings |
| 85 | + * city, desert, ocean |
| 86 | + * add city of seattle and space needle to background |
| 87 | + * 'bad guys' - add some competetor drivers to race against as well as the 'traffic' |
| 88 | + * different game modes - fastest lap, 1-on-1 racing, collect coins ? shoot bad guys ? |
| 89 | + * a whole lot of gameplay tuning |
| 90 | + * ... |
| 91 | + * ... |
| 92 | + |
| 93 | +Related Links |
| 94 | +============= |
| 95 | + |
| 96 | + * [Lou's Pseudo-3d Page](http://www.extentofthejam.com/pseudo/) - high level how-to guide |
| 97 | + * [Racer 10k](https://github.com/onaluf/RacerJS) - another javascript racing game |
| 98 | + |
| 99 | +License |
| 100 | +======= |
| 101 | + |
| 102 | +[MIT](http://en.wikipedia.org/wiki/MIT_License) license. |
| 103 | + |
| 104 | +>> NOTE: the music tracks included in this project are royalty free resources paid for and licensed |
| 105 | +from [Lucky Lion Studios](http://luckylionstudios.com/). They are licensed ONLY for use in this |
| 106 | +project and should not be reproduced. |
| 107 | + |
| 108 | +>> NOTE: the sprite graphics are placeholder graphics [borrowed](http://pixel.garoux.net/game/44) from the old |
| 109 | +genesis version of outrun and used here as teaching examples. If there are any pixel artists out there who want to |
| 110 | +provide original art to turn this into a real game please get in touch! |
| 111 | + |
0 commit comments