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!
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!
- 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).
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.txtThe 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 asintro.mp4.
saves/: Contains local user credentials database (accounts.json) and player progress files (<username>_save.json). (This directory is ignored by Git).
- Clone or download this repository.
- Navigate to the project directory.
- Run the main launcher:
python main.py # or: python src/main.py - 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:8000with real-time log monitoring and opens the browser.
- 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).
- 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!
- Click the Save Progress button inside the game map or exit normally to save your progress. Have fun and try not to get overthrown!
Join our official Discord Server to chat with the developer, suggest new features, discuss ideas, and follow development updates!
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.
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