Skip to main content

A practical 2D game framework for Python with scenes, camera, particles, and chunked tilemaps

Project description

Easy2D

Easy2D is a practical 2D game framework on top of pygame with a clean scene loop, camera system, and performant tilemap rendering for larger worlds.

Why Easy2D

  • Fast setup for playable prototypes in minutes
  • Scene and object lifecycle that stays organized as projects grow
  • Delta-time movement and simple input helpers out of the box
  • Chunk-cached tilemap rendering for smoother large maps
  • Simple API that can scale from arcade games to block-world builders

Install

pip install easy2d

Quick Start

import pygame
import easy2d as e

class Player(e.Rect):
    def __init__(self):
        super().__init__(100, 100, 28, 28, color=(80, 220, 180), gravity=0.0, floor_y=None)
        self.speed = 240

    def update(self, game):
        dx = dy = 0.0
        if game.key_pressed(pygame.K_a):
            dx -= self.speed * game.delta_time
        if game.key_pressed(pygame.K_d):
            dx += self.speed * game.delta_time
        if game.key_pressed(pygame.K_w):
            dy -= self.speed * game.delta_time
        if game.key_pressed(pygame.K_s):
            dy += self.speed * game.delta_time
        self.move(dx, dy)

class MainScene(e.Scene):
    def __init__(self):
        super().__init__()
        self.player = self.add(Player())

    def update(self, game):
        super().update(game)
        game.camera.follow(self.player, lerp=0.12)

game = e.Game("Easy2D", 960, 540)
game.set_scene(MainScene())
game.run()

Core API

Game

  • Main loop, screen, timing, and input state
  • delta_time, elapsed_time, fps
  • Input helpers: key_pressed, key_just_pressed, mouse helpers

Scene

  • Object container with safe add/remove during updates
  • Hooks: on_enter, on_exit, handle_event
  • Query helpers: find_by_name, find_by_tag, find

GameObject

  • Base entity with lifecycle hooks and visibility/active flags
  • Properties: x, y, z, active, visible, destroyed

Camera

  • World/screen conversion helpers
  • Smooth follow with optional world bounds

TileMap

  • Sparse tile storage plus chunk-surface caching
  • Visible-chunk rendering for better large-map performance
  • Helpers: set, remove, fill_rect, world_to_tile, tile_to_world, solid flags

ParticleSystem

  • Configurable particle effects with lifespan and gravity

Build Bigger Worlds

Easy2D now supports chunk-cached tile rendering, which is a key building block for games with large tile worlds.

For Minecraft-like workflows, combine:

  • TileMap for block placement and chunk rendering
  • Camera follow and world/screen conversion
  • Mouse world coordinates for place/remove actions
  • Scene queries and object tags for gameplay systems

CLI Commands

After install, Easy2D includes a CLI command:

easy2d --help

Useful commands:

# Show multiplayer setup with private/public IP + port
easy2d --multiplayer

# Choose a different port in the display
easy2d --multiplayer --port 7777

# List available code examples
easy2d --list-examples

# Write one example file into current folder
easy2d --write-example multiplayer_host
easy2d --write-example multiplayer_join

# Write all example files
easy2d --write-all-examples

The multiplayer command prints:

  • Your private IP (for LAN friends)
  • Your public IP (for internet friends)
  • Port to share
  • Quick next steps for port forwarding

This makes onboarding easier for users testing multiplayer quickly.

Current Scope

Easy2D is intentionally lightweight. It does not yet include:

  • Full rigidbody physics and collision resolution
  • Built-in sprite animation pipeline
  • Chunk streaming from disk
  • Networking

These can be layered in while keeping the current API stable.

Package

  • Name: easy2d
  • Python: >=3.8
  • Dependency: pygame>=2.5
  • License: MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy2d-0.4.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy2d-0.4.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file easy2d-0.4.0.tar.gz.

File metadata

  • Download URL: easy2d-0.4.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for easy2d-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7f89a2904eaf7abed6447d1397113a5a0571ae87f76075be98dcdd41a922477c
MD5 5d85ee0b4be75daeb92ba3cd30ce9eb4
BLAKE2b-256 50155ef0af0b99c9223b493839ade824dec5f26f173ccbdcb89c77b00311f34a

See more details on using hashes here.

File details

Details for the file easy2d-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: easy2d-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for easy2d-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b815916b1cadf7d8328d691d56c155aee71afe552b98bcd0b3ca7abcbc48d64
MD5 14f59d0e1a2e341f3cf60bf67304a1a0
BLAKE2b-256 705af7d45fad6659a1283e30d580dd2f95b0e6c0cb23d0b805166a1cddad1a6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page