7 ms·
GameLisp: Scripting language for Rust game development
- akavel 6y agoDoes it integrate well with Bevy? Does it support live reload?
- fleabitdev 6y agoThanks for your interest! The new reference manual for version 0.2 (which I'll release within a few days) discusses Bevy specifically. Short version: GameLisp isn't a natural fit for a multithreaded ECS, but it's possible to make it work. Because the language is so dynamic and late-bound, it shouldn't be too difficult to hack in hotloading yourself. I intend to make it easier in the future. There's some preliminary discussion here: https://github.com/fleabitdev/glsp/issues/10 https://github.com/fleabitdev/glsp/issues/10
- codetrotter 6y ago> GameLisp has a novel object system, inspired by Andy Gavin's writings on GOOL, which is uniquely well-suited for game development. https://gamelisp.rs/reference/introduction-for-rust-programmers.html https://gamelisp.rs/reference/introduction-for-rust-programm... Neat, I was going to ask if it was influenced by any of the Lisp stuff that Andy Gavin did at Naughty Dog.
- eggy 6y agonitpick: GOAL (Game Oriented Assembly Lisp) not GOOL.
- codetrotter 6y agoGOOL is correct. You are thinking of a different language that he made for the Jak & Daxter games. https://all-things-andy-gavin.com/2011/03/12/making-crash-bandicoot-gool-part-9/ https://all-things-andy-gavin.com/2011/03/12/making-crash-ba...
- eggy 6y agoI stand corrected, thanks. I'll have to look into GOOL.
- franknine 6y agoFound an old postmortem on Jak and Daxter from 2002 talking about pros and cons of using GOAL: https://www.gamasutra.com/view/feature/131394/postmortem_naughty_dogs_jak_and_.php?page=2 https://www.gamasutra.com/view/feature/131394/postmortem_nau... And Andy Gavin talked briefly about GOOL on Ars Technica Crash Bandicoot interview: https://youtu.be/pSHj5UKSylk?t=5893 https://youtu.be/pSHj5UKSylk?t=5893 It seems Naughty Dog later decided not to maintain their own Lisp and moved to Racket: https://www.youtube.com/watch?v=oSmqbnhHp1c https://www.youtube.com/watch?v=oSmqbnhHp1c I am really curious about how they use Lisp nowadays.
- TazeTSchnitzel 6y agoThe (pretty and quite good!) Game Boy Tetris clone has successfully sucked me in and distracted me from the actual language design. https://gamelisp.rs/playground/#quadris https://gamelisp.rs/playground/#quadris (There's also a faithful Minesweeper clone!)
- kensai 6y agoPros and cons in comparison to Lua? Or simply using "rlua"?
- fleabitdev 6y agoThe pros are summarised here: https://gamelisp.rs/reference/introduction-for-rust-programmers.html https://gamelisp.rs/reference/introduction-for-rust-programm... The main cons would be the lack of LuaJIT, the lack of C or C++ bindings, and the fact that Lua is spectacularly more mature and stable :) (Full disclosure: I'm the project's developer)
- EamonnMR 6y agoDepends on what type of syntax you enjoy I think.
- PicassoCTs 6y agoFunctional language approaches are very neat to encode game rules. Just define the sets to which a rule apply, define rule -> behaviour maps and then apply. With this alot of procedural/object orientated cruft shrinks down to one page algo&definitions. Lua does supply this style, just needs some slight additions.
- Graziano_M 6y agoCould use fennel [1], too. [1] https://fennel-lang.org/ https://fennel-lang.org/
- anonymoushn 6y agoI would strongly prefer to not have to change every call site of a function (and the functions containing the call sites, and so on) when adding 1 yield to it and to be able to make higher order functions that work on functions that yield and functions that do not yield.
- maccard 6y agoAgreed. The "what colour is your function" [0] article comes to mind. Even with that, this is an impressive project. [0] http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...
- fleabitdev 6y agoGenuinely interesting suggestion! I used Lua coroutines, Python generators and Ruby fibers as my prior art; in all three cases, they're resumed by invoking a method on the coroutine object. A lambda function which resumes a coroutine can simply be written as: (fn0 (coro-run the-coro)) This is more ugly than passing in the coroutine directly, but it's also more explicit. I'm concerned that if the "resume coroutine" operation looks like a normal function call, the control flow of coroutines might become too difficult to follow. To the best of my knowledge, the only way to get rid of `yield-from` would be to switch from stackless to stackful coroutines. GameLisp used to have stackful coroutines, but they added a large complexity burden to the virtual machine, and they were so expensive that I could never bring myself to use them for entity scripting. My instinct is that other game developers would feel the same way. I'll need to give this some more thought.
- anonymoushn 6y agoLua coroutines have exactly the thing I asked for though. As an example, if I have some enemy in a shmup that moves (over the course of many frames), fires some bullets in an arc centered on the player (within one frame), and moves again, I can write something like this: function ExampleEnemy:behavior() while true do self:move() self:fire_arc() end end function ExampleEnemy:fire_arc() local theta = self:aim() for i=-5,5 do self:fire({speed=8, direction=theta+i*10*degrees}) end end If I later want the arc to have some delay between the bullets, and I insert a call to a function that yields for a certain number of frames in the loop in fire_arc, the code continues to work. If I do this same change in Python, the result is that the call to fire_arc in behavior begins to return an iterator or something and silently fails to actually fire any bullets! Lua's stackful coroutines are sufficiently cheap that it's reasonable to have tens of thousands of entity behaviors implemented as coroutines running at a time.
- deleted 6y ago[deleted]
- iainctduncan 6y agoCool, I'm working on Scheme in computer music and will keep this on my radar to look at how you handle GC. We have the same basic context, where running per frame (where frame is some number of samples) could work well.
- Sawamara 6y agoI really, really like this. At this point, I am not even sure if Bevy even needs another language (rust can work pretty well for scripting-needs,after all), but if it comes to having an editor for designers and separating that kind of logic from the build process, this could work very well. Looking forward to trying this out in the next few days.
- enos_feedler 6y agoI was wondering about Bevy when I read this. Is it designed to work with Bevy? Or completely agnostic? I didn’t see Bevy mentioned. I’ve been learning Bevy and loving it UPDATE: just read separate comment thread on Bevy.
- Buttons840 6y agoYou mean this thread? https://news.ycombinator.com/item?id=25494097 https://news.ycombinator.com/item?id=25494097
- qwerty456127 6y ago5 posts about various lisps have reached the top today. If lisp is so awesome and people end up building lisps on top of Rust and everything else, why do we need non-lisp languages like Rust itself anyway?
- oblio 6y ago> If lisp is so awesome and people end up building lisps on top of Rust and everything else, why do we need non-lisp languages like Rust itself anyway? Building Lisps on top of anything is extremely rare, especially in commercial environments.
- giancarlostoro 6y agoEmacs and every Emacs developers custom elisp setups would like to have a word with you. Of course, I'm not entirely sure of another example of mass adoption of Lisp in a commercial setting outside of Hacker News if you consider this setup commercial. I would argue HN definitely provides value back to YC by bringing plenty of exposure to their startups, but in all honesty I don't think a single soul on HN would complain against it, considering the alternative is much worse.
- oblio 6y agoHow is your comment contradicting mine? Emacs is 1 out of hundreds if not thousands of editors out there.
- giancarlostoro 6y agoWhy does mine have to contradict yours? I'm just saying, there's people who've used Emacs for 30 plus years to be productive.
- omnicognate 6y agoIt's common, including in "commercial environments" - eg. I've seen multiple things that would qualify as "lisps" built in banks. Why? Probably because they are easy to make and extremely expressive given that limited effort. Is making an expressive custom language with no tooling to solve a single problem a good idea? Nope. Do people do it anyway? Yes. Edit: And never forget Greenspun's 10th rule: "Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp."
- Arelius 6y agoSo, the big advantage of GOOL was being able to evaluate an redefine functions in the image in the running game. It's unclear on a short read of the documentation if this is a goal of GameLisp
- fleabitdev 6y agoHotloading is a near-future goal in the project's roadmap. There are some initial notes here, if you're curious: https://github.com/fleabitdev/glsp/issues/10 https://github.com/fleabitdev/glsp/issues/10 Thanks to the last 25 years of improvements in CPU tech, it's less "patching raw binary artifacts into the running program" and more "recompiling the entire source tree in a couple of hundred milliseconds" :)
- ertucetin 6y agoDoes it have a REPL like in Clojure?
- IndexPointer 6y agoThis is the most hacker-newsy title I've ever seen.