Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Digital Logic Sim

​A minimalistic digital logic simulator · By Sebastian Lague

Snake Game

A topic by BaconLogic created Apr 22, 2025 Views: 583 Replies: 14
Viewing posts 1 to 8
(1 edit) (+1)
I made this prototype Snake game with this logic simulation, Currently you can move throughout the screen via WASD with a length from 0 to 255, a full screen. It runs at 20 Hz (3 ticks per clock cycle at 60 ticks per second). The snake is created by storing you head position, in the 256 byte RAM based on a register storing the address, this registers (lower INC-8) value is greater than a different register (upper INC-8) by your snakes length. Every frame both of these registers increment by one (looping at 255), your heads position stored at the address from the lower register (INC-8) and then the location on the screen that is stored in memory at at address of the upper register (INC-8) is cleared.If you want to see inside any of the components, have suggestions or questions I am happy to answer.

Link to Project files: https://drive.google.com/file/d/1yC2Js7oOm4DtMc6q5uhjBOctHXAT11Vk/view?usp=shari...
Developer(+1)

Awesome! Would love to see a video of it in action if possible :)

https://drive.google.com/file/d/1duDKIEoj3UurVFW4k0fDr-JmfL5ouMQv/view?usp=shari...

Heres a video of it in action, sorry if the formatting is poor. You can see a small error where the snake goes in the wrong direction briefly, I believe this is because the 256 Bytes of RAM slows my ticks per second to 60. I recently (after this video) updated, allowing me to use the pulse to a simpler byte and a near double in speed, I also replaced the dot display with an RGB.

 Hope you enjoy, love the simulation and you videos!

Developer

That’s looking great, thanks for sharing! If it’s not too much trouble could you upload to youtube (or maybe one of the updated version even?) I’d love to add it to the community playlist so more people can see it

I would be more than willing to upload it for the playlist, I'm just finishing the apple mechanics. 

(+1)

The Project is Done!

I added RGB, an apple and mechanics and automatic setup along with bug fixes. Heres a video for the playlist, hope you enjoyed.

Developer

That's very cool -- I love that you even added an apple too! Could you please turn off the 'made for kids' setting on the video though, as I'm unable to add it to a playlist when that's on.

Also, would you be open to sharing the project files for this? (ctrl+alt+shift+o in the app to open where they're stored, and then just upload the project folder to google drive or wherever). I'm trying to assemble a bunch of projects to use as a performance benchmark + to test that I don't accidentally break something while I work on optimizing the sim. Would be a great help :)

I just removed the made for kids setting, as for the project files ctrl+alt+shift+o or cmd+alt+shift+o doesn't appear to do anything. The location with the app contains nothing else, I am more than willing to share, I just cant seem to figure it out at the momnent
Note: I am on a Mac

Developer

Ah - something apparently got messed up with the paths on mac, I still need to look into that. Try the path mentioned in the second post here: https://github.com/SebLague/Digital-Logic-Sim/issues/399

Thanks, here you go: https://drive.google.com/file/d/1yC2Js7oOm4DtMc6q5uhjBOctHXAT11Vk/view?usp=shari...

Developer

By the way I’m still seeing the ‘made for kids’ message, could you check that again?

Perhaps it hasn't updated this is what I see

Developer

Ah it has updated now, just took a little while. And thanks for sharing the files!

As I am interested to build this on Proteus, can tell me how can I implements this step by step?

Hi man, I'd be willing to help you with making snake in a digital simulation but I will be honest, Its not the best but, here is what I would suggest:
1.  Build a RAM that can store you game size^2 x  game size^2. What this means is for a 16x16 game have 256 bytes(0-255) this way you can have each cell on the screen have a number from 0-255, the length of that part
2. Create adders and subtractors that can either do full addition / subtraction or just a fixed rate of 1 is enough
3. Create a counter that can loop over all of the indices of the memory each frame/step, if 1 or higher draw snake, then subtract 1
3. Every frame have  register2  with the snake X and Y, combine them with a bit shift and set that spot in memory to the snake length.

Thats all I have for now, later I will update the google drive files so you can look yourself in DLS. Hope that helps.