Cookies

Laat ons weten welke cookies we mogen plaatsen. Wanneer essentiële cookies aanklikt verzamelen wij geen persoonsgegevens en help je ons de site te verbeteren. Wanneer je Cookies accepteren aanklikt krijg je een optimale website ervaring. Meer over privacy & cookies.

  • Deskundig Advies
  • LabVIEW cursus
  • Consultancy
  • Turnkey Oplossingen
  • LabVIEW Expertise
  • Hoe Wij Het Doen
  • Onze Projecten
  • Over Ons
  • Contact
  • Nieuws
  • Downloads
  • Carrières
  • Blogs
  • NI Hardware te koop
  • LabVIEW en NI
  • Nieuwsbrief
  • 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: pascal@vi-tech.nl

Kind regard,
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.

Meer blogs

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
info@vi-tech.nl

  • Deskundig Advies
  • LabVIEW cursus
  • Consultancy
  • Turnkey Oplossingen
  • LabVIEW Expertise
  • Hoe Wij Het Doen
  • Onze Projecten
  • Over Ons
  • Contact
  • Nieuws
  • Downloads
  • Carrières
  • Blogs
  • NI Hardware te koop
  • LabVIEW en NI
  • Nieuwsbrief
ISO ISO
  • Sitemap
  • Disclaimer
  • Privacy Policy
  • Cookie-instellingen
Digital JRNY