If you ever spent some time playing on the Atari 2600, there’s an excellent chance you went through a few rounds of Combat. The two-player warfare game not only came with the console but was actually one of the more technically impressive titles for the system, offering nearly 30 variations of the core head-to-head gameplay formula.
But unfortunately, none of those modes included single player. That is, until [Nick Bild] got on the case. While some concessions had to be made, he has succeeded where the original developers failed, and added a computer-controlled enemy to Combat. What’s more, the game still runs on the stock 2600 hardware — no emulator tricks required. The true aficionados can marvel at the snippets of source code he’s provided, but the rest of us can just watch the video below the break and marvel at the accomplishment.
If you’ve never worked on such a constrained system, this might not seem like a big deal. But [Nick] does a great job of explaining not just what he did, but why it was so hard to pull off in the first place. For example, the console has no video buffer, so everything needs to be done during the VBLANK period where the game doesn’t need to be drawing to the screen. Unfortunately that didn’t give him enough free cycles, so he had to split his code up to run across three frames instead of just one. That mean’s the original game logic is now only running 27 frames out of the 30 per second, but he says you can’t really tell in practice.
That said, some cuts had to be made. He needed to remove the surprisingly complex engine sounds to free up some resources, and had to bump the 2 KB cartridge up to 4 KB to hold the new code and data. Turns out the 2600 could handle far larger cartridges via bank switching though, so this wasn’t actually a problem.
Given its age and limited capabilities compared to more modern consoles, you might think the Atari 2600 would be little more than a footnote in gaming history. But there’s a devoted group of folks who enjoy squeezing everything they can out of the system’s 45-year-old hardware which leads to labors of love like this one.
11 thoughts on “Combat Gets A Computer Controlled Opponent”
Are the shots curving sometimes? Very first shot of blue, and many afterwards seem to change direction – bug or feature?
There were versions of many of the games where you could choose straight shot, guided shot, or have them bounce off walls in the maze like air hockey (my favorite in the tank-maze version).
The airplane dogfight game with steerable bullets was particularly hilarious b/c the bullets were “behind” the clouds, and your opponent couldn’t see them so only you knew where you were steering it.
These were all very simple ideas, but had a lot of fun potential behind them all. My guess is that they were kept in as options b/c the developers simply couldn’t choose. :)
Atari Combat is a study in early PVP game dynamics, and it’s awesome.
the atari 2600 has separate ‘start’ and ‘select’ buttons. select increments the mode, which is an integer, roughly 0 to 40 or so. the modes control whether the bullets bounce or end at the walls, whether you are a tank/prop plane/jet plane/trio of props vs bomber, what obstacles there are in the level, and, yes, whether your bullets curve. you press fire, and then if you steer your ship while the bullet is travelling, the bullet turns too. with some practice, it can be really devastating…RIP my kids :)
I would be interested to read more about how the ML was trained :-) very cool though!
No “machine learning” involved. Straight programming in assembly language for the 6502.
It uses a k-nearest neighbor algorithm, so ML is involved.
I saw the knn values on github, how they were determined is what interests me – was there another AI system playing games that were observed for example? I am not trying to take anything away from the creator here, just interested in how it was done :-)
It’s supervised learning — e.g. for this set of observed values, here is what the best course of action would be. Repeat for a bunch of observations.
knn does not necessarily mean ML … knn is “just” a way to efficiently find points that are close to a query point.
(In ML this is used to find n training points around the query point, their labels are then used as a prediction)
>> (In ML this is used to find n training points around the query point, their labels are then used as a prediction)
That’s how this works.
Zach Matley make other Tank AI variation in 2003:
ROMS available in Internet (search by TANK AI Zach Matley)
Please be kind and respectful to help make the comments section excellent. (Comment Policy)