Cookies

Lassen Sie uns wissen, welche Cookies wir verwenden dürfen. Wenn Sie auf ‘Essentielle Cookies’ klicken,erfassen wir keine persönliche Daten aber Sie helfen uns trotzdem, um die Intrnetseite zu verbessern. Wenn Sie auf ‘Cookies akzeptieren’ klicken, erhalten Sie das bestmöglichte Erlebnis auf unsere Internetseite. Mehr über Datenschutz und Cookies.

  • Fachkundige Beratung
  • LabVIEW Kurs
  • Beratung
  • Turnkey-Lösungen
  • LabVIEW Expertise
  • Wie Wir Das Machen
  • Unsere Projekte
  • Über Uns
  • Kontakt
  • Neuigkeiten
  • Downloads
  • Karriere
  • Blogs
  • NI Hardware Verkauf
  • LabVIEW und NI
  • Newsletter
  • EN
  • NL
  • DE

Blogs

Home > Blogs > Snake on FPGA

Snake on FPGA

Pascal Heinen

 

Here you can download the code to make any NI LabVIEW FPGA your own Snake game console. 800x600 60Hz 8 color VGA signal generation, joystick controlled and fancy graphics. It even features a graphics editor, so you can personalize the game to your liking. Sounds advanced, doesn't it? Well, it's surprisingly easy...

I stumbled across this YouTube video by Ben Eater, where he builds a graphics card using only a breadboard, a crystal oscillator, an EEPROM and some logic ICs. It turns out that generating 800x600 60Hz VGA signals requires a pixel clock of 40 Mhz. That number made me smile. As you all might know, it matches perfect with the clock of the FPGA! You only need 3 digital outputs to generate the VGA signal, 5 to get 8 colors. But my colleagues were not impressed.

I had the VGA signal down. I was drawing squares and I let pixels jump around the screen, but my co-workers were yawning in the background. Danielle challenged me to do a version of the old Snake game that used to be on our phones. Yeah sure, I thought sarcastically, maybe I can add some fancy 3D graphics while I'm at it. But the more I thought about it, the more I could see how it's actually possible. And it works, there is even no code running on RT! Now it's your turn... what can you do? What can you make?

Get the complete source code for Snake on FPGA from GitHub! It contains the code for generating the VGA signal, the graphics editor, Atari CX40 Joystick support, random item placement and 1 and 2 player game modes. The code was written for a NI MyRIO-1900 in LabVIEW FPGA 2018, but you can easily make it work on any other NI LabVIEW FPGA target. The code on GitHub contains it all.

https://github.com/VITechnologies/SnakeOnFPGA

You can modify the project library so it will run Snake on FPGA on your LabVIEW FPGA target.

 

Picture of Snake displayed on a PC monitor

 

You can change the graphics of the game, using the easy to use tileset editor.

 

Depiction of the tile set editor

 

You can implement additional gameplay features. More than 2 snakes, obstacles on the game map, what can you come up with?

 

Block diagram of the Snake On FPGA Main VI

 

Or maybe you just want to extract the VGA VIs and start developing your own game?

 

Illustration of how the VGA socket connection is translated into LabVIEW

 

If you visited NIDays Europe 2019 or the Dutch LabVIEW User Group (DutLUG), you maybe have seen this great 3D printed enclosure my colleague Koen Teeuwen designed. If you fancy some 3D printing, you can download the .STL files in from GitHub repository.

 

Drawing of the 3D-printed enclosure for the NI MyRIO-1900

 

If you have any questions, please don’t hesitate to contact me: [email protected]


Pascal Heinen

 


 

Disclaimer

Neither I nor VI Technologies are responsible for any damage caused to monitors or other hardware. The attached Code is provided As Is. It has not been tested or validated as a product. You assume all risks for use of the code. Make sure that electrical connections are correct and proper.

Mehr Blogeinträge

Why Your Trusty Software Framework Needs Regular Maintenance

Do you have a trusty software framework you rely on every day? It feels reliable, familiar, and helps you get...

GDevCon #5: A Graphical Programming Extravaganza in Stuttgart

The fifth edition of GDevCon, the Independent Graphical Programming Conference, took place in Stuttgart, Germany,...

Introducing Super Network Streams: Robust Connectivity for Your Data

Years ago I presented on Network Streams at an Advanced Usergroup Meeting in Denmark (I remember it very well as...

Creating a Home Automation System with Zigbee and MQTT

Imagine a world where your home knows your preferences before you enter, where your lights, devices and security...

VI Technologies B.V.
Gouverneurlaan 4
6002 EC Weert
The Netherlands

KvK 63846683
+31 495 318100
[email protected]

  • Fachkundige Beratung
  • LabVIEW Kurs
  • Beratung
  • Turnkey-Lösungen
  • LabVIEW Expertise
  • Wie Wir Das Machen
  • Unsere Projekte
  • Über Uns
  • Kontakt
  • Neuigkeiten
  • Downloads
  • Karriere
  • Blogs
  • NI Hardware Verkauf
  • LabVIEW und NI
  • Newsletter
Klicken Sie hier, um uns eine Bewertung zu hinterlassen, wenn Sie mit uns gearbeitet haben. ISO 9001
Hartstichting logo
  • Sitemap
  • Haftungsausschluss
  • Datenschutzerklärung
  • Cookie-Einstellungen
Digital JRNY