7 ms·
Writing a Vi-like Graphics Editor in Racket
- _pmf_ 13y agoDr. Racket is one hell of a development environment. The things we could do if we were using Scheme+Racket instead of Java+Eclipse ...
- nnq 13y agoRacket is a Scheme dialects that adds quite a lot to vanilla scheme as far as I know. The racket IDE is not praised that much and the lispers/schemers I know prefer Emacs/SLIME (though I believe you that it's better than Eclipse). ...so saying "Scheme+Racket vs Java+Eclipse" is really comparing apples to pineapples :) (maybe Clojure+Lighttable is closer to what you'd mean...)
- callmecosmas 13y agoI'm a grad student that works in Racket and fwiw I find that I prefer emacs for editing but DrRacket for testing and debugging. It has great tools for documentation, locating errors and macro expansion and of course it all works out of the box. I also use Geiser, but I've found it buggy and unreliable (including instantly shutting down my OSX machine if I tell emacs to kill it when I quit, plus I still haven't figured out how to limit its memory consumption).
- p4bl0 13y agoJust to be nitpicky, Racket is not a Scheme dialect (hence the name changing from PLT Scheme to Racket a few years ago (already!)). It's not because it not only adds a lot to Scheme but also has somewhat important differences. For instance, `cons` pairs are immutable in Racket: there's no `set-car!` or `set-cdr!` as in Scheme (you can have mutable cons pair using `mcons`, `set-mcar!`, and `set-mcdr!` though). Also the macro systems that Racket uses (`syntax-parse` and co) is quite more advanced than the current Scheme rNrs one.
- moron4hire 13y agoWell, #lang racket is not scheme, but one can run rnrs in the racket runtime. There are many languages that run on the racket runtime.
- jlgreco 13y agoIIRC, Arc/HN runs on mzscheme because they rely on mutable cons cells that newer versions (racket) don't provide. Could they run under new rackets by just telling racket to use a proper scheme?
- moron4hire 13y agoThere is an mzscheme language mode, but it specifically does not include set-car! and set-cdr!.
- jeapostrophe 13y agoAs a Racket author, I can tell you that we provided them with a hack to enable mutation on arbitrary conses, so they can upgrade whenever they wish, and I don't know whether they have or not.
- moron4hire 13y agoWhy don't you? It's easy enough to pick up. I was doing C# for quite a long time (and actually liking it), and just decided to start doing Racket. I've got a project going right now that is 100% custom racket. Once you get the macros down, the code flies. It's pretty amazing.
- nnq 13y agoYou have a client project in Racket? Cool! Care to share what area / what are you using it for?
- moron4hire 13y agoWell, I can only share a little. It's a web app built around a large, temporal knowledge base, with a proprietary data analytics engine that we develop in-house. The engine generates metrics and alerts that give our users decision-making insights. Gads, this sounds like the worst shit-head MBA project ever, but there is a lot I'm leaving out. In the process, it's also a major test bench for a number of development tools we're building. This is where Racket pays dividends: it has a lot of the simple web-dev stuff in a good-enough state to get you off the ground fast, but doesn't pin you down to any one thing, leaving you wide open to rip out and replace whatever you want. Don't like how the HTML templating engine works? If you're good at macros (and Racket's macros are relatively easy), it's a simple job to roll your own. We've got a data comprehension system that has its own pseudo-byte code that treats SQL like a machine-language in need of a VM that gives us a lot of static checking of our queries. We have a migration system that can rebuild the schema and restore data as easy as compiling your application, with reversible data translations between schema versions (so that we often do. Setting up a new developer-machine/test-environment/culster-node/what-have-you is a snap). Some of this stuff would have been damn costly to not just build without Racket's macros, I shudder to think what the changes we've had to make along the way would have been like. Racket lets us take DRY to the extreme. Almost nothing in this project has been difficult to change, or at least no more difficult than the initial effort to develop it, because there is almost never a reason to change the interface to anything, and if it does need changing, the human-readable-code level has so few interaction points it's trivial to change interfaces. Hell, even in the case where a lot of interface changes would be necessary, we could probably just write a Racket program to chop up the S-expressions for us. The mathematics library is also very good, providing a lot of intuitive, high-performance primitives that fit our data crunching needs. And we're currently investigating using the Prolog-like Datalog language mode And the performance is extremely good, especially if you're coming from the Python/PHP/Ruby world. I find it as expressive as Python (actually, translating Python programs is nearly 1-to-1) but with performance more like static C#. The optimizer is very good and there is a typed version of Racket that gets optimized even more. Yeah, you should use Racket even if you don't plan on learning macros, because it's as easy as Python and its a lot faster. All along the way. Graphics primitives: standard library feature. Parallel code: super-simple, very solid, and built in. Linear algebra: very solid, very easy to use (almost as easy as basic primitives) and again, built in. Distributed package management: built-in, it's part of the regular import syntax. Racket-to-JavaScript translator: well, not quite built in yet, but the package manager might as well let you treat it as so. Cross-platform compatibility: haven't had a single issue getting people on Linux, OS X, and Windows up and running with development yet. If you've ever tried getting Scala or Clojure or Ruby setup on your own, Racket blows them out of the water. I'm not terrible certain the fundamental premise of the project is sound, but at the end of the year we're going to have something of value on our hands, whether it's the raw data of the knowledge base or the development tools. Racket doesn't just let us build proof-of-concepts fast, it lets us expand them into heavy-lifting mode pretty quick, too.
- unwind 13y agoI missed screenshots, it seems this editor has a fairly unique (or at least unusual) concept but it's much harder to quickly get it from the textual description. It's intriguing that it talks about very simplistic sprite definitions (8 colors), but yet seems to expect the sprites to be rendered using 3D hardware (talk of normal maps and lighting).
- goldfeld 13y agoSame here. And it's even more intriguing for me that it seems to match a lot of my own current game design aesthetics (namely the idea of simple, very low pixel graphics but with high-end light and particle effects). What's more, when browsing for the simplest (yet powerful) sprite editor for my own use, I found Pixen to be the best available option but still I dreamed of a vi-like pixel pusher (I was thinking in terms of having buffers with, say, small reusable sprites which then I could compound to make variations and animations, all accessible through a CtrlP inspired browser.)
- jeapostrophe 13y agoThis is the author. I agree very much with both of you. I assemble all the tiles into texture atlases (and earlier post discusses the technique) and then use a fairly simple shader to render. If you look in the gb/graphics directory [1], then you can see the GLSL code. It was originally coded for OpenGL 3.3 with geometry shaders but I switched to OpenGL 3.00 as a stepping stone to ES 2. The whole model is based on the concept of "SNES Unbound": I want to have effectively infinite numbers of sprites with many layers and any Mode 7 effects with arbitrary scaling and rotations. This is a very small level of expectation of a modern GPU, so I can get about 1,000 FPS on my laptop with millions of sprites, because I only use a single OpenGL draw call per layer. Anyways, I'd be happy to comment or chat more with you. Maybe I should post some screenshots of the editor. Jay 1. https://github.com/get-bonus/get-bonus/tree/master/gb/graphics https://github.com/get-bonus/get-bonus/tree/master/gb/graphi...
- BMarkmann 13y agoI'm not sure why, but I love that Racketeers write their docs in Scribble. The application docs look like the platform docs... it makes everything have a very cohesive feel. So much more powerful than something like JavaDocs, too, since you get the full power of the language. http://docs.racket-lang.org/scribble/ http://docs.racket-lang.org/scribble/
- gcr 13y agoScribble is excellent. My favorite part about Scribbled documentation is that everything from code samples to function names in text is clickable. Even the function names in the five-line code samples on the front page of http://racket-lang.org/ http://racket-lang.org/ are clickable; you can just jump straight to any function's documentation from the home page of the language.
- losethos 13y agoAny older programmer is appologetic when it comes to burdening other programmers with learning their creations. I kinda cringe that I broke with ASCII and made text/graphics source files. It's so much nicer when it can be just ASCII. We all have to interact with files -- who can do anything 3rd party tools with PDF? Nobody. How awful. What a waste. I did text/graphic source files, though. It has benefits. I hope other programmers can make an itsy-bitsy investment of effort and learn how to use my doc Load/Save library and an itsy bits more to learn the doubly-linked-list structure it is manipulated in memory with. If you invest a tiny effort into learning the double-linked-list sequence of commands like TEXT, CARRIAGE_RETURN, TAB, COLOR, LINK, it's really nice. It's uh kinda compilicated. commands have flags and the flags kinda override the base command functionality. You can make a picture (sprite) have a link with a flag. God says... the strife of the congregation, to sanctify me at the water before their eyes: that is the water of Meribah in Kadesh in the wilderness of Zin. 27:15 And Moses spake unto the LORD, saying, 27:16 Let the LORD, the God of the spirits of all flesh, set a man over the congregation, 27:17 Which may go out before them, and which may go in before them, and which may lead them out, and which may bring them in; that the congregation of the LORD be not as sheep which have no shepherd. 27:18 And the LORD said unto Moses, Take thee Joshua the son of Nun, a man in whom is the spirit, and lay thine hand upon him; 27:19 And set him before Eleazar the priest, and before all the congregation; and give him a charge in their sight.