Bollard Striker is your chance to experience what happens when you’re “one of them” who isn’t paying attention and smacks straight into a bollard. Yeah, you know the ones—the short poles that somehow manage to sneak up on you and ruin everyone’s day (especially Security Forces). This game is a tongue-in-cheek look at a super common headache for the SF folks at Wright Pat, so I thought we’d have some fun with it! 🙃
- Avoid the bollards. (Too easy, right? 😂)
- Move left and right using the arrow keys. It’s that simple.
- Try not to die. You get 3 chances. Use them wisely.
- Enter your name and see how you stack up on the leaderboard. Are you the worst bollard dodger? Or the least worst?
Because bollard strikes are a thing. Like, a everyday thing. Drivers hitting those poor defenseless bollards are a Security Forces nightmare. But hey, we thought we’d make it fun and let you see if you can avoid the same fate. Spoiler: You probably can’t. 😉
-
Clone the repository:
git clone https://github.com/yourusername/bollard_striker.git cd bollard_striker -
Install dependencies:
npm install
-
Set up Vercel Postgres (see DEPLOY.md for detailed steps):
- Create Postgres database in Vercel Dashboard
- Environment variable
POSTGRES_URLis set automatically - Deploy:
npx vercel --prod
-
Quick deploy:
npx vercel login npx vercel --prod
See DEPLOY.md for complete deployment instructions including database setup.
-
Go into the game folder:
cd bollard_striker -
Set up your virtual environment:
python -m venv venv .venv/scripts/activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the Python version:
python bollard_striker.py
- Bollard dodging action that Security Forces only wish was this fun in real life. Better issue that 1805 and have that report by EOD troop!
- Leaderboard to flex your skills (or lack thereof) by entering your name.
- The sweet satisfaction of not hitting them bollards.
- Pygame runs this bad boy (because Pygame makes everything better).
- Files like
visitor.png,bollard.png, andleaderboard.jsonare included, because we got your back. - If you break it, it’s probably your fault. 😜 Just kidding, submit a pull request and let’s fix it together.
We keep track of who’s the best at not slamming into bollards. At the end of each game, you’ll be asked to input your name so you can cement your legacy (or your eternal shame). Only the greatest—or worst—shall be remembered.
The game now supports a true global leaderboard that works across all players! The backend automatically selects the best available option (in priority order):
- Vercel Postgres (Native) - Vercel's native PostgreSQL database ⭐ Recommended for Vercel deployments
- Supabase - PostgreSQL database with REST API
- Vercel KV - Redis-based key-value store
- Local Storage - Falls back if no global backend is configured
The frontend will automatically detect and use the global leaderboard when available, showing a status indicator.
- Install dependencies (if not already installed):
npm installThis will install @vercel/postgres as specified in package.json.
- In your Vercel project, go to Storage → Create Database → Postgres
- Create a new Postgres database
- Vercel will automatically provide the
POSTGRES_URLenvironment variable - The table will be created automatically on first use, or you can run this SQL in the Vercel dashboard:
CREATE TABLE IF NOT EXISTS leaderboard (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
score INTEGER NOT NULL DEFAULT 0,
level INTEGER NOT NULL DEFAULT 1,
date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_leaderboard_score ON leaderboard(score DESC);- Deploy or test locally:
npx vercel devThat's it! The API will automatically use Vercel Postgres when POSTGRES_URL is available.
- Create a free Supabase project at supabase.com
- In the SQL Editor, run this to create the leaderboard table:
create table if not exists public.leaderboard (
id bigint generated always as identity primary key,
name text not null,
score int not null default 0,
level int not null default 1,
date timestamp with time zone not null default now()
);
-- Enable public read access
alter table public.leaderboard enable row level security;
create policy "public read" on public.leaderboard for select using (true);
-- Writes are done by service role key in the serverless function-
Get your credentials:
- Go to Project Settings → API
- Copy the
Project URL(e.g.,https://xxxxx.supabase.co) - Copy the
service_rolekey (⚠️ Keep this secret!)
-
Set environment variables in Vercel:
- Go to your Vercel project → Settings → Environment Variables
- Add:
SUPABASE_URL= Your project URLSUPABASE_SERVICE_ROLE_KEY= Your service role key
-
Deploy or test locally:
npx vercel dev- In your Vercel project, go to Storage → Create Database → KV
- Create a new KV database
- Vercel will automatically provide these environment variables:
KV_REST_API_URLKV_REST_API_TOKEN
- The API will automatically use KV if Supabase is not configured
- The leaderboard will show "🌐 Global Leaderboard" when connected
- If unavailable, it shows "📱 Local Leaderboard" as fallback
- Use the "🔄 Refresh" button to reload the latest scores
- Scores are automatically submitted to the global leaderboard when you finish a game
Note: The service role key must NEVER be exposed client-side. It's only used in the serverless function at /api/leaderboard.js.
The project uses Vercel's native glob patterns to configure the API functions:
{
"functions": {
"api/leaderboard.js": {
"memory": 1024,
"maxDuration": 10
},
"api/**/*.js": {
"memory": 512,
"maxDuration": 5
}
}
}This configuration:
- Sets specific memory and duration limits for the leaderboard API
- Uses glob patterns (
api/**/*.js) to apply defaults to all API functions - Ensures optimal performance for the leaderboard endpoint
You can customize these settings in vercel.json based on your needs.
- Python 3.6+
- Pygame 2.x
- Fingers capable of pressing left and right keys
Feel like making the game even more ridiculous? Fork the repo and send in your meme-worthy improvements. We’re always open to new ways to make bollard dodging hilarious.
