You are browsing as a guest. Sign up (or log in) to start making projects!

Pi - the game!

  • 7 Devlogs
  • 16 Total hours

A Pico-8 game about guessing the digits of pi one at a time! I'm using it to learn Pico-8 and an algorithm to generate digits of pi on the fly, which should be cool!

Ship #1

I made a game about guessing digits of pi in pico-8! It uses the Stanley-Rabinowitz spigot algorithm in real time to generate new digits of pi! I’m really proud of it, and it’s also got a decent amount of polish (the first real game I’ve made in pico-8 honestly).

  • 7 devlogs
  • 16h
Try project → See source code →
Open comments for this post

1h 48m logged

Almost done! Got the delay nearly fully gone with the help of itch user kevinthompson who showed me how coroutines work. I used the coroutines to split up the code that generates a digit of pi after each correct guess over many frames, so it will run at about 50% speed for like a second and then continue on lag free. There was also an edge case there, if the digit hadn’t finished generating and you picked the correct digit, it would say it was wrong! To solve this I made the game just wait for it to finish, and added some static noise to it so you would know it was intentional. Definitely not a perfect solution, but as good as I’ve come up with. I’m also considering adding music to the background, but I haven’t figured it out yet. Kind of annoying for sure…

0
0
11
Open comments for this post

3h 17m logged

Changed the game a lot! It feels much more polished now (better menus, etc) and most notably, the initial loading screen is gone! I made it so now the next digit is generated on the fly instead of in advance so you don’t have to wait for minutes on end before being able to play. There is a major issue though, it makes a pause happen when you get the digit correct which is very jarring. Might look into something like co-routines. You can also play it now! Let me know what you think please!

3
0
20
Open comments for this post

3h 23m logged

Work is being done on the game! I’ve got the main mechanics working (gameplay loop, digit selection and checking, scoring, a timer per digit, high score) but it’s all rudimentary right now. Next I’m going to make a display to see the digit you need to guess with previous digits and other visual things to make the game look better. Hope it goes well!

0
0
16
Open comments for this post

25m logged

Got all the digits working! The issue that was causing it to stop working seemed to be an issue with the 16-bit integer limit, since at a certain point the numbers get too large to have proper precision, so they are off by a bit which causes the numbers to be inaccurate. Now time to actually make the game! Hopefully the easy part.

0
0
5
Open comments for this post

4h 20m 59s logged

I’ve gotten the first 200 digits of pi generated in Pico-8! But the 300th is wrong… okay… a bit of background. First, why am I trying to generate pi, why not just precompute it and store it in rom? Gee I wish. A limitation in Pico-8 is that one cart can only have about 8000 tokens total, and each list element counts as a token, so having a sufficiently large amount of tokens, like 10 000 would literally be impossible, so instead I’ll just compute it when the program loads up and store it in RAM. What is interesting though is how I got this done! I used an algorithm by Rabinowitz and Wagon (link to the paper: http://stanleyrabinowitz.com/bibliography/spigot.pdf) where you start with a bunch of 2s, and do various operations on them from right to left involving division and multiplication to get a number who’s 10s digit is the digit of pi for that iteration. My implementation should be working the same, however for a reason I am yet to figure out it stops working between 200 and 300 digits of pi, most likely due to a small error in my implementation that causes it to drift very slowly, only mattering after a couple hundred digits.

0
0
11

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…