For pygame developers and game jammers
Make games in real Python. Right in the browser.
Your pygame game runs in a browser tab as you wrote it: pygame-ce on WebAssembly. No installs, no servers, hosted in the EU.
Want to see it first? Play the sample games
PyCorner is in private beta. Ask for an invite and tell me what you're making.
Free
Try it with your own game
- Up to 3 apps or games
- Real pygame-ce, keyboard, mouse and sound
- Share a game with a link
- Import from Git
Pro For shipping games
For people who make games regularly
or €90 a year, two months free
- 10 apps or games
- Import a pygame project as a zip, with a browser report
- Private games, shared with the people you pick
- Git sync and versions you can roll back
- AI coding help on EU-hosted models
- Desktop and mobile export for instant Python games (PyLevate)
Pro opens soon.
Request early accessTeams and studios: see all plans. Prices include VAT for EU consumers.
Your game loop, unchanged
PyCorner rewrites a desktop while running: loop so each frame waits for the browser. Most games run as they are.
See what runs before you start
Import a zip and get a report on what a browser can't do: threads, sockets, some packages and sound formats.
No servers to run
The game runs on the player's device. Nothing to host or scale, however many people play.
Hosted in the EU
A European company on European servers. Your code stays plain Python you can take with you.
Desktop pygame, in a tab
Write it the way you always have. The blocking calls wait for the browser's next frame instead of freezing the page.
# main.py: a plain pygame loop, unchanged for the browser
import pygame
pygame.init()
screen = pygame.display.set_mode((480, 270))
clock = pygame.time.Clock()
INK, VIOLET = (20, 20, 22), (79, 70, 229)
GRASS, BRICK, MORTAR = (63, 163, 77), (181, 101, 58), (138, 69, 38)
JUMP = (pygame.KEYDOWN, pygame.MOUSEBUTTONDOWN)
GROUND, S = 214, 3 # S: screen pixels per sprite pixel
x, y, vx, vy = 40.0, GROUND - 42.0, 2.5, 0.0
def mascot(x, y):
"""Our 16x16 pixel mascot, drawn square by square."""
def px(color, c, r, w, h):
rect = (x + c * S, y + r * S, w * S, h * S)
pygame.draw.rect(screen, color, rect)
px(INK, 3, 1, 10, 7) # head
px("white", 5, 3, 2, 2) # eyes
px("white", 9, 3, 2, 2)
px(VIOLET, 2, 9, 12, 2) # body
px(VIOLET, 3, 11, 2, 3) # legs
px(VIOLET, 11, 11, 2, 3)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type in JUMP and y >= GROUND - 42:
vy = -9 # on the ground: jump
x += vx
if x < 0 or x > 480 - 48:
vx = -vx
vy += 0.5
y = min(y + vy, GROUND - 42)
screen.fill((247, 246, 242))
pygame.draw.rect(screen, GRASS, (0, GROUND, 480, 6))
pygame.draw.rect(screen, BRICK, (0, GROUND + 6, 480, 50))
for bx in range(0, 480, 32):
pygame.draw.rect(screen, MORTAR, (bx, GROUND + 6, 2, 50))
mascot(int(x), int(y))
pygame.display.flip()
clock.tick(60) # waits for the browser, not the CPU
Python and pygame load in this tab first, which takes a few seconds. Then click the game and press any key to jump.
Questions pygame developers ask
- Do I have to rewrite my game for the browser?
- No. When the game starts, PyCorner gives every function that waits for a frame an async twin and awaits it. The original functions stay, so callbacks and sprite groups still work.
- What doesn't work in a browser tab?
- Sockets, threads, other processes, packages Pyodide can't load and some sound formats. The zip import names each one it finds in your code.
- Which pygame is it?
- pygame-ce 2.5.6 on Pyodide 0.29.4, running in the browser. Games written for classic pygame run as they are: pygame-ce keeps its API. Only on PyCorner: the AI in the editor also turns a pygame game into an instant Python game (PyLevate): compiled to a small JavaScript game that opens at once, with leaderboards, saves and iOS and Android export. It rewrites whatever falls outside PyLevate's pygame subset.
- Can players run it outside the browser?
- Yes. It is plain pygame: export the files (Pro) and run them with pygame on any desktop.
- What is PyLevate?
- Our compiler: a subset of Python becomes a small JavaScript game, with leaderboards, saves, embeds in other websites and iOS and Android projects. pygame projects are full Python; PyLevate is not.
- Can I put my game on my own website?
- pygame games open from a link. Embedding in another site works for pygame, PyLevate and web games. See the embedding docs.