7 ms·
Asteroids: By the Numbers
- mturmon 6y agoThis is a fun game to implement. You get a lot of varied gameplay for a small amount of code. You need an event loop, and a basic object-oriented model where all game objects have movement operations, shape vector lists, hit boxes, and object transitions upon death. Typical object state is position and velocity, and possibly an age counter. So, the player, each asteroid, the bullets, and the attacking aliens all have the same prototype. Very clean. I did it in assembler on a PDP-11 with bitmap graphics a long time ago. 100% fun.
- chris__ 6y agoGreat in-depth breakdown. Wish I had seen this while working on the different clone versions I made a while back. Could have made them a lot more accurate to the original. Best one I did was with WebGL http://60fpsordie.com/asteroids/ http://60fpsordie.com/asteroids/ (sorry doesn’t work on mobile)
- FatalLogic 6y ago>In 1979, arcade cabinet screens were limited to a few hundred pixels on a side, so the player's ship was only connected graphically by about 20 points. This meant, in turn, that there were only a limited number of orientations that they could render for the ship, in this case intervals of 5 degrees. I don't know if it is a mistake, but it's strange to talk of pixels, because this game uses a vector monitor, not a bitmapped display. There are no pixels really. The 5 degree rotational step may have been due to some other limitation, perhaps of integer arithmetic, or limited storage space for a pre-calculated look up table, or using an 8 bit variable?
- retroanalyst 6y agoYou’re correct, pixels is the wrong term there. Vector monitors were limited in where they could put points, however, so there was still an effective resolution limit. I’ll correct the entry.
- rbanffy 6y agoAlong with the addressability (effectively deflection DAC's resolutions), the other big limitation of vector displays was the number and length of vectors they could show (itself a function of beam intensity and how fast the deflection mechanism could point it) without the display flickering. Some terminals from that time used very long persistence phosphor to allow more lines to be drawn. Even then, sometimes, the amount of information shown forced them to flicker in seizure-inducing ways. The CDC 6x00 consoles packed so much information the fonts themselves ended up deformed by the inability of the deflection coils to keep up with the data.
- retroanalyst 6y agoThanks! Didn't know that. Gamasutra had an interview with Ed Logg last year where he talked about hardware limitations. A portion from it: "Logg: There were no difficult or technical issues. Of course there were limitations such as the amount of stuff I could draw and still update the game at 60Hz. The limited RAM also limited the number of asteroids I could draw so you may see some large asteroids go away with a single shot if the screen if full. There was issue of the spot killer that was interesting. The spot killer was a feature added so that if the game crashed when the beam was on that it did not burn a hole in the phosphor on the screen. Thus I needed to have enough deflection on the screen so the spot killer did not turn off the beam. Therefore I put the copyright on the bottom of the screen and the scores at the top. However, no one told me how much deflection was actually needed and I found out later this was not quite enough, so on some games the screen would dim if the player ship and the3 remaining asteroids were at the right spots on the screen." https://www.gamasutra.com/blogs/DavidCraddock/20190913/350030/Outstanding_Ideas_Ed_Logg_on_Asteroids_and_Gauntlet.php https://www.gamasutra.com/blogs/DavidCraddock/20190913/35003...
- n3k5 6y agoThanks; seems like a superb analysis (in my extremely non-expert opinion†). > addressability (effectively deflection DAC's resolutions) So I guess from the perspective of how precisely a programmer could position vectors — and therefore how many distinct rotations would make sense — this limit in resolution was the ultimate deciding factor. There's a limit where more fine-grained angles/positions would have been pointless. But then, in turn, the DAC wasn't necessarily limited to that many bits because more wouldn't have been feasible, but because trying to position a vector more precisely would have been defeated in practice by the error introduced by the deflection coils, which can only be so accurate when you yeet the beam all over the place. My working hypothesis is that it would have been possible to make a display with more precise positioning, but only for the rare case when you wanted to display extremely little information, such as a single moving dot, which was too niche and silly to spend resources on. Does that sound about right? Just curious if I'm understanding the issue somewhat correctly. † I know almost nothing about the topic but it seems analogous to aiming lasers with mirrors on computer-controlled actuators. Which was a rare treat in my childhood and has recently become accessible to modestly prosperous hobbyist hackers. Check out https://youtu.be/tozuzV5YZ7U https://youtu.be/tozuzV5YZ7U for a quick taste. You'll probably want to watch the BTS next: https://www.youtube.com/watch?v=8YONOexk0Eke https://www.youtube.com/watch?v=8YONOexk0Eke . Oh and look, here's a thing that exists: Recreating Asteroids with lasers - Seb Lee-Delisle at An Evening of Unnecessary Detail — https://youtu.be/0RPHS1dlh_g https://youtu.be/0RPHS1dlh_g (Only 4168 views, WTF?)
- thelazydogsback 6y agoMy son just happens to be playing Scramble (Defender) on my old Vectrex as we speak! Of course, it comes w/Mine Storm (Asteriods/Space War) built-in. (Though I think it needs some new capacitors, as the vector retrace isn't as seamless as it used to be.) There is still something magical about vector gfx to me -- I much prefer "notional" graphics to realistic ones, but I guess 'cause I'm old...
- unoti 6y agoI started experimenting with WebAssembly a while back, and started writing Asteroids in C, hosted in a web page via webassembly. It's not done yet, but it's a real fun way to experiment both with asteroids and with C, and with webassembly: C code for asteroids: https://github.com/unoti/webasm-concept/blob/master/asteroids/asteroids.c https://github.com/unoti/webasm-concept/blob/master/asteroid... Javascript code for the X/Y vector display device that the C code talks with: https://github.com/unoti/webasm-concept/blob/master/asteroids/vector_display.js https://github.com/unoti/webasm-concept/blob/master/asteroid...
- MegaDeKay 6y agoHere is a deep dive into the circuits used by Asteroids and other vector games. Digital & analog vector generators, gate arrays, the Math Box, and more. https://www.jmargolin.com/vgens/vgens.htm https://www.jmargolin.com/vgens/vgens.htm