The Null Device

Posts matching tags 'javascript'

2013/10/18

Toy of the day: PuzzleScript is an online (browser-based) game development environment capable of making a wide variety of turn-based puzzle games, ranging from Sokoban (of which the Hello World-esque example one starts with is a variant) to more sophisticated and/or eccentric games.

Games are written in a functional/declarative notation, consisting of rules; for example, the Sokoban rule allowing the player to push a crate is written as:

[ > Player | Crate ] -> [ > Player | > Crate ]

Graphics are deliberately kept simple, with elements being 5x5 blocks of coloured pixels, giving the game a vaguely Atari 2600-esque aesthetic.

There is a gallery of games made by users, each with an animated GIF representing the game's play. Some examples:



Games were originally turn-based (in that nothing happened except when the player moved), but there is an experimental real-time feature. Somebody has already coded a (semi-functional and not particularly exciting) Pac-Man clone.

(via MeFi) functional programming hacks javascript nifty videogames 0

2013/1/3

The latest in the ever-onward march of awesome: Scripted Amiga Emulator, which emulates a classic Amiga (of configurable specifications, though including video and audio hardware) entirely in JavaScript. Unlike the various JavaScript PC and Linux emulators, emulating the Amiga's various coprocessors probably will cause your machine to break a sweat. Running Turrican 2 on it was slow, and had the interestingly hauntological aesthetic effect of the music speeding up and slowing down, like on those battery-operated chip-tune Walkmans that everyone had in the 19A0s.

amiga awesome javascript retrocomputing 0

2012/12/1

This is awesome for more than one reason: The BBC's R&D department has posted a web page recreating various vintage Radiophonic Workshop effects using the Web Audio API, complete with source code and descriptions, both of the historical equipment used and the modern recreation.

audio awesome bbc javascript music radiophonic tech web audio 0

2012/11/15

Today in Extreme JavaScript: An original IBM PC, simulated in the browser. It has a CGA adapter and two simulated floppy drives, into which one can load a number of pre-supplied images, including several versions of MS-DOS PC-DOS, as well as VisiCalc and Microsoft Adventure. Not only that, but, if left to its own devices, it will run an order of magnitude faster than an original IBM-PC.

Anyway, the simulation is fully functional on all modern browsers (that I've tested). It's booting the original IBM PC Model 5150 ROM BIOS (no modifications), and it's loading the original MDA/CGA fonts. This configuration gives you more control, allowing you to toggle any of the SW1/SW2 settings to change the memory configuration, the installed video card (MDA or CGA), and the number of diskette drives. There's also a built-in debugger with lots of DEBUG-like commands, only better. And you can create your own configuration by tweaking the underlying XML file. I'll eventually do a write-up explaining how to embed it on your own web page and what options are available. The process is very similar to embedding the C1Pjs simulation that I wrote earlier this year--the XML is just a little different.
The author, a chap named @jeffpar, is now looking to add more features to his emulator, bumping up the display to EGA graphics, upgrading the CPU to a 286 and adding a serial mouse.

This is not the first PC emulator to be written in JavaScript; some two years ago, a chap named Fabrice Bellard wrote a JavaScript-based PC emulator capable of booting Linux on a JavaScript-emulated Pentium box. Bellard's emulator, though more powerful than a 1981 IBM PC, was purely text-based.

Also on doing cool things with JavaScript: Stuart Memo (who was in the 1990s Glaswegian punk/electropop band Bis) is now writing music tools in JavaScript, using the Web Audio API. He has a few demos here, and recently gave a talk at JSConf in Berlin titled JavaScript is the new Punk Rock, where he envisioned an open browser-based music-making platform.

awesome bis ibm javascript ms-dos music pc retrocomputing 0

2011/6/23

A few interesting links I've seen recently:

awesome culture design film javascript lounge music retrocomputing tech 0

2010/6/18

The age of vector graphics on the web is drawing closer; Raphaël is a JavaScript library which gives you a portable way of drawing vector graphics, not only on all modern browsers but, amazingly enough, on Internet Explorer from version 6 upwards. (It uses SVG on modern browsers and VML on Microsoft's ones.) Anyway, Raphaël code looks like:


var paper = Raphael(10, 50, 320, 200);
var c = paper.circle(50, 50, 40);
c.attr({fill: "#000", stroke: "none"});
c.node.onclick = function() {
    c.attr("fill", "red");
});
It also handles images, text, and paths (using the SVG path notation). And here is a set of free icons, all implemented as path strings for use in Raphaël; they look fairly neat and modern, though, being single path objects, are monochrome. Being paths, though, they scale seamlessly.

So how soon can you use this in your web sites? Well, it runs with most of the web browsers in use these days, though needs a 55Kb (20Kb gzipped) JavaScript file. You'll probably need to host this file yourself, neither Google nor Yahoo! seem to have added it to their public CDN systems yet (though perhaps it's only a matter of time).

