A practical 2D game framework for Python with scenes, camera, particles, multiplayer networking, CLI host/join tools, chunked tilemaps, and an in-house UI/backend
Project description
# Easy2D
Easy2D is a general-purpose 2D game framework for Python with an in-house backend API.
It is designed to support many kinds of 2D games: arcade, platformer, top-down, RPG-style, puzzle, shooter, story-driven, menu-heavy, multiplayer prototypes, and experimental projects.
## Install
```bash
pip install easy2d
Community
Need help, want to report a bug, or have an idea for a new feature?
Join the community Discord for support, updates, bug reports, and suggestions for Easy2D, AutoConfigPy, and other related libraries:
Quick Start
import easy2d as e
game = e.Game("My Game", 960, 540, fps=120)
class MainScene(e.Scene):
def __init__(self):
super().__init__()
self.player = self.add(e.Rect(100, 100, 32, 32, gravity=0.0, floor_y=None))
self.title = self.add(e.Text("Hello Easy2D", 20, 20))
self.button = self.add(e.Button("Play", 100, 100, 180, 50, on_click=self.play))
def play(self):
print("Play clicked")
game.set_scene(MainScene())
game.run()
Display and Fullscreen
game = e.Game(
"Display Demo",
960,
540,
fullscreen=False,
resizable=True,
vsync=True,
scale_mode="fit", # native | fit | stretch | pixel-perfect
)
game.toggle_fullscreen()
game.set_resolution(1280, 720)
UI
scene.add(e.Text("Settings", 30, 20, size=30))
scene.add(e.Panel(20, 50, 420, 260))
scene.add(e.Button("Apply", 40, 80, 170, 44, on_click=apply_settings))
scene.add(e.TextInput(40, 140, 240, 40, placeholder="Player name"))
scene.add(e.Checkbox(40, 200, text="Fullscreen"))
scene.add(e.Slider(40, 250, 220, min_value=0, max_value=100, value=75))
Sprites and Animation
player = e.Sprite("assets/player.png", 100, 100)
player.scale = 2
player.flip_x = True
player.rotation = 8
anim = e.AnimatedSprite(200, 100)
anim.add_animation("idle", ["idle1.png", "idle2.png"], fps=6)
anim.add_animation("run", ["run1.png", "run2.png"], fps=12)
anim.play("run")
Audio and Assets
game.assets.load_image("player", "assets/player.png")
game.assets.load_json("level", "assets/level1.json")
game.assets.load_font("main", size=24)
game.audio.load_sound("coin", "assets/coin.wav")
game.audio.play_sound("coin")
game.audio.play_music("assets/theme.mp3", loop=True)
Particles
fx = e.ParticleSystem.explosion()
fx.emit_burst(200, 200, count=40)
Networking Helpers
server = e.MultiplayerServer(port=5000)
server.start()
server.broadcast({"type": "chat", "text": "hello"})
messages = server.get_messages()
client = e.MultiplayerClient()
client.connect("127.0.0.1", 5000)
client.send({"type": "hello"})
inbox = client.get_messages()
client.disconnect()
# Authoritative server + rollback snapshots
auth = e.AuthoritativeGameServer(port=7777, tick_rate=60)
auth.start()
# Reliable UDP channel (ack/retry)
udp = e.ReliableUDPChannel(port=7001)
udp.start()
# Built-in matchmaking queue
mm = e.MatchmakingService()
mm.enqueue("player-1", region="us", mode="duel")
mm.enqueue("player-2", region="us", mode="duel")
matches = mm.poll_matches()
CLI
easy2d --help
easy2d --show-scope
easy2d --multiplayer
easy2d --multiplayer --port 7777
easy2d --host --port 5000
easy2d --join 127.0.0.1 --port 5000 --message "hello"
easy2d --net-test --port 5000
easy2d --list-examples
easy2d --write-example basic
easy2d --write-example ui
easy2d --write-example particles
easy2d --write-example multiplayer
easy2d --write-all-examples
easy2d new arcade MyGame
easy2d new topdown MyTopDown
easy2d new shooter MyShooter
Current Scope
- Scene-based game loop
- Camera follow/zoom/shake
- Tilemaps with chunk caching
- UI widgets
- Sprite and basic animation classes
- Particle systems
- Audio and asset managers
- Timer and tween helpers
- Beginner-friendly multiplayer relay helpers
- Authoritative game server framework
- Reliable UDP transport with ack/retry
- Rollback snapshot buffer utilities
- Built-in matchmaking queues
Roadmap
- Expanded physics and collision response
- Sprite atlas/animation tools
- Save/load helper utilities
- Higher-level authoritative netcode patterns
- Additional UI widgets and layout helpers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easy2d-0.5.2.tar.gz.
File metadata
- Download URL: easy2d-0.5.2.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f030ff8022248e6999d9575af964582c58e195c15807dfb8b8ad7af59290bad
|
|
| MD5 |
055df5689082120de06e9c10aa481441
|
|
| BLAKE2b-256 |
0ee679b3e43b30a36a48319a20ae84b9f914d09bea95babf4d5e10772c2c04d1
|
File details
Details for the file easy2d-0.5.2-py3-none-any.whl.
File metadata
- Download URL: easy2d-0.5.2-py3-none-any.whl
- Upload date:
- Size: 40.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6296178299c234fe163d81c1509596df711f4ae7306cf76b8a78a70e19f21483
|
|
| MD5 |
01b48e3daef96184d87de1699647acd7
|
|
| BLAKE2b-256 |
d2ca9e3f771177f887abb666be455ca32986b32966e707afb0117b698a0bc6c6
|