I found out that Open AI's ChatGPT understands programming, including Pico 8 LUA. I had it create something simple, a pong game. I did create the sound effects, but 99.9% of the code was created by ChatGPT. I found the best way to get it to add more code without timing out is to just request it to create code snippets for _draw() and or _update()
p1_y = 36 p2_y = 36 ball_x = 64 ball_y = 36 ball_vx = 1 ball_vy = 1 p1_score = 0 p2_score = 0 game_state = "start" function _update() if game_state == "start" and (btn(4) or btn(5)) then game_state = "play" p1_score = 0 p2_score = 0 end -- move the paddles if btn(0) then p1_y -= 1 end if btn(1) then p1_y += 1 end if btn(2) then p2_y -= 1 end if btn(3) then p2_y += 1 end -- clamp the paddles to the screen p1_y = mid(8, p1_y, 68) p2_y = mid(8, p2_y, 68) -- move the ball ball_x += ball_vx ball_y += ball_vy -- bounce the ball off the paddles if ball_x < 3 and ball_y > p1_y-4 and ball_y < p1_y+4 then ball_vx = -ball_vx sfx(1) end if ball_x > 123 and ball_y > p2_y-4 and ball_y < p2_y+4 then ball_vx = -ball_vx sfx(1) end -- bounce the ball off the top and bottom of the screen if ball_y < 0 then ball_vy = -ball_vy sfx(0) end if ball_y > 72 then ball_vy = -ball_vy sfx(0) end if ball_x < 0 then sfx(2) p2_score += 1 ball_x = 64 ball_y = 36 ball_vx = 1 ball_vy = 1 end if ball_x > 128 then sfx(2) p1_score += 1 ball_x = 64 ball_y = 36 ball_vx = -1 ball_vy = 1 -- check for game over if p1_score >= 10 or p2_score >= 10 then -- check for input to restart the game if btn(4) or btn(5) then p1_score = 0 p2_score = 0 ball_x = 64 ball_y = 36 ball_vx = 1 ball_vy = 1 end end end end function _draw() cls() -- check the game state if game_state == "start" then -- clear the screen cls() -- display the start screen print("gpt-pong", 48, 24, 7) print("credits: by. chatgpt", 32, 36, 7) print("press x or o to start game", 24, 48, 7) elseif game_state == "play" then cls() -- draw the paddles and ball rectfill(0, p1_y-4, 2, p1_y+4, 7) rectfill(126, p2_y-4, 128, p2_y+4, 7) circfill(ball_x, ball_y, 2, 7) -- draws the player scores print(p1_score, 4, 2, 7) print(p2_score, 118, 2, 7) -- check for game over if p1_score >= 10 or p2_score >= 10 then -- clear the screen cls() -- display the winner if p1_score >= 10 then print("player 1 wins!", 32, 36, 7) else print("player 2 wins!", 32, 36, 7) end -- display the restart message print("press x or o to restart the game", 32, 48, 7) end end end
Hello there. I'm working on a TV console utilizing a Raspberry Pi 3B+, but any Raspberry Pi should work in theory. Essentially, this takes some of my previous cad projects and crams it into something awesome. I present the nameless console(needs a name).
A USB SD card reader functions as a cartridge slot and I made 3D printable shells to go around the SD cards to give them a cartridge look and feel. A bash script loads when the Pi gets turned on that looks for a PICO8 game on the SD card. This can work with other fantasy consoles. I haven't figured out how to get multi-cart games to work with one SD card, but for now, single cart games should work. Right now the TV console project is in beta, but the cad files and startup scripts will be open source.
What I would like is suggestions for this project. I will update later with guides on setting this up. This project can also be used as a template for your own projects if you want.
A couple of pictures of me playing some games.
I need to figure out what I want to do with the front two buttons. I could map them as power and reset, or I could remove them completely. Also, I need to make the console a little bit larger to make plugging in a USB extender into the SD card reader less difficult. In the current design, I have to cut the rubber housing on the USB extender and bend the USB plug 90 degrees, which could damage it. Lastly, I want to figure out how to make cartridges work with multicart games, which I'm unsure how to get that part to work.
I'm looking for suggestions and feedback. Constructive criticism is also welcome.
Hello again. I received my C64 Maxi (TheC64) yesterday and turned it into a Pi powered retro computer. It works great, but required some manually configuring to get fully working. The keyboard works out of the box, but the joystick does not and requires you to compile the SDL2 key mapper software. You could even code Pico 8 games on this thing. I chose Retropie so I can easily select and play C64 games and try out other retro computer emulators.
What is a C64 Maxi? It is the bigger brother of the C64 Mini. It has a full sized working keyboard and you can easily play games or code on it. The downside is the default system is hard-coded for a 720p screen resolution. My old Dell VGA monitor doesn't support this screen resolution
Why? I wanted to use my old square VGA Dell monitor for C64 games and try seeing if I could use the keyboard on Pico 8. Also, the mod I did doesn't alter the default Maxi boards in any way. I disconnected the keyboard and created a USB adapter that plugs into the C64 Maxi keyboard. If I want to go back to a stock configuration, I'm able to. Do I recommend this mod? Yes I do.
Hello again. I saw that someone was able to display Pico 8 on a CRT monitor, so I wanted to do the same. If you have any questions or want help getting Pico 8 to display on a CRT monitor, post down below and I can try to help. I was able to do this on a Pi Zero and a Pi 3b+. The hardest part of this project for me wasn't getting the display to work with my Pi 3b+, but USB audio not wanting to cooperate. I tried using the audio jack on my Pi, but it was interfering with the soldered wires I had. It all works now. This is officially my favorite way to play. Yes, playing on a handheld is cool and all, but Pico 8 looks amazing on a CRT.
I've seen that some people have made their own boot animation carts, but I would like to make my own, and have it where it will run a command at the end of the animation that makes Pico 8 boot into splore.
This is how it could work in a dedicated Pico 8 machine:
Turn on machine > autorun Pico 8 via bash script or something else with the -run animationcart.p8.png command at the end> animation runs > code at end of cart executes extcmd(splore) or another command that makes Pico 8 go to splore.
I've came up a idea to go around doing this, but it is too clunky. I could make a bash script that runs 2 instances of Pico 8 at the same time. One will boot into Pico 8 and run the cart, but shutdown that instance of Pico 8 afterwards, then the other Pico 8 instance would still be running and be in splore.
I would like to see this added in a future version of Pico 8 if possible. Thanks for making Pico 8 and have a great day.
Hello again. I've been working on different ideas for running Pico 8 games on physical media.
I've tried SD cards and while they are cool and can function as cartridges, they tend to have too much storage and I find that wasteful when Pico 8 games are less than a megabyte. I have been experimenting with other ideas such as using 3.5" floppies. They are much more smaller in storage compared to a SD card, but they have their own setbacks.
What would you recommend I try to use as physical media for Pico 8 games? I could try ROM cartridges, but they will probably be the most expensive route and be the most complicated.
Here is a picture of a Pico 8 game I put on floppy.
The tutorial I made for mounting SD cards 'should' work for floppies with slight changes.
I'm not going to sell Pico 8 games that aren't mine on physical media, I'm just trying out new ideas.
I was working on a new project that involved learning how rom cartridges worked, so I asked around for help and someone suggested that I use SD cards. I ended up liking the idea and decided to use that in my current Pico 8 fanmade handheld project as well. What I did was created a shell that goes around a SD card to give it a cartridge look and feel. A USB SD card reader will read the 'cartridges'. I also wrote a bash script that will search for a p8.png file in your SD card directory and have Pico 8 run that file or run splore instead if no SD card cartridge was connected. Firstly, when you plug in a SD card to your card reader, you should type in
sudo fdisk -l
. This should list your SD card. Mine was listed as /dev/sda1
I then mounted the SD card and made sure Pico 8 could run the file. While in my Pico 8 directory, I typed in
./pico8 -run /media/usb0/run.p8.png
and Pico 8 ran the file, but use whatever directory you mount your SD card in. Why did I call the cartridge run.p8.png? I tried just using
./pico8 -run /media/usb0/*p8.png
, but I thought, if I had multiple cartridges on the same SD card, it would pick one out of random, and I didn't want that, especially for multicart games. Maybe there is a better way at doing this. If there is, please let me know. I made it where the first cartridge can be called run.p8.png, but other cartridges can be called whatever you want. I modified /etc/rc.local and added a line before the screen driver where it would mount the SD card. For me, I put in
sudo mount /dev/sda1 /media/usb0
I then created a bash script that would either load a game from a SD card cartridge or run splore if there was no cartridge connected.
Here is the bash script below: I named it autorunpico8.sh, but you can call it whatever you want.
#!/bin/bash if [ -f "/media/usb0/run.p8.png" ] then exec /home/pi/pico-8/pico8 -run /media/usb0/run.p8.png & else exec /home/pi/pico-8/pico8 -splore & fi exit 0
Once you create the file, you will want to make it executable by typing in
chmod +x yourscripthere.sh
Test out the script and see if it works. If it does, put the script in /etc/rc.local above exit 0 at the bottom of the file.
When you turn on your Raspberry Pi, Pico 8 will load the cartridge.
When there is no 'cartridge' connected to your SD card reader it boots into splore, but if you really want to, you can make a 100% offline system and make it only look for cartridges.
I will upload the cartridge shells on my Thingiverse page soon enough. The front of the cartridge shell allows you to use custom artwork and you can modify the top text to be anything you want. You slide in a SD card and if it isn't a snug fit, hot glue gun might help keep it in place. The back plate of the cartridge can be removed so you can remove the SD card if it stops working. I hope this tutorial is useful and these cartridges can be used in your Pico 8 projects. Have a wonderful day.
Hello again. I am working on a fan handheld for the Pico 8. Once this project is finished, I'll upload all the cad files onto Thingiverse and create a guide on how to create your own Pico 8 handheld. This is what the first prototype shell looks like.
The button spacing feels perfect, but the shell is too wide. Fortunately, it seems like I can shrink it down roughly 5mm so it will be around the same thickness of a Dmg-01 Gameboy. The rounded edges makes it feel comfortable to hold. I might reposition the battery holder location so I might be able to shrink it down another 5mm. I'll take any suggestions for this project as I want this to as good as possible. My goals for this project:
What I have done so far:
I have most of the parts already, besides a speaker, controller board, and power switch, but I will look for solutions for those. Once I'm happy with all the components, I'll print some mounting plates to hold the various hardware, add some screw holes to hold the parts in place, and make a battery door so you can replace your AA batteries. Feel free to leave a comment if you have any suggestions for this project.
Thanks for your time,
Update: I am working on the back plate of the shell. This is what I have designed so far.
The back plate has a battery door and housing for the battery holder that will use 3 AA batteries. I'm thinking of using the whole back plate to mount all the electronics.
This is what the console looks like assembled from the back.
Next on this project, I'm going to work on the controls and sound. Once that is done, I will create spots on the back plate to mount all the electronics.
Update: I finished the first beta version of my handheld. The handheld is fully assembled, but I came across glaring issues. One of those is the fact the buttons are not keyed in, so the round plastic buttons will freely rotate. The other issues are software related. I'm going to upload the cad files without the Pico 8 logo. I will not write a tutorial yet as it is incomplete, but I can help people with getting the screen, power button, and general controls to work. You are allowed to do anything you want with the cad files I'm going to be uploading to Thingiverse.
Edit: I have uploaded the beta cad files for those who want to modify what I've done. I have included .step and stl files so you can modify or make your own. I will be writing a large blog post on how to make one, for those who are interested, including getting the software side of things working.
Hello there. My name is Grhmhome and I've been working on a fan handheld for Pico 8, using a Pi Zero W. I've been working on this project for roughly a week now. I'm proficient with Cad, 3D printing, and I've been learning soldering. I wanted to make a handheld for the Pico 8 with the correct aspect ratio screen and I finally found the perfect screen for my project. This post is a quick tutorial on how to get the Waveshare 128x128 RGB OLED display module to work properly. This took me all of yesterday to get to work properly as I had to troubleshoot and do more troubleshooting.
Where to find this screen?
I used the latest version of RetroPie for this project.
Step 1. Wiring the screen. The pins I used are as follows. The connector that comes with the display should be color coded.
VCC (Power +): Any 3.3V GND (Power -): Any GND DIN: GPIO 10 MOSI CLK: GPIO 11 CLK CS: GPIO 8 CE0 DC: GPIO 25 RST: GPIO 24
If you need help on figuring which pin are which, I used this handy site: https://pinout.xyz/
Type sudo raspi-config and enable SPI interfaces. You will also want to configure your system to autologin as Pi and boot into the terminal. If you are using RetroPie like me, you will also have to go into the RetroPie settings and make sure your not booting directly into Emulationstation, but into the terminal and have it autologin as Pi.
Step 3. Install wiring pi and cmake. If your OS doesn't have git, install that too.
sudo apt-get update sudo apt install cmake sudo apt install wiringpi sudo apt install git
Step 5. Clone the git repo
git clone https://github.com/juj/fbcp-ili9341.git
Step 6. Edit some of the files. You will need to edit config.h and change
Also you will want to edit ssd1351.cpp and change the values on line 35 from 97 to 127.
On ssd1351.h you will want to change #define DISPLAY_NATIVE_HEIGHT 96 to 128 on line 21.
Step 7. Once you finish doing that copy the following commands into the terminal.
mkdir build cd build cmake -DSSD1351=ON -DGPIO_TFT_DATA_CONTROL=25 -DGPIO_TFT_RESET_PIN=24 -DSPI_BUS_CLOCK_DIVISOR=20 -DSTATISTICS=0 .. make -j
Make sure the display is working by typing in
If the display is working correctly, continue on. If it is not working, you will have to make sure the screen is connected to the correct GPIO pins.
Step 8. Next, you will want to make sure the display driver will autostart when you turn on your Pi Zero. Edit /etc/rc.local and add the following above the line that says exit 0
sudo /home/pi/fbcp-ili9341/build/fbcp-ili9341 &
After that, you will want to edit /boot/config.txt and add the following
hdmi_group=2 hdmi_mode=87 hdmi_cvt=128 128 60 hdmi_force_hotplug=1
If you want to autostart Pico 8, which I'm assuming you are wanting, add another line in /etc/rc.local above exit 0. Change the path accordingly wherever you decided to put Pico 8.
sudo /home/pi/pico-8/pico8 -splore &
Now, when you reboot your system, it should boot directly to Pico 8 every time using the display. I hope this tutorial was helpful. If you have any questions, or if I'm missing anything, feel free to leave a message.