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.
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Sprint - Exciting Insights from Translating a Classic Car Racing Game to JavaScript
1. Sprint - Exciting Insights
from Translating an Old
Videogame to JavaScript
Norbert Kehrer
ViennaJS Meetup, March 30, 2016
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
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. Fun with Sprint
Make a browser game
Make it 3D
Understand the car AI
Design new levels
Use the methods in other projects
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. 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. Fun with Sprint
Make a browser game
Make it 3D
Understand the car AI
Design new levels
Use the methods in other projects
17. Designing new Sprint levels is a lot of work
Design the race track itself
Define all those
direction vectors
Test it
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. Concepts of the potential field method
Potential field
Vector field
Gradient field
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. 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
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. Fun with Sprint
Make a browser game
Make it 3D
Understand the car AI
Design new levels
Use the methods in other projects
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. 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