Skip to main content

A practical 2D game framework for Python with scenes, camera, particles, networking, 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.1.tar.gz (12.7 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.1-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easy2d-0.4.1.tar.gz
  • Upload date:
  • Size: 12.7 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.1.tar.gz
Algorithm Hash digest
SHA256 79fcb445d43a3bc564e64e7c04dd49de5ca01db921974b07a88fc0a74bce7394
MD5 0b2cb033a78d9eb79072704c0d39cbaf
BLAKE2b-256 53864c2affd9387e3babfd59a7852110c5d040f61c85651fc6988a12d9c8a2da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easy2d-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 13.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 706c8afe4c7cd5d382c3ca483bf3b1a433eaef52684d0404f27dcc0ac45910d7
MD5 c4567ee5b775cd18a243970822b4f200
BLAKE2b-256 846d33537dd67ce339442d001174b377eb7a00f9fc5dcff0c73cc30eb6eb2c56

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