graphics javascript nifty svg tech web 0

2009/11/27

Apple have just released the specifications for the iTunes LP format, a way of encoding extra content to wrap around music albums, and it looks very elegant. As mentioned before, an iTunes LP is a directory containing the original media and graphic files, as well as XML metadata, HTML/CSS for presentation, and code in JavaScript for the navigation. The JavaScript code uses a framework named TuneKit, which, in characteristic Apple fashion, is elegantly Model-View-Controller; rather than littering DOM objects with event handlers, an author defines controller classes which deal with the relevant events.

Apple say that they will start accepting automated submissions of iTunes LP content to the iTunes Store in the first quarter of 2010. Of course, as the format is open, there is nothing preventing people from rolling their own and selling them from other sites.

I wonder how long until there are open-source iTunes LP players for platforms such as Linux.

apple html itunes javascript programming tech 8

2009/9/17

This is pretty awesome: a browser-based SNES NES emulator written entirely in JavaScript. Let me repeat that: someone wrote code in JavaScript (not in Flash or Java or anything faster) for emulating a Super Nintendo almost in its entirety*, from the 6502 CPU to the graphics and I/O hardware, and got away with it (it gets a respectable 33 frames per second in Chromium, though crawls along painfully in Firefox). The source code is all there in the page, unobfuscated, and the author has released the code (which is fairly elegantly laid out and comprehensible) under the GPL. Which means that it's probably only a matter of time until someone uses it to build a DHTML-based Commodore 64 or something.

* there's no sound, as one might expect.

(via Download Squad) 6502 awesome emulation javascript nes nintendo retrocomputing tech 2

2008/9/2

Google are apparently working on a new web browser. Named Chrome, the browser is designed more like an operating system which happens to be based on web technologies like DOM and JavaScript than a traditional browser; different pages are separate processes (and about time, too) and privileges are compartmentalised to fortify security. Meanwhile, the web rendering implementation is based on WebKit (the Apple/KDE open-source web engine), with a JIT-compiling JavaScript engine optimised for application from a Danish company named V8 (I wonder how it compares to Apple's Squirrelfish and Mozilla's new engine). Alas, there's no code available (and the URL given returns a 404); instead, Google have given us a beautifully drawn 38-page comic by Scott McCloud, illuminating the technical innovations and the reasons for them, in great detail and with no small amount of humour:

That's all the detail that seems to exist so far. There is a possibility that it's just an elaborate feint; Google could, in theory, have paid McCloud some huge sum to draw a comic to specification, peppered with technical versimilitude, purely in order to send Microsoft/Apple/Yahoo!/whoever's development teams on a wild goose chase. Though I suspect that there is an actual product there. For one, Google are known to use WebKit on Android. More importantly, though, a browser designed as a web application operating system (with the expectations of performance and stability that implies), rather than an information viewer with programmability grafted on as an afterthought (as is the case with current browsers), would line up rather nicely with Google's strategy to make the web into a first-class application platform.

There are no details on what platforms Chrome will run; it is open-source (and other projects, or those willing to fork those, will probably have a field day with this), and the comic does mention Windows in one place, so presumably a Windows version is planned. I'm guessing that Google aren't doing this to help Microsoft sell Windows licences, though, so presumably this is not the only version planned. A Linux desktop version, running on top of X, is probably likely. Another possibility is it running over something lighter than the average Linux desktop, making a robust web-browsing appliance on which the browser meets the conventional definitions of an operating system; either Android or some other lightweight OS.

The other option, of course, is that this is an elaborate hoax, akin to the Photoshopped "spy photos" of new Apple Mac tablets and other fantastic gear that are a regular feature of gadget blogs. The fact that Google's Chrome page doesn't yet exist (at time of writing) does suggest this possibility. Though this would imply that the hoaxers had an enormous amount of time on their hands, excellent comic drawing skills and an uncanny mastery of the drawing style of Scott McCloud.

Update: Google have confirmed Chrome. It's initially a Windows product (presumably to win market share before IE8 comes along and shuts off Google's oxygen with its advertising cookie blocker), though Mac and Linux versions are in the works. The Windows version will apparently be out tomorrow.

(via /.) chrome comics cs design google javascript scott mccloud tech vaporware web 3

2007/4/11

Someone has written a JavaScript-based 6502 assembler and emulator. The system compiles 6502 assembly language into JavaScript, includes a (low-resolution) emulated video display, and is powerful enough to play simple games like Pong (included in the examples).

In other 6502-related news, here is a commented disassembly and detailed analysis of Rob Hubbard's music playing code, as seen in numerous Commodore 64 games of the 1980s (and later ripped off by crackers and demo scenesters). If there was a museum of feats of 8-bit computing, this routine would be sitting in a prominently placed glass case in one of its wings.

(via jwz, c64music) 6502 8-bit assembly language c64 chiptunes emulation hack value javascript music retrocomputing tech 2

2007/2/28

JavaScript 1.7, the version used in Firefox 2.0, has a raft of Python-inspired features, including generators and list comprehensions. So now, you can do things like:

function fib() {
  var i = 0, j = 1;
  while (true) {
    yield i;
    [i, j] = [j, i + j];
  }
}
and
var evens = [i for (i in range(0, 21)) if (i % 2 == 0)];
And, indeed, bulk assignments, like:
[a, b] = [b, a];
That is, as long as you're not concerned about your code working on non-Mozilla web browsers. (I wonder whether Microsoft, who still have well over 80% of the browser market, will adopt these new features.)

functional programming javascript python tech web 0

2005/6/26

Firefox extension of the day: NoScript, which allows you to enable JavaScript selectively only for specific trusted sites, disabling it for everyone else. Which, in the age of sneaky phishing attacks (not to mention sites which obnoxiously maximise their windows, disable the right mouse button or do similarly annoying things), it could be quite useful.

firefox javascript security tech 2

2005/6/16

JS/UIX; a complete virtual UNIX machine that runs entirely in JavaScript using DHTML. Well, not entirely complete; the realistic-looking executable files in /bin, upon closer inspection, have sizes of 'n/a', and are basically façades for JavaScript pixie dust that does what they are meant to; also, the shell doesn't actually support any scripting commands. However, you can create and access files, and it even has a mostly usable implementation of vi.

(via /.) javascript nifty unix web web toys 0

2005/5/27

TiddlyWiki, a rather nifty-looking JavaScript/DHTML-based wiki running entirely in the browser. It doesn't actually have a back-end, so it's read-only unless opened from a local file in Firefox. As used in Charlie Stross' slightly facetious guide to the Singularity.

Update: And here is a properly AJAX version of TiddlyWiki, which uses a PHP back-end to store entries.

ajax dhtml javascript software tech wiki 0

2005/2/9

A fairly informative dissection and analysis of Google Maps and how it does its magic. It's pretty interesting; unlike GMail (the other example of an impressive DHTML-based interface from Google), Maps doesn't use XMLRPC, but instead just fetches tiles in JavaScript and uses a hidden frame to communicate with the server, and the browser's inbuilt XSLT engine to parse the result. Which all makes for some very impressive hack value.

ajax google google maps javascript programming tech web web 2.0 0

2004/9/20

Annoying web interface of the day: Loot.

This is a UK-based classified advertising site, offering listings of real estate, items for sale, personals and so on. Which is all very well, except that some genius had the brilliant idea of not using ordinary web links for ads, but instead doing it all in Javascript. When you click on an ad, it executes a piece of javascript which changes the current window's location for you. This means that it is impossible to open an ad in a separate window or tab; you can only view Loot in one window at a time, linearly going from ad to ad and backtracking as need be.

I have no idea why anybody could have thought that sort of user-hostile web design is a good idea. It's not to encourage people to pay (paid users get the same interface), it doesn't give the site a slick, Gmail-like interface (it's just a normal web site, except that you can't easily view more than one thing at a time), or otherwise contribute to the user experience (unless, perhaps, the user is a submissive masochist), it doesn't even seem to aim for the holy grail of Protecting Valuable Intellectual Property. The only possibilities I can think of are: (a) that they were betting that, by slowing down user browsing of their site, they could eke more time-limited ad-viewing tokens out of their users, and that no competing website would steal their customers by offering a less annoying experience, or (b) that whoever designed it just wanted to show off their web kung fu ("Look mum, Javascript!")

annoyances javascript loot usability web 2

2004/5/18

I'm Wayne Kerr, and if there's one thing I hate... it's web sites which use Javascript to disable the right-button menu. It's the web equivalent of copy-protected CDs; it doesn't stop people from downloading their images/content or stealing their HTML design secrets (if your browser can download it, you can grab it), but does prevent honest users from opening a link in another window/tab, should they so desire.

annoyances javascript wayne kerr 3

2003/8/16

Lemmings in DHTML/Javascript; a faithful reconstruction of the classic Amiga game, with no Flash/Java involved. Still a work in progress, but impressive as fuck. See it before it's Slashdotted. (via MeFi)

dhtml javascript lemmings nifty web web 2.0 1

2002/8/15

I'm Wayne Kerr, and if there's one thing I hate... it's web sites which disable your browser's right mouse button, just to show that it can be done/to assert control over your web browsing. Like this one. If I want to open a link in a Mozilla tab, instead of the menu I get a pop-up message saying "function disabled". Oooh, I stand in awe of your godlike JavaScript skills. Wanker.

annoyances javascript wayne kerr web 4

2001/10/31

Sick of pop-up ads and other nastiness? Well, if you use Mozilla, here's how to switch off JavaScript "features" on a site-by-site basis. This is not in the UI yet, either because they haven't gotten around to doing it, or because they've snuck it in under AOL's nose.

javascript security web 0

2001/1/4

I'm Wayne Kerr, and if there's one thing I hate... it's that stupid JavaScript scroller gimmick. You know, the one that some pages have, scrolling a flickery message (typically something droolingly inane like "Hi! Welcome to my web page!") through your browser's status bar. You can't stop it (as you can GIF animations), you can't see any links you put the cursor over, and it's irritating as hell. And no, it's not cool, or clever, and it makes the designer of the web page (or the pointy-haired management type who signed off on it) look like a cretin. Unfortunately, the Ausway street directory home page has succumbed to this particular lapse of taste.

annoyances javascript wayne kerr web 0

2000/10/26

A somewhat psychoceramic religious extremist group has seemingly not been too happy with the heathens poking fun at them, and has decided to fight back. The source of this page on the evils of teen pop bands contains this interesting JavaScript fragment:

var redirectto = "http://abortiontv.com/AbortionPictures1.htm";
var refusedfrom = "http://www.landoverbaptist.org/news0200/backstreet.html"; // required prev. page
if (document.referrer.indexOf(refusedfrom) != -1) {
alert("Access ot this page is forbidden from Landover Baptist");
window.location=redirectto;
}

That really says a lot about fundamentalist psychology; in particular their favour of psychological impact and manipulation over reason.

abortion javascript landover baptist religiots 0

2000/9/29

I'm Wayne Kerr, and if there's one thing I hate... it's web sites which require JavaScript to work, for no reason other than custom pop-up windows looking cool. Sadly to say, the Fringe Festival site is one example.

annoyances javascript wayne kerr web 0

This will be the comment popup.
Post a reply
Display name:

Your comment:


Please enter the text in the image above here: