Skip to content

PIXELTOWN 🏙️

Discord

Welcome to PIXELTOWN! This is a 2D city-building simulation game built with Python and Pygame. As the newly appointed leader, your job is to build the best city possible, managing resources, constructing buildings, and keeping your citizens happy. Beware—if their happiness drops too low, a coup d'état might destroy everything you've built!

What is PIXELTOWN?

At its core, PIXELTOWN is a resource management and town-building game. You start with a small amount of money and a handful of citizens. From there, you must:

  • Build your town: Construct houses, supermarkets, streetlights, and decorations.
  • Manage the economy: Earn money from your inhabitants and spend it wisely in the shop.
  • Keep people happy: Buy supplies (like soap and face masks) to boost happiness and gain experience. If happiness falls below 10%, your citizens will rebel!

Features

  • Dual Execution Mode (Pygame Desktop vs Web Localhost): The Tkinter terminal asks upon startup whether to launch in classic native Pygame desktop mode or compile & serve locally in the web browser via WebAssembly using Pygbag.
  • User Accounts & Login: Register new user accounts and log in securely via a graphical user interface (GUI) built with Tkinter. Passwords are safe and encrypted locally using SHA-256 hashing.
  • Save & Load Progress: Save your game state (net-worth, population, happiness, level, debt, experience, and custom buildings) dynamically. Easily reload your progress upon logging in.
  • Window Resizing & Scale Support: Support for resizing the Pygame window dynamically with automatic scaling of the 1200x600 virtual screen resolution.
  • Interactive UI: Fully built with Pygame.
  • Resource Management: Track your Money, Population, Happiness, Experience, Debt, and Town Level.
  • Building System: Place different structures like houses, stores, streetlamps, and decorations dynamically on your map.
  • Store & Economy: Buy items to boost stats or decorations to personalize your city.
  • Intro Screen: Displays a retro minimalist introduction screen at launch.
  • Guest Mode: Play instantly without creating an account (saving progress is disabled).

Prerequisites

Before you dive in, make sure you have the following installed:

  • Python 3.x
  • Tkinter: GUI library (often pre-installed with Python; on Ubuntu/Debian Linux, install via sudo apt-get install python3-tk).
  • Pygame / Pygame-CE: Core engine for graphics and event handling.
  • Pyvidplayer2: Used for rendering the video introduction.

You can install the required dependencies using pip:

pip install -r requirements.txt

Project Structure

The project is structured cleanly to keep the logic and assets organized:

  • src/: Contains the core Python scripts and minigames:
    • main.py: Launcher entry point.
    • terminal.py: Tkinter-based GUI login, registration, and language selection screen.
    • localization.py: Dynamic localization system to load translations from JSON resources.
    • game.py: Main loop, event handling, scaling overrides, and level rendering.
    • characters.py: Inhabitants and character logic.
    • text.py: Onscreen text formatting utilities.
    • snake.py: Playable Snake minigame.
    • tetris.py: Playable Tetris minigame.
    • solarsystem.py: Playable Solar System simulator minigame.
    • locals/: Directory containing JSON translation resources (es.json, en.json).
  • assets/: Contains all assets used by the game:
    • imagenes/: Visual assets, player sprites, and background images.
    • PIXELTOWN_OST/: Game soundtracks and sound effects.
    • visual/: Video elements such as intro.mp4.
  • saves/: Contains local user credentials database (accounts.json) and player progress files (<username>_save.json). (This directory is ignored by Git).

How to Play

  1. Clone or download this repository.
  2. Navigate to the project directory.
  3. Run the main launcher:
    python main.py
    # or: python src/main.py
  4. Choose Execution Mode: The Tkinter terminal will prompt you first:
    • Ventana de Pygame: Classic native desktop window with language selection, user authentication/guest mode, and Pygame gameplay.
    • Formato Web Localhost (pygbag): Starts the Pygbag local WebAssembly server at http://localhost:8000 with real-time log monitoring and opens the browser.
  5. If playing in Desktop mode, choose your language, then register a new account or log in with your username and password (or select Play as Guest).
  6. If it's your first time, follow the onboarding prompts to enter your name and choose your city's name. Otherwise, it will load your previous progress automatically!
  7. Click the Save Progress button inside the game map or exit normally to save your progress. Have fun and try not to get overthrown!

Community & Discord

Join our official Discord Server to chat with the developer, suggest new features, discuss ideas, and follow development updates!

Contributing

Contributions, issues, and feature requests are welcome! If you'd like to add new building types, tweak the economy, or just fix some bugs, check out the CONTRIBUTING.md file for more details.

License

This project is licensed under the GNU General Public License v3 (GPL-3.0). See the LICENSE file for more information.


Copyright (C) 2026 Raúl Salas Sahuquillo

About

A game made with pygame meant to be developed by a community of coders who just want to have fun and learn Python at the same time!

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages