Skip to content(if available)orjump to list(if available)

OpenGOAL: Port of Jak and Daxter, written in GOAL, a custom Lisp by Naughty Dog

neilv

Related talk by Dan Liebgold from Naughty Dog, at RacketCon 2013:

https://www.youtube.com/watch?v=oSmqbnhHp1c&t=55s

Starting at around 10m into the talk, Liebgold says their DC language for TLOU (to get what they most needed from a DSL even if using C++ instead of GOAL) was implemented in Racket.

For anyone not familiar with TLOU, it was a critically-acclaimed game, and my personal all-time favorite game for storytelling that somehow grabbed me. (I dislike all zombie franchises, but at a key point towards the end of the nonlinear narrative and playing in the game, I was surprised how much I really wanted to protect the kid. Which I'll partly attribute to a Lispy DSL that helped them execute immersive storytelling in a zombie stealth shooter.)

https://en.wikipedia.org/wiki/The_Last_of_Us#Critical_respon...

This is one of the Racket success stories. They seem to happen because someone already knows they want a Lisp, they end up picking Racket without needing anyone else's permission, and the people using it are capable of designing and building whatever missing pieces they need.

bmitc

In the cause of Naughty Dog, it was Andy Gavin who introduced Lisp and GOAL and was one of the co-founders of Naughty Dog. He came from MIT and was a student of Rodney Brooks.

https://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp

https://all-things-andy-gavin.com/2011/03/12/making-crash-ba...

If someone hasn't seen it, his episode on Ars Technica's War Stories was awesome. He seems to be a hacker's hacker. It's a fascinating story because it's not really how I personally work (internally), so it's fun hearing someone describe just diving in like that.

https://www.youtube.com/watch?v=izxXGuVL21o

https://www.youtube.com/watch?v=pSHj5UKSylk

It was my understanding that Racket wasn't in use anymore at Naughty Dog. It would be cool if there was an update or someone who knows (I know Dan is no longer at Naughty Dog), because unfortunately the tale of Lisps in companies is normally that it eventually gets replaced or set aside (where new stuff is built in something else).

praptak

> unfortunately the tale of Lisps in companies is normally that it eventually gets replaced or set aside

Wikipedia page on GOAL says exactly this happened.

"In all honesty, the biggest reason we're not using GOAL for next-gen development is because we're now part of Sony. I can only imagine Sony's shock when they purchased Naughty Dog a few years back, hoping to be able to leverage some of our technology across other Sony studios, and then realized that there was no way anyone else would be able to use any of our codebase."

rjtavares

Sounds exactly like the sort of thing execs think when buying a company but then don't include in their due diligence.

mtzet

I can highly recommend the interview with Jason Gregory of Naughty Dog from Handmadecon 2016. He gives a lot of insight into the reality of working with the scheme-based format in recent-ish times.

https://guide.handmadehero.org/hmcon/2016/05/

My impression isn't that scheme is being passed out just because Sony doesn't like it, but also because the language has issues. On the other hand, it seems they're putting a lot of effort into getting the nice scheme features, like hot reloading, in their C++ environment.

bitwize

> because unfortunately the tale of Lisps in companies is normally that it eventually gets replaced or set aside (where new stuff is built in something else).

Any sufficiently advanced Common Lisp or Scheme program will eventually be rewritten in C++, Java, Python, or JavaScript.

lelanthran

> Any sufficiently advanced Common Lisp or Scheme program will eventually be rewritten in C++, Java, Python, or JavaScript.

I'd change that: `s/sufficiently advanced/sufficiently profitable/g`

The state of advancement is no indicator that something needs to be maintained, while the state of profitability is a reliable indicator that something will be maintained.

boppo1

Why? Is there a reason other than "most people don't know lisp and it's cheaper not to teach them?

ryneandal

I love hearing Gavin talk about solving problems, even decades afterward, he seems genuinely excited.

wodenokoto

TLOU is “The Last of Us”

sillysaurusx

GOAL / games written in Lisp have been a lifelong obsession. I used to search for hours for any scrap of information about the language. I would have traded a lot for this repo when I was 19.

Thank you to the authors for fulfilling a teenage dream. Please consider doing Last Of Us next —- I once downloaded it and tore it apart for any signs of lisp, but it was all compiled bytecode. That’s where I gave up, but it looks like you took it one millennium further by reverse engineering the bytecode from Jak and Dexter to make your own port that compiles to the same bytecode. If you have infinite time, you could theoretically do this for last of us too, and also last of us 2.

yumaikas

So, it's not GOAL, but I've been starting to work with https://fennel-lang.org and Love2d, and there's a twice-yearly Lisp Game jam that happens.

I've found that I like Fennel (and Janet as well, both created by the same author, though they have different maintainers) quite a bit. Turns out that having simple semantics and a very regular syntax makes for a language that makes writing basic code feel nice.

dharmab

Naughty Dog transitioned away from GOAL after they were purchased by Sony. Uncharted and TLOU are mostly written in C++.

msk-lywenn

All the scripting in Uncharted and TLOU is still in lisp. Well, actually, it's scheme now. They use M-something... It's the core of Racket.

Edit: MzScheme

Ericson2314

MzScheme hasn't be a name for Racket for at a decade+. Maybe the earliest Uncharteds? Racket now uses https://en.wikipedia.org/wiki/Chez_Scheme which vaguely rhymes but there's no relation.

PicassoCTs

What is it with Large Video Game Producers like Sony or EA interfering in studio internal technical detail decisions?

I distinctly remember EA pushing the Frostbite engine on bioware and thus ruining the franchises in production (MassEffect Andromeda/ Anthem).

Is this just another case of visible external costs (engine licensing) vs invisible internal costs (complete restructuring/retraining of existing pipelines/ engine rewrites)?

alexdss

Naughty Dog had very good reasons to avoid alienation that would come by sticking to their custom languages (not necessarily Lisp). Only one person on the team really properly knew how the GOAL compiler worked and how it interacted with the rest of the Naughty Dog toolchain, and that person would have to leave the company at some point. Remember that, since they are under the Sony umbrella, they would have to share technology around with the other teams. They were aware this could turn into an issue, and mention it in some interviews and e-mails: https://www.neogaf.com/threads/why-did-naughty-dog-abandon-g...

syntheweave

It's a "can't win" scenario in that the presumed advantage of a large org is that studios can share tech and therefore get an edge in deploying it across all titles - but they can't do it in a way that's really optimized to anyone's particular situation. Depending on the structure and communication flows the game teams can feel like code was "thrown over the fence" at them, or they feel chained into a method of asset production, builds and testing that is, for their purposes, extremely costly. Generalizing an engine has always been a very hard, two dimensional problem:

1. If you're pushing the platform, you need every part of the asset pipeline to be optimized for it, and probably lower level runtime optimizations too.

2. If you're doing something well within the constraints, your bottleneck is on implementing the specific types of assets that will make your game unique. As games get more featureful more and more micro-categories of assets show up - bits of UI text, custom behaviors, scene transitions, camera movements and so forth.

3. If you do 1, then 2 becomes more challenging because you made more optimizing assumptions, so the game production may fall off schedule due to lousy tooling making it hard to actually test anything in-game. If you focus on 2, you don't have as many reusable parts, and you're adding pressure to optimize near the end of the dev cycle, which can result in catastrophic bugs from changing assumptions in the asset-code mix, like "we tightened when we load in streaming assets. This broke a cutscene trigger because now it loads at the wrong time."

And then you add in an external tech group and you have another layer of communication to deal with, so the design or art teams can't just grab a coder and say "hey, this workflow sucks, give me a little support on this." Whether it's in the org or third-party, it's the same problem: you really need engine coders on staff to handle some things.

But the case can always be made: "if we have an internal engine group we can put all the smartest people in one place and have them develop the next-gen graphics." And once you have that group, it's politically necessary for the management to make its tech as widely deployed as possible, otherwise, why budget for them? The engine teams at large publishers who follow this kind of hard separation are known for having relatively cushy, high-profile gigs, while game teams are disposable bodies that churn out necessary but low-value features. Conflicts of interest and fiefdoms emerge from that. Some of them do enforce rotations and other protocols to lower the barriers.

bmitc

In the case of Sony and Naughty Dog, it's my understanding that Naughty Dog serves two purposes. One is that they are a game studio that makes games but the other is that they're a technology development studio that exports common tech for other Sony game studios to make their games with. While I'm on the side of Lisp and C++ makes me itchy, I can understand why that would be a hard sell.

corysama

I crossed paths with someone who joined ND around the time they were purchased by Sony. According to him, Sony told them "You will be working with other Sony companies. They will not be using GOAL. Switch to C++."

dang

Sounds like Viaweb after Yahoo.

sillysaurusx

Uncharted! That’s the one. Didn’t they do a video long ago about uncharted + lisp? I seem to remember them talking about some interesting benefits they got out of it.

Although the engine is mostly C++, the bits that aren’t are usually the most interesting. And the most impactful. So it would be neat to analyze, if for no reason other than archaeology.

bmitc

I remember seeing a video like that too, but I don't remember what it was or where I saw it. Doing a brief search didn't show up anything.

heavyset_go

> That’s where I gave up, but it looks like you took it one millennium further by reverse engineering the bytecode from Jak and Dexter to make your own port that compiles to the same bytecode.

If I'm reading this right, the original Jak and Daxter was written in a Lisp, too? If so, that's pretty cool and I wouldn't have guessed.

astrange

Same people wrote ITA Matrix (aka Google Flights) in Lisp.

But GOAL didn't have a GC, so it might not really count as Lisp.

bmitc

Are you sure? GOAL was created by Andy Gavin, a co-founder at Naughty Dog who never worked at ITA to my knowledge.

Edit: I was just randomly watching this video (https://www.youtube.com/watch?v=cHkk9isDfg4), and Dave Baggett came up. When I searched his name, it does look like he was a co-founder of ITA after leaving Naughty Dog.

p_l

GOAL does have a GC, though particularly primitive, and is definitely a lisp (there can be lisp without GC, it's just an unnecessary failure of design to not have one)

kayamon

It was written in a Lisp/C mashup and compiled to MIPS assembly.

Pxtl

Funny, because there's an old run and gun PC game "Abuse" that was famous for being one of the first commercial Lisp-scripted games, but very little has been done with its open-sourced codebase since its Lisp code is notoriously hard to work with.

ArtWomb

This is what makes OpenGOAL and video game archeology so mission critical. It isn't just preservation of digital culture. I think there are real insights to be gained.

Next step is to make a cookbook of classical Game AI techniques (monte carlo tree search, goal oriented action planning) in GOAL. Then it becomes a package anyone can use, like PhysX and RAD tools ;)

null

[deleted]

sillysaurusx

re: a deleted comment saying that last of us only had lisp in their dialog system and nowhere else:

I swear I remember a YouTube video from naughty dog about lisp, and that it was about one of their later engines. But at this point I think I just hallucinate parens wherever I go, so maybe not.

Bet it was the most extensible dialogue system ever though.

medo-bear

given the amount of interest in the hobby lisp game dev community it would be super cool if naughty dog/sony (or whoever own the license now) open sourced GOAL

dragonfax

Abuse was mostly written in Lisp. 2d side scrolling action game from the 90s that was unusual in being commercial with a brick and mortar release but also supporting Linux. It uses keyboard for direction mouse for aiming at the same time, which was also kind of unique at the time. The code is open source, complete with modernization, but you have to dig around for it nowdays.

https://en.wikipedia.org/wiki/Abuse_(video_game)

bigdubs

The ars technica extended interview with Andy Gavin is a great watch (mentions lisp from his time at MIT) https://www.youtube.com/watch?v=pSHj5UKSylk

benlumen

I absolutely loved Jak and Daxter and still run through it every few years. I think it was the peak of the 3D platforming era. Jak 2 with its fantasy take on GTA was excellent, too.

I'll never understand why, compared to the other Naughty Dog franchises, it was basically dropped and forgotten. Or why Ratchet and Clank was favoured (comparitively bland and boring imo).

jimbob45

I’m floored and amazed. I’ll certainly look into contributing but…how did the devs acquire a language spec for GOAL? My understanding was that that was the major blocker of these types of projects for years.

corysama

OP also posted https://blog.jakspeedruns.com/opengoal-project-update-septem... a while back. It has a section on "How is this possible?"

DylanBohlender

Whoa, that is crazy!

TL;DR for folks is that they left a lot of debug information in the build. The C code was compiled with no optimizations (and included debugging symbols), and GOAL uses a string-based table for global functions/variables/types, so they're starting with all those for free. Plus they don't think the GOAL compiler did too much tricky-to-undo optimization either.

monocasa

It looks like they don't have a full goal spec, but are relying on the copious debug and runtime type information, as well as the simplicity of the original goal compiler (and arguably the simplicity of lisp itself) to come up with something close that's semantically equivalent.

kayamon

There's a lot of snippets posted over the years on various forums. Nothing much, a few pages to get a hint of the syntax and the basics. Once you've picked apart the loader/runtime[1] the dynamic nature of the Lisp runtime system allows the system itself to hint a lot at how things originally went together. (e.g. type information is always present, state machines are explicit and easy to spot)

[1] http://www.codersnotes.com/notes/disassembling-jak/ (my old article this is based off)

rgbrgb

Just curious... what makes you look at this and want to contribute? I'm interested in why people do these unlicensed emulation projects at all and it sounds like you have at least one answer as your motivation.

ensan

This is not an "unlicensed emulation project". In fact, it's not emulation at all.

jimbob45

As far as I know, GOAL/GOOL remains the only time Lisp has ever successfully been used in a video game. Given Lisp's near-mythic status of productivity, it at least piques my interest to see how ND might have used it creatively in the codebase.

That and I've always wanted to check out the language after Andy Gavin (ND founder) talked it up on here [0]

[0]https://news.ycombinator.com/item?id=3152131

dleslie

Abuse, a 1996 PC side scrolling shooter, had a good chunk of it written in lisp.

https://github.com/antrad/Abuse_1996/tree/master/data/lisp

pcwalton

Zork ZIL was pretty Lispy (example at [1]). Whether it qualifies as "a Lisp" depends on your definition.

[1]: https://github.com/MITDDC/zork/tree/master/zork

rgbrgb

Cool, thanks for sharing that.

I had no idea Andy Garvin was on hn, but makes sense :)! I had a vague memory that Super Mario 64 also used lisp and when I googled, I found him again [0].

You've likely seen this, but I recently watched and loved this extended interview with him about making Crash Bandicoot [1]. Really made me want to look more into making video games.

[0]: https://news.ycombinator.com/item?id=2474833

[1]: https://www.youtube.com/watch?v=pSHj5UKSylk

p_l

GOOL-level code used to be maybe not common, but also not uncommonly implemented in some form of a lisp (these days it's pretty much all Lua). Naughty Dog continued using Lisp for those purposes at least throughout Uncharted series.

There are some indie games done in Lisp, including at least one small Visual Novel released on Steam and another currently in development (2d platformer called "Kandria").

Several games, both indie and not, used Lisp as development tool - this includes games like "What Remains" (hn link: https://news.ycombinator.com/item?id=20930986 ) as well as numerous tools used IIRC at Nintendo.

bigbillheck

> As far as I know, GOAL/GOOL remains the only time Lisp has ever successfully been used in a video game.

'Abuse' had a substantial lisp component.

mbrodersen

> Given Lisp's near-mythic status of productivity

I have seen a lot of claims of this but no real evidence? And I know Lisp quite well (having implemented my own versions of Lisp for fun). If Lisp truly is way more productive than other languages, why haven’t we seen lots of Lisp software out-competing software written in other languages? Surely a few Lisp guys could outcompete everybody else if Lisp is as super productive as claimed.

s-lambert

Lisp was used for some code for the original NES, there was a presentation about it but it looks like only the reddit thread[0] linking to it still exists.

[0] - https://www.reddit.com/r/programming/comments/6e6zwn/i_had_n...

null

[deleted]

rbut

I love projects like this. Well done to everyone involved.

On a related note, back when I was engine programmer for a PS2/Wii/Xbox engine I remember my boss always coming and saying "How do we get it to draw more in the distance. Just like Jak and Daxter!". It was a high bar to reach.

lispm

Note that the original GOAL compiler was written in Common Lisp (specifically Allegro CL). I wonder if the sources are still existing?

bitwize

Between this, SM64 PC, and OpenLara, old-school games are fertile ground for custom code mods and general hackery-dackery. Probably illegal (but for the OpenLara engine, maybe) but still so cool.

And out of this we get a free implementation of GOAL, long thought lost!

mitemte

This might interest you: https://github.com/zeldaret/oot recently reached 100% byte matched decompilation.

aap_

That's so cool. Just a few months ago I reversed a bit of the GOAL runtime in an effort to understand how it worked (aap/goal on github) but I didn't dream of seeing everything decompiled. great work

Alekhine

If we get Jak 2, I'll die happy.

junon

This. Jak 1 was okay but 2 was outstanding.

paines

I just saw that there is sales on PS Store. So if you own a PS4 grab the whole collection with all 4 Jak games. But yeah, an open source JAK would be unbelieavble.

benlumen

I've read that the PS4 ports are bad and that the PS3 ones were the way to go. I haven't compared myself, though.

null

[deleted]

branperr

Can someone explain the significance of this to me? I'm not caught up on this topic.

wk_end

Jak & Daxter was a very good, technically impressive 3D platformer that came out in the early 2000s for the Playstation 2. It was developed by an American studio called Naughty Dog, who was famous for previously making the Crash Bandicoot games and has since gone on to make the acclaimed Uncharted and Last of Us games.

Certain kinds of techies were particularly enamoured with Jak & Daxter because, at a time when console devs rarely spoke much about the tech behind their stuff, and at a time when games were almost universally programmed in C/C++ with bits of assembly language, the developers of Jak & Daxter openly discussed how they had written the bulk of the game logic in a custom Lisp dialect they called GOAL, which itself was built with Common Lisp. If you don't know what Lisp is or understand why that's cool, well - Lisp is a very interesting programming language that pioneered a lot of incredible ideas in computer science and that certain hackers develop a real connection to, including one of the biggest names behind this site/Y Combinator, but has always struggled a bit in the market. Seeing it used in a AAA game production like this was, for those hackers, really exciting; maybe because it might be the beginning of an industry-wide move towards Lisp (which never happened), or maybe just because a Lisp success story like this was vindicating.

This appears to be a (work-in-progress) source port of the game and the GOAL language, produced with a lot of reverse engineering work. So it's neat to finally get to see first-hand this GOAL Lisp stuff that we've heard about for years, and if the project reaches completion it'd also make for a great way to play the game on modern hardware or mod it.

branperr

Thanks! I loved playing this game growing up. I had heard later on that it was a technical achievement, but didn't realize they made their own dialect of Lisp.