Game Dev : Let Them Automate! 2/30
In yesterdays post we spent alot of time talking about the pros and cons of adding complexity and that this 30 day challenge is not just about making a game but also showing how it is done. Id like to think that my efforts to far to automate this process will pay off. In reality, its probably going to look more like this! So what have we achieved today?
1 - created a solution to showing todays progress
I was wondering in yesterdays post about how to embed each days progress into a post. I cant pin github pages or itch.io to a branch or version without extra complexity but then it occured ot me an even better solution! Pico8 has an ability to export the game as an image! pretty handy I would say So here is the game I have developed today! Here is how to play it:
- Click on the embedded pico8 terminal just below the photo to activate it. It should make a cute noise and be ready for commands
- Click and drop the .png image onto the terminal. If this doesnt work, try download the .png and then drop it onto the terminal
- Click on the terminal and then type “RUN” (it will be in capitals automatically.)
- Then hit ENTER. Enjoy!

2 - Solved some code issues
I have been focused on learning how the game engine works and how to do some basic things. There are no lists, dictionaries or classes so alot of programming methods are out the window. In yesterdays version, we finished up with having a little spaceship that can fly in 4 directions but cant really shoot a projectile forwards. I really sat on this issue for a while to understand the reasoning behind it. I have to admit, I dont want to use AI to fix the issues for me. This gets the job done but it is not the point of this challenge. I am genuinely trying to learn here, not just learn how to prompt an AI to do it for me. That being said, I still need a teacher and it is acceptable to have a grace period to understand the pico8 way of doing things. For this, there is a good use of these models for elaborating and explaining concepts so I am giving myself a grace period of 7 days to use these tools to ask questions but not to generate code on my behalf. If anyone has suggestions for a great tutorial or guide, let me know!
3 - Automated uploads to itch.io
By using a script, we can easily automate the exporting, zipping, uploading and creating a pico cart for use on this blog. Check out the script at the bottom of the page.
Thats all for today!
Comparing yesterdays result to todays, there isnt a world or difference but there is alot of supporting methods and matters that have been dealt with. My understanding of the programming functions availible have deepened. Perhaps I will spend some time tomorrow reviewing others code to learn the ways of doing things.
Seeya tomorrow!
#!/bin/bash
# picoexport.sh
# Usage: ./picoexport.sh mygame.p8 --day=2
game_file=$1
day_arg=$2
day_num=$(echo $day_arg | grep -oP '(?<=--day=)\d+')
if [ -z "$game_file" ] || [ -z "$day_num" ]; then
echo "Usage: ./picoexport.sh <game.p8> --day=<number>"
exit 1
fi
# Extract game name without extension
game_name="${game_file%.p8}"
# Directories
PICO8_BIN="/home/me/software/pico-8/pico8"
BUTLER_BIN="/home/me/software/butler-linux-amd64/butler"
EXPORT_DIR="/home/me/game-dev/30-day-game-dev-challenge"
GAME_DIR="/home/me/.lexaloffle/pico-8/carts/30-day-game-dev-challenge"
echo "========================================="
echo "PICO-8 Export Script"
echo "========================================="
echo "Game file: $game_file"
echo "Game name: $game_name"
echo "Day number: $day_num"
echo "Working directory: $GAME_DIR"
echo "Export directory: $EXPORT_DIR"
echo ""
# Navigate to game directory
echo "→ Changing to game directory..."
cd "$GAME_DIR" || exit 1
echo " Current directory: $(pwd)"
echo ""
# Clean up old build artifacts
echo "→ Cleaning up old build artifacts..."
rm -f index.html index.js "${game_name}.html" "${game_name}.js" "${EXPORT_DIR}/day${day_num}.zip"
echo " ✓ Removed old files"
echo ""
# Export PNG (for blog)
echo "→ Exporting PNG for blog..."
echo " Command: $PICO8_BIN $game_file -export ${game_name}.p8.png"
$PICO8_BIN "$game_file" -export "${game_name}.p8.png"
echo " ✓ Created: ${game_name}.p8.png"
echo ""
# Export HTML (for itch.io)
echo "→ Exporting HTML for itch.io..."
echo " Command: $PICO8_BIN $game_file -export ${game_name}.html"
$PICO8_BIN "$game_file" -export "${game_name}.html"
echo " ✓ Created: ${game_name}.html"
echo " ✓ Created: ${game_name}.js"
echo ""
sleep 2
# Verify files were created
if [ ! -f "${game_name}.html" ] || [ ! -f "${game_name}.js" ]; then
echo "ERROR: Export failed - files not created"
exit 1
fi
# Show generated files
echo "→ Files before rename:"
ls -lh "${game_name}.html" "${game_name}.js"
echo ""
# Fix HTML to reference index.js instead of game_name.js
echo "→ Fixing HTML to reference index.js..."
sed -i "s/${game_name}\.js/index.js/g" "${game_name}.html"
echo " ✓ Updated JS reference in HTML"
echo ""
# Rename to index.html for itch.io
echo "→ Renaming files for itch.io..."
echo " ${game_name}.html → index.html"
mv "${game_name}.html" "index.html"
echo " ${game_name}.js → index.js"
mv "${game_name}.js" "index.js"
echo " ✓ Renamed successfully"
echo ""
# Show renamed files
echo "→ Files after rename:"
ls -lh "index.html" "index.js"
echo ""
# Verify the HTML references index.js
echo "→ Verifying HTML references index.js:"
grep -o 'src="[^"]*\.js"' index.html || echo " (no .js reference found - this might be an issue)"
echo ""
# Zip the files
echo "→ Creating zip archive..."
zip_name="day${day_num}.zip"
zip_path="$EXPORT_DIR/$zip_name"
echo " Archive: $zip_path"
echo " Files: index.html, index.js"
zip -r "$zip_path" "index.html" "index.js"
echo " ✓ Zip created"
echo ""
# Show zip details
echo "→ Zip archive contents:"
unzip -l "$zip_path"
echo ""
# Push to itch.io
echo "→ Pushing to itch.io with butler..."
echo " Command: butler push $zip_path 444b/30-day-game-dev-challenge:html"
$BUTLER_BIN push "$zip_path" 444b/30-day-game-dev-challenge:html
echo " ✓ Pushed to itch.io"
echo ""
# Copy PNG
png_dest="$EXPORT_DIR/day${day_num}.p8.png"
echo "→ Copying PNG to export directory..."
echo " Source: ${game_name}.p8.png"
echo " Destination: $png_dest"
cp "${game_name}.p8.png" "$png_dest"
echo " ✓ PNG copied"
echo ""
echo "========================================="
echo "✓ EXPORT COMPLETE"
echo "========================================="
echo "PNG saved to: $png_dest"
echo "HTML pushed to: 444b/30-day-game-dev-challenge:html"
echo "Test locally: file://$(pwd)/index.html"
echo "========================================="
Files
30 Day game dev challenge
| Status | In development |
| Author | 444B |
| Tags | Game Design, No AI, PICO-8 |
More posts
- Game Dev : Tutorial Hell 3/3019 hours ago
- Game Dev : hello world! 1/303 days ago
Leave a comment
Log in with itch.io to leave a comment.