HN
Today

Show HN: Micropolis/SimCity Clone in Emacs Lisp

ElCity is a surprisingly robust SimCity clone implemented entirely in Emacs Lisp, featuring an ASCII-based UI and a 'functional core / imperative shell' architecture. This project captivated the Hacker News community by combining classic retro gaming, the power of Emacs, and a clever design pattern, making it a standout 'Show HN'. Its ability to run a complex simulation within a text editor sparked both admiration and technical discussion.

71
Score
18
Comments
#5
Highest Rank
12h
on Front Page
First Seen
Feb 5, 10:00 AM
Last Seen
Feb 5, 9:00 PM
Rank Over Time
16555910101317253030

The Lowdown

ElCity is a unique, turn-based city-building simulation brought to life within the Emacs text editor. It aims to offer a fun, retro-inspired gaming experience while also serving as a practical exploration of the 'functional core / imperative shell' architectural pattern.

  • The game features an ASCII-based user interface, optimized for terminal Emacs sessions, and operates on a turn-based system where players manage city development.
  • Its core simulation is deterministic and pure, meticulously separated from the UI's rendering and input handling, which highlights the benefits of easy debugging, scalability, and extensibility.
  • Gameplay involves managing funds, population, and different zone types (Residential, Commercial, Industrial), alongside crucial elements like power plants and road networks.
  • Zones grow when powered and road-adjacent but decay if they lose these connections, with a maximum level of 3.
  • Players use simple keyboard controls to select and place buildings, demolish structures, advance turns, and cycle through various overlay views (e.g., power, pollution, connectivity).
  • The project requires Emacs 30.1+ and offers flexible installation and configuration options, including starting with custom map layouts.

Developed as a week-long tinkering project, ElCity successfully demonstrates that even complex simulations can be built with Emacs Lisp, proving the versatility of the editor and the elegance of a well-defined architectural approach.

The Gossip

Emacs Ecstasy & ASCII Aesthetic

Many commenters expressed delight and nostalgia for a full-fledged game running within Emacs, especially one utilizing an ASCII aesthetic reminiscent of classic terminal games. The unexpected combination of Emacs and SimCity-like gameplay was a major draw, leading to calls for more such projects and its inclusion in community game archives.

Core Decoupling & Lisp Layering

The discussion often revolved around the project's 'functional core / imperative shell' architecture, prompting questions about the feasibility and benefits of decoupling the game's core logic from Emacs itself. Users debated whether the core could run in other Lisp environments like Common Lisp or Guile, and the implications of such portability for broader adoption, with some arguing against unnecessary decoupling.

Screenshot Scrutiny & AI Transparency

Initial comments pointed out the absence of a traditional graphical screenshot, as the 'Visual Demo' was text-based. The author clarified this was a placeholder and promised an actual image. This led to a surprising turn when the author openly disclosed using an LLM advisor during development, prompting further conversation about AI's role in coding and the differing comfort levels developers have with 'Show HN' projects assisted by AI.