Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Pong Circuit-Level Simulation (falstad.com)
189 points by picture on Sept 2, 2021 | hide | past | favorite | 38 comments


This is amazing. The root page for it is here: https://www.falstad.com/pong/index.html and shows how each part works.

Though I don't really understand how an image is produced on a CRT. In this circuit (https://www.falstad.com/pong/net.html), what is "NET" actually connected to?


Pin 10 of F2B on page 3 - https://www.arcade-museum.com/manuals-videogames/P/PongSchem... - which is rendered just below in your link, the 4-input (N)OR. (edit: curiously it's a NOR in the pdf, OR in the simulator.)


The best set of videos explain how hardware can display video is in Ben eater site. It assumes VGA. https://eater.net/vga

I don't what monitor type was assumed in this design but a similar approach could create a classic NTSC signal into a TV. Here is a solution with a micro controller http://eyetap.org/ece385/lab5.htm


A CRT moves the electron beam direction from top-to-bottom, left-to-right. If it sends electrons, the corresponding position on the screen lights up for about 1/50 s. So you can encode your pixels as a 0/1 pulse train, although you do have to take care of the time it takes to move the beam to the next line, and at the end to reset it to the top.

Idk what "NET" is, though.


On another page[1], you can spot NET being OR'd together with PAD1 and PAD2 to VIDEO. I would guess that it's abstracted away on this page for simplicity.

[1] https://www.falstad.com/pong/paddles.html


I think it's PFM. I'm not seeing anything in the simulator that lets you add a CRT type of display.

[Edit] Yeah, this is the case. If you view the page source, there's some custom JS drawing "NET" to a canvas. It's hard coded to pull from specific wires when they cross certain voltage thresholds in the simulation.

[Edit2] The implementation is also very buggy. The CRT simulation is just looping through X&Y completely decoupled from the circuit sim. Simple operations like stopping and running the sim while changing simulation speed will cause it to get off.


I believe it is connected to the little red line you can see if you slow the simulation down. When it is high, the head of the little red line draws a pixel. Otherwise, it doesn't.

You can check this by deleting the input to net and then connecting a wire from some slow moving signal to net (so you can see how it responds in the image).

The CRT itself isn't actually modeled of course -- it is external hardware.


Even more impressive is the analogue version without any ICs!

https://www.eevblog.com/forum/projects/oscilloscope-pong-for...


In the 70's and early 80's you could buy handheld pong game machines that were actually mechanical. The cases were all jazzed up to look like they were electronic, and some even moved a tiny lightbulb around the "screen," but they were all gears and string inside.



What's impressive is the build; even using exactly the same circuit, I would have gone the reliable (ultimately) time-saving route of schematic -> PCB.


If you’re building one then it’s not time saving. I prototype stuff like that is built today and most of the time it stays like it.

Also it doesn’t always work the same when you get it on a PCB


That is very beautiful :)


That's really cool but I think you should understand that it's not 'analogue' if it has a bunch of transistors. This is called discrete because each component does a single operation. I see from the schematics that he builds flip flops from transistors for example.


Um, err, I’m an ex EE. Everything is analogue underneath, even digital. It’s all just shuffling electrons around.

The whole device there is made from discrete opamps. Sure there are some flip flops in there but they are analogue too! (Build one and poke it with a scope and look at the rise and fall times for the collectors)


A quick scan of the schematic and I'm not seeing flip-flops in there. There are analog muxes with the fets, but maybe I missed something?


The function generator page has a flip flop labelled. The multiplexor logic has several unlabelled examples I think.


In that case let's get rid of the term 'digital' then, since analogue must clearly and fully describe all the phenomenon.


> understand that it's not 'analogue' if it has a bunch of transistors.

That's ... not how it works. It's pretty much an analogue computer hardwired to play pong.


Discrete means "separate", "single", "stand-alone" in this context (https://www.sciencedirect.com/topics/engineering/discrete-co...), in contrast to ICs (which, BTW, can also be analog; many analog synthesizers have been built with ICs).


AFAICT, they're mainly running those transistors in the linear region.


I played one of the very first Pong coin-ops as some kind of a market test in the country at the then-new King of Prussia mall in the early 70s, just set out by a fountain. It didn't generate much attention there but very soon afterwards the home versions and coinop CRT cabinets came out as "video arcades" started popping up all over. Culturally, there was a new market and suddenly something to do with your friends that didn't exist before.


Pretty cool, although a digital circuit is overkill for pong...

https://en.wikipedia.org/wiki/Tennis_for_Two


The goal here is less implementing pong and more achiving the pong arcade machine, a seminal piece of computing and gaming history.

Similar to bsnes (now higan) whose primary purpose is less being able to play games and more reproducing how the systems behaves, even if that's inferior in some cases (because it doesn't work around bugs of the original software), because in theory it allows running all software for the system correctly as long as they can be dumped, and thus actually archiving the entire software library rather than just some, or an altered form of it / them.


For those interested, there is a gate-level emulator for discrete logic arcades from the 70s: https://emulation.gametechwiki.com/index.php/DICE

Unfortunately it isn't actively maintained anymore.


Playing this, I found a weird bug where the ball oscillates between bottom and top of the screen. It happens when you hit the ball right at the top of the screen at a specific angle.

Screenshot: https://imgur.com/m119hQH.png


That sounds vaguely familiar. I remember something like that happening with a device from the 1970s, which I can't now identify. I think it was mostly black plastic and offered a choice of about four different games, something like: table tennis, tennis, squash, solo squash. You could sometimes trap the ball between the bat and the top/bottom of screen and "squash" it there, causing the bounce beep to be repeated several times a second, but if you "squashed" it too hard it would pass through the bat to the other side. I can't now remember how you got it out of that state.


Good old falstad.com. used his applets religiously throughout undergrad, many years ago.


I've started diving deeper into EE after having forgotten nearly everything I learned about it in college. Falstad is such an amazing tool! It's so much more immediate and interactive than the average SPICE tool, being able to observe the entire system has helped me a ton.

Are there any other similar tools out there? NI has Multisim, but the interface is buggy and clunky, although it can do AC sweeps and Bode plots, which I wish I could get Falstad to do.


Same. Good thing he rewrote them in JS once applets were phased out.


When I was a kid, my dad had a book full of such maker models for doing special purpose game consoles.

So were the 70's, build your own games console from the ground up.


Nitpick: this looks like a gate-level simulation, not circuit-level. Circuit level means transistors, resistors, ...


That's pretty cool. I've seen that MAME has a netlist solver, so it should be able to play circuit-only games.


MAME created that netlist solver basically to put pong into its code. They also used it to get rid of wav samples of sounds and simulate them. Such as what donkey kong has in it.


Wow! This is very cool


I love how this looks like neurons firing


omg this is so impressive, made me curious on what development approach did he do to create the website


The simulator is based on an applet that's been around for a very long time. The CRT display is simply hacked onto it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: