Is it possible to write games like Pac-Man in a functional language?

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • elm-games

    All Elm Games (hopefully)

  • Elm

    Compiler for Elm, a functional language for reliable webapps.

  • I think the most fun and approachable way for beginners to build games with functional programming is with Elm [1].

    See a few (small, demo) games built by the community in [2] .

    Notice Elm has abandoned the FRP approach in favor of Model-View-Update [3].

    [1] https://elm-lang.org/

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • repl

    Fable online REPL (by fable-compiler)

  • Fable: F# |> BABEL

    F# to JavaScript, TypeScript, Python, Rust and Dart Compiler

  • OCamlODE

    OCaml bindings for the Open Dynamics Engine (ODE), a 3D physics engine.

  • chips

    A clone of Chips Challenge in Haskell (by egonSchiele)

  • https://github.com/egonSchiele/chips

    It's not better than using C, but worked just fine when I wrote it in 2014. I'd say, unless you're planning to sell it, write the game in whatever language you enjoy.

  • minild72

    :space_invader: Mini Ludum Dare 72: p_ng

  • Just to pitch in with a Clojurescript/Quill example, where the game loop takes a function that takes game state, modifies it, and returns it for the next iteration of the game loop.

    https://github.com/opyate/minild72/blob/master/src/pong/core...

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • Monadius

    2-D arcade scroller

  • defect-process

    Defect Process (2d hack n' slash game) full source code

  • Totally possible. Here’s a link to a game recently released on Steam that is written in Haskell and whose source is open: https://github.com/incoherentsoftware/defect-process

    I recently hacked together an asteroids clone in Haskell with SDL2 and not much else. It’s not super pretty but it works.

    I’ve talked to folks who’ve been using the newer effects libraries taking advantage of the new delimited continuation primops in GHC 9.6 for their game dev. Even with very high level libraries their reporting acceptable performance.

    With enough dedication I’m certain anyone could make whatever game they wanted in an FP language.

  • bfhs

    bf interp in hs

  • Made a mostly pure brainfuck in haskell where output collects to list in state & tape is a zipper. Machine type is Brain. Compute returns Brain & bool for whether program halted or is wanting input to overwrite current tape value & resume pure evaluation

    https://github.com/serprex/bfhs/blob/master/minibf.hs

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts