11 ms·
Jai Language Primer
- danbolt 11y agoI like the idea of a language syntax that allows easier refactoring. I think Rust is especially good at this as well, and I'm happy to see that Jai borrows from that.
- giancarlostoro 11y agoI liked some things I saw which I've only seen in Pascal / Ada. Edit: Specifically I thought it was the same as what I've seen in Pascal for arrays[0] where you specify the range (in the case of characters) between x and y. I always thought that was kind of interesting, have yet to really see it implemented in another language afaik. [0]https://en.wikibooks.org/wiki/Ada_Programming/Types/array https://en.wikibooks.org/wiki/Ada_Programming/Types/array
- beagle3 11y agoNim is a modern Pascal/Delphi with a Pythonic syntax. You'll probably like it.
- whitegrape 11y agoI wonder if Blow has ever looked at Nim. Sometimes I hallucinate that game devs will have an Awakening and realize it's the way forward.
- aerique 11y agoI've got the same dream but about Lispy languages, preferably Common Lisp. I'm sure more people around here have the same dream about their favorite language :-)
- whitegrape 11y agoEvery now and again when I'm really figuratively toked up I go reread the history of Crash Bandicoot and also dream for more Lisp in the games industry (and every other industry). :) But I think Nim is slightly more realistic.
- davexunit 11y agoI look at all these new languages with horrificly complicated syntax and wish for s-expressions. Lisp is perfectly well suited for game development, too, and not just for scripting. There are many implementations around with fast optimizing compilers, JIT compilers, and other modern features that make things run fast. When I see languages like what Jonathan Blow made, I think that most of the features can be implemented as extensions to your Lisp of choice.
- basketcasing 11y agoThe one thing that keeps me away from Lisp/Scheme is the lack of built-in syntax for hashmaps and sets (I like Clojure's syntax, but don't want the JVM). I've never gotten the hang of car/cdr and dotted pairs.
- davexunit 11y agoI don't think this is a particularly large problem. Traditional hash tables are imperative data structures, and Lisp code (or Scheme code, at least) typically does not use them because of this. Association lists, which can be represented as literals, are persistent and provider faster lookup, despite being O(n), for the cases in which hash literals are typically used (small number of pairs). The Clojure language has built-in persistent hash tables and sets, so it makes sense for them to have a reader that can process them. I really don't think this is a deal breaker though, when you can just do stuff like this: (alist->hash-table '((foo . 1) (bar . 2)))
- basketcasing 11y ago> Traditional hash tables are imperative data structures, and Lisp code (or Scheme code, at least) typically does not use them because of this. I don't understand that. > Association lists, which can be represented as literals, are persistent and provider faster lookup, despite being {snip} Those look like like they could be useful, but I don't see how they can replace hashmaps --- for one thing, they allow duplicate "keys" (the first element of each pair). I'd use a lisp, and don't mind the lisp/parens syntax, but to be useful for me it must provide easy access to and use of hashmaps and sets.
- weavie 11y agoYes, how much fun folks could have if you could connect a Repl into your game and arbitrarily change the rules on the fly!
- davexunit 11y ago(shameless plug alert) This is how my WIP (verrrry WIP) game engine written in Guile Scheme works. It is built explicitly to enable iterative, live development. 2 year old video of a precursor to the current project: https://dthompson.us/functional-reactive-programming-in-scheme-with-guile-2d.html https://dthompson.us/functional-reactive-programming-in-sche... Simple example program: https://git.dthompson.us/sly.git/blob/HEAD:/examples/simple.scm https://git.dthompson.us/sly.git/blob/HEAD:/examples/simple.... More complicated minesweeper example: https://git.dthompson.us/sly.git/blob/HEAD:/examples/mines/mines.scm https://git.dthompson.us/sly.git/blob/HEAD:/examples/mines/m... Home page: https://dthompson.us/pages/software/sly.html https://dthompson.us/pages/software/sly.html Hoping to get a 0.2 release out the door in time for the Lisp Game Jam coming up in April.
- CyberDildonics 11y agoYou can do that right now with Love2D and a stub game loop that sources the actual implementations every second or two.
- davexunit 11y agoThat is a far cry from a REPL.
- CyberDildonics 11y agoIt's better than a REPL, that allows you to write a game completely live. I'm not sure what you think is lost since you didn't back up what you are saying with anything.
- davexunit 11y agoIt is strictly less powerful than a REPL. Claiming that you can't live code a game at a REPL is false, because I do it on a regular basis. When I write games in Scheme, I use a REPL to write the game live, doing all of my editing within Emacs. I do not have to save files for the code to be evaluated, I just press a keystroke to evaluate the specific form I'm interested in. I can evaluate more fine-grained sections of code, not only entire files.
- CyberDildonics 11y agoDoesn't Nim use garbage collection? Also the compiler isn't even stable, it is an interesting language but can't be take seriously for professional development yet.
- whitegrape 11y agoUse of GC in Nim is up to you -- you can malloc/free as you please if you want and avoid it altogether. I'm not sure to what extent you can/can't make use of the standard library if you avoid GC, but even if you lessen your restrictions and use it a little bit, it's a highly tuneable/controllable and understandable GC including support for swapping out entirely different GC algorithms. Professional game development as in AAA studios? Yeah, probably not, but more for the tooling alone than whatever language any particular studio happens to use. Professional indie game development? It's ready, even though it's not at 1.0 yet. Indie devs deal with big breaking upgrades to their frameworks (Unity, Corona, etc.) all the time, it's annoying but not a deal-breaker if the language gets those sometimes too.
- jfaucett 11y agoThis is interesting. Recently, I've been doing more c programming again, and everytime I do I find myself thinking about building a language that is essentially c with just a very few pain points removed. #1 is a build/module/package system for making it easier to build modular code without copy/paste that is the defacto c-standard. #2 would be removing the pain points of utf8/unicode support (go seems to get this pretty close to right). And that's really it. (you could throw in an easy way to do closures and all values immutable by default and I wouldn't mind either). Otherwise, I'm usually completely happy using C. I've tried Rust and Go and they have their use cases, but for most low-level things I do, I don't care that much about everything being perfectly safe (i.e. rust), and I don't want gc, and the high level stuff that Go brings. Really, just give me C with a good module system and I'd be perfectly happy. Maybe I'm alone here though...
- TheAceOfHearts 11y agoHave you seen dotc [0]? [0] https://github.com/substack/dotc https://github.com/substack/dotc
- CyberDildonics 11y agoIt has been said that everyone wants their favorite language with just one more feature.
- davidgrenier 11y agoI stopped caring at no garbage collection.
- frou_dh 11y agoYour announcement has been placed in the special filing cabinet.
- gregstula 11y agoDo you know why Microsoft rewrote Minecraft in C++? Games can certainly be successful in spite of performance problems, but why purposefully introduce them in the first place? In the case of Notch, he used Java because he was most skilled at Java programming. The garbage collection, procedural generation, and multi-platform availability of the JVM allowed him to successfully release a massive hit as a solo indie developer. At least that's one way to interpret it. Another way is that, had Notch been as skilled in C++ or (these days) Rust he could have made just as good of a cross platform game (even more so on mobile), that didn't concern itself with resource management outside of RAII and reference counting, was way more performant (no pauses), and in similar time frame as a skilled Java developer. If you have a great idea use your favorite language. No doubt about that. You might be successful in spite of its specific deficiencies. However, if you are seeking a new language for a certain problem domain - like video games - choosing one with a feature that actively fights one of your fundamental goals (consistent framerate is only going to be a decision your users will regret you made. It's funny that people like to say "users don't care what language it's written in". The fact that 8th graders know the the minecraft's garbage collector is a problem, suggests that using a garbage collected language for soft-realtime video games results in a seriously leaky abstraction.
- hacker_9 11y agoMinecraft is a special case, as the amount of voxels in memory and the constant loading and deloading of blocks of the map every few seconds, means that memory management is incredibly important to the game. That's why the C++ version was more performant, as John Carmack had full control of both the memory layouts and lifetimes, and could fine tune it all to fit the game. This is the only reason C++ is still in wide use today, in order for games to limit load times they have to do nasty 'unsafe' tricks (such as loading a block of memory from disk straight into an address space, and just assigning pointers to it), in order to get good performance. But if your game isn't open world (such as minecraft, GTA, Fallout), then using a garbage collected language will be fine (as long it's not stop the world, but runs concurrently).
- gregstula 11y ago> Abstractions like RAII, constructors and destructors, polymorphism, and exceptions were invented with the intention of solving problems that game programmers don’t have This is the only part of the Jai philosophy I struggle to understand. How is an explicit delete keyword better than deterministic destruction? From my perspective, the former method reintroduces the problem the latter method solves. Also, polymorphism is bad for games now? I absolutely cringe when I see abstract base classes, virtual functions and classical inheritance, outside of a generic interface in 2016. However, games might be the one case I would strongly consider using those features as part of my design. For example, a Final Fantasy-style job system seems to elegantly lend itself to the "Intro to OOP with C++98" style of runtime polymorphism* As for exceptions, well I think the reputation of exceptions is one of the great tragedies of C++. Rust, Go, and other new languages seem to have decided that regressing to pervasive error checking boilerplate is more elegant than to have exception handlers. I think Swift got it right with scoped exceptions and a defer statement - although, they selectively use "error handling" as double speak to avoid saying the e-word. *Although, I personally think interface/protocol based solutions have proven to be the cleanest way to tackle polymorphism -- this is possibly true even in the case of an rpg with class inherentence as a game mechanic.
- w0utert 11y ago>> This is the only part of the Jai philosophy I struggle to understand. How is an explicit delete keyword better than deterministic destruction? From my perspective, the former method reintroduces the problem the latter method solves. My interpretation of statements like "problems game programmer's don't have" is that they don't mean game programmers don't run into situations where things like RAII or polymorphism would be useful, just that the stereotypical game programmer doesn't care about using them because they have their own ways to get the same results. Which often involves programming practices that aren't considered safe for most other application domains. The thing with 'game programmers' when referring to people like Jonathan Blow and e.g. Casey Muratori (who does Handmade Hero), is that they have been writing the same kinds of systems for so long, and have developed so much 'muscle memory' to avoid the pitfalls of their coding style, that they appear to have gotten a blind spot for all the deficiencies in the code they write. It works, it's efficient, and someone with the same mindset could make progress on it despite of the minefields they've created, but it's usually not 'good code'. The Handmade Hero code for example is atrocious if you ask me. It never ceases to amaze me how people who are so smart, much smarter than myself, fail to acknowledge all the ways in which they could write better code without throwing out any of the goals they've set for themselves (performance, compilation speed, predictability, ...). All things considered, it does not surprise me that so many games ship in a half-broken state.
- CyberDildonics 11y agoOne language to look at for reference that most people haven't heard of is Clay. It isn't kept up any more, but it's aim was to be a modern generic C. It made use of very clean generic programming with move semantics and no garbage collection. The person who wrote it was using it as a substitution for C at his work already.
- oconnor0 11y agoMaybe because it hasn't been updated in 3-4 years?
- steveklabnik 11y agoThere are a lot of languages which are "dead" but are useful to look at when you're designing a new one. Clay is certainly one of those if you're looking at building a low-level language.
- dom96 11y agoWhat's cool is that Clay's designer is now working for Apple on Swift https://github.com/jckarter https://github.com/jckarter
- gnuvince 11y agoI remember Clay, it was mentioned on Reddit for the first time around the same time I first heard about Rust (back when Rust was a very different beast). I though Clay was very interesting, it's a shame it is more or less abandoned.
- CyberDildonics 11y agoLooks like that is the current maintainer. The original designer was someone name KS Sreeram http://kssreeram.org/ http://kssreeram.org/
- deleted 11y ago[deleted]
- gcatlin 11y agoJonathan Blow is currently doing an AMA on reddit right now https://www.reddit.com/r/IAmA/comments/45fu74/i_am_jonathan_blow_game_development_person_ask_me/ https://www.reddit.com/r/IAmA/comments/45fu74/i_am_jonathan_...