Sprint - Exciting Insights
from Translating an Old
Videogame to JavaScript
Norbert Kehrer
ViennaJS Meetup, March 30, 2016
„Sprint“ is a primitive car-racing game,
but it holds interesting aspects
 Atari 1976: Sprint 2
 Arcade machine
 Very l...
This is what Sprint looks like
Fun with Sprint
 Make a browser game
 Make it 3D
 Understand the car AI
 Design new levels
 Use the methods in other ...
Fun with Sprint
 Make a browser game
 Make it 3D
 Understand the car AI
 Design new levels
 Use the methods in other ...
The Sprint arcade machine is based on the
6502 microprocessor
ROM:
Program and
12 race tracks
RAM
128 bytes
Screen RAM
32 ...
Original 6502 code translated to JavaScript
makes up a browser game
ROM:
program
and 12 race tracks
RAM
128 bytes
Screen m...
Fun with Sprint
 Make a browser game
 Make it 3D
 Understand the car AI
 Design new levels
 Use the methods in other ...
Alternative interpretation of the game state
and screen memory makes it a 3D game
Little
Cubes
3D Objects
Camera
Fun with Sprint
 Make a browser game
 Make it 3D
 Understand the car AI
 Design new levels
 Use the methods in other ...
Atari‘s patented method from 1976 ...
... uses direction vectors
Compare the car´s current direction with
the cell´s direction guidance vector...
... and steer a little bit in that direction
Fun with Sprint
 Make a browser game
 Make it 3D
 Understand the car AI
 Design new levels
 Use the methods in other ...
Sprint contains twelve tediously
hand-crafted race tracks
Designing new Sprint levels is a lot of work
Design the race track itself
Define all those
direction vectors
Test it
Automation is a quite hard robotics problem
Design the race track itself
Define all those
direction vectors
Test it
Automa...
Concepts of the potential field method
 Potential field
 Vector field
 Gradient field
Functions
x
y = f(x)
Scalar fields (potential fields)
1
5
9
13
17
21
25
29
R1
R7
R13
R19
R25
R31
-450
-400
-350
-300
-250
-200
-150
-100
-50
0
...
Vector fields
x
y z = f (x, y)
The gradient field indicates the direction of
the steepest slope
Source: „Kurs: Mathematik für Anwender (Osnabrück 2011-20...
Robot path planing by finding an adequate
potential field
Source: Diemke: „Pfadplanung mit harmonischen
Potentialfeldern“
Sprint levels are gradient fields of
„Bobsled tracks“
The lateral and downhill slope definies the
potential field
The potential field of level 1
1
6
11
16
21
26
31
R1
R6
R11
R16
R21
R26
-1
-0,5
0
0,5
1
Applying the potential field method to Sprint
 Obstacles are given (track boundaries)
 Calculate a harmonic potential fi...
Level 1 by the Atari Engineers
Level 1, automatically generated
New level, automatically generated
The calculation is not fast, but slow
 Complex mathematics
 BUT: Unbelievably simple algorithm (Gauss 1823 und
Seidel 18...
Fun with Sprint
 Make a browser game
 Make it 3D
 Understand the car AI
 Design new levels
 Use the methods in other ...
You can use the potential field method
 Path planning for robots
Lawn mowers
Vacuum cleaners
Robo soccer
Autonomous c...
Summary
 Browser Sprint by code translation
 3D Sprint by alternative interpretation
 Patented vector fields for the ca...
Thank you !
http://members.aon.at/nkehrer/
Nächste SlideShare
Wird geladen in …5
×

Sprint - Exciting Insights from Translating a Classic Car Racing Game to JavaScript

835 Aufrufe

Veröffentlicht am

As a follow-up to static binary translation of arcade games to JavaScript, this talk is about the interesting ways to implement simple AI for oponent cars in the classic racing game "Sprint" and how this led me to modern robotics research like the potential field method.

Veröffentlicht in: Technologie
0 Kommentare
1 Gefällt mir
Statistik
Notizen
  • Als Erste(r) kommentieren

Keine Downloads
Aufrufe
Aufrufe insgesamt
835
Auf SlideShare
0
Aus Einbettungen
0
Anzahl an Einbettungen
7
Aktionen
Geteilt
0
Downloads
3
Kommentare
0
Gefällt mir
1
Einbettungen 0
Keine Einbettungen

Keine Notizen für die Folie

Sprint - Exciting Insights from Translating a Classic Car Racing Game to JavaScript

  1. 1. Sprint - Exciting Insights from Translating an Old Videogame to JavaScript Norbert Kehrer ViennaJS Meetup, March 30, 2016
  2. 2. „Sprint“ is a primitive car-racing game, but it holds interesting aspects  Atari 1976: Sprint 2  Arcade machine  Very limited hardware  Black-and-white graphics  Many sequels
  3. 3. This is what Sprint looks like
  4. 4. Fun with Sprint  Make a browser game  Make it 3D  Understand the car AI  Design new levels  Use the methods in other projects
  5. 5. Fun with Sprint  Make a browser game  Make it 3D  Understand the car AI  Design new levels  Use the methods in other projects
  6. 6. The Sprint arcade machine is based on the 6502 microprocessor ROM: Program and 12 race tracks RAM 128 bytes Screen RAM 32 x 286502 Special-purpose video hardware Game logic Video hardware
  7. 7. Original 6502 code translated to JavaScript makes up a browser game ROM: program and 12 race tracks RAM 128 bytes Screen memory 32 x 286502 Special-purpose video hardware Game logic Video hardware JavaScript program JS simulator of the video hardware Browser game
  8. 8. Fun with Sprint  Make a browser game  Make it 3D  Understand the car AI  Design new levels  Use the methods in other projects
  9. 9. Alternative interpretation of the game state and screen memory makes it a 3D game Little Cubes 3D Objects Camera
  10. 10. Fun with Sprint  Make a browser game  Make it 3D  Understand the car AI  Design new levels  Use the methods in other projects
  11. 11. Atari‘s patented method from 1976 ...
  12. 12. ... uses direction vectors
  13. 13. Compare the car´s current direction with the cell´s direction guidance vector...
  14. 14. ... and steer a little bit in that direction
  15. 15. Fun with Sprint  Make a browser game  Make it 3D  Understand the car AI  Design new levels  Use the methods in other projects
  16. 16. Sprint contains twelve tediously hand-crafted race tracks
  17. 17. Designing new Sprint levels is a lot of work Design the race track itself Define all those direction vectors Test it
  18. 18. Automation is a quite hard robotics problem Design the race track itself Define all those direction vectors Test it Automatically by using the potential field method
  19. 19. Concepts of the potential field method  Potential field  Vector field  Gradient field
  20. 20. Functions x y = f(x)
  21. 21. Scalar fields (potential fields) 1 5 9 13 17 21 25 29 R1 R7 R13 R19 R25 R31 -450 -400 -350 -300 -250 -200 -150 -100 -50 0 z = f(x, y)
  22. 22. Vector fields x y z = f (x, y)
  23. 23. The gradient field indicates the direction of the steepest slope Source: „Kurs: Mathematik für Anwender (Osnabrück 2011-2012)“
  24. 24. Robot path planing by finding an adequate potential field Source: Diemke: „Pfadplanung mit harmonischen Potentialfeldern“
  25. 25. Sprint levels are gradient fields of „Bobsled tracks“
  26. 26. The lateral and downhill slope definies the potential field
  27. 27. The potential field of level 1 1 6 11 16 21 26 31 R1 R6 R11 R16 R21 R26 -1 -0,5 0 0,5 1
  28. 28. Applying the potential field method to Sprint  Obstacles are given (track boundaries)  Calculate a harmonic potential field („bobsled track“)  From that, calculate its gradient field  The result is the vector field for the Sprint level
  29. 29. Level 1 by the Atari Engineers
  30. 30. Level 1, automatically generated
  31. 31. New level, automatically generated
  32. 32. The calculation is not fast, but slow  Complex mathematics  BUT: Unbelievably simple algorithm (Gauss 1823 und Seidel 1874)  64-bit floating-point numbers are not exact enough  BigNumber library needed  Slow also because of iteration (30 seconds per level)
  33. 33. Fun with Sprint  Make a browser game  Make it 3D  Understand the car AI  Design new levels  Use the methods in other projects
  34. 34. You can use the potential field method  Path planning for robots Lawn mowers Vacuum cleaners Robo soccer Autonomous cars  Games with moving computer oponents Car racing Mario-Kart-like games Etc.
  35. 35. Summary  Browser Sprint by code translation  3D Sprint by alternative interpretation  Patented vector fields for the car AI  Automatic level generation with the Potential Field Method
  36. 36. Thank you ! http://members.aon.at/nkehrer/

×