Check out my
new book!
HTML5 Games book
My book: HTML5 Games: Creating Fun with HTML5, CSS3 and WebGL
I just finished writing a book! How cool is that?

HTML5 Games: Creating Fun with HTML5, CSS3 and WebGL
ISBN: 978-1-1199-7508-3
Paperback, ~416 pages
Due out in January 2012


Writing a book is crazy. Like eating strawberries while stabbing yourself in the leg. Painful yet delicious. I have massive respect for people who can just put words on paper like it was nothing.

This has easily been one of the most difficult tasks I've put myself in front of, which I suppose is why I haven't been doing much around here lately. That should hopefully change now that I get some free time again. Anyway, for the past 6 months or so, I've been working on my first book, titled HTML5 Games - Creating Fun with HTML5, CSS3 and WebGL. It's all about HTML5 and related technologies and how they can be utilized in the context of game development on the Web and on mobile devices. It's not out yet but it should be in a few months (edit: it is now out!). Amazon links further down.

Here's a short blurp about it, made by Wiley (my publisher):
Discover new opportunities for building 2D and 3D games with HTML5

The newest iteration of HTML, HTML5 can be used with JavaScript, CSS3, and WebGL to create beautiful, unique, engaging games that can be played on the web or mobile devices like the iPad or Android phones. Gone are the days where games were only possible with plugin technologies such as Flash and this cutting-edge book shows you how to utilize the latest open web technologies to create a game from scratch using Canvas, HTML5 Audio, WebGL, and WebSockets. You'll discover how to build a framework on which you will create your HTML5 game. Then each successive chapter covers a new aspect of the game, including user input, sound, multiplayer functionality, 2D and 3D graphics, and more.
  • Aims directly at a new way to develop games for the web through the use of HTML5
  • Demonstrates how to make iOS and Android web apps
  • Explains how to capture player input; create 3D graphics; and incorporate textures, lighting, and sound
  • Guides you through the process of creating a game from scratch using Canvas, HTML5 Audio, WebGL, and WebSockets
  • By the end of this invaluable book, you will have created a fully functional game that can be played in any compatible browser or on any mobile device that supports HTML5>
If you'd like to buy it, consider using the Amazon affiliate links below, so I can earn a few extra coins.
Read more...
Nihilogic Games is now JavaScript Gaming At some point I'd like the games portal to be able to live on its own and it didn't sit right with me that it was a subdomain of nihilogic.dk. So it now has a new home at http://www.javascriptgaming.com/, check it out. Nothing but the name has changed (yet), though. The games feed is also still the same. Happy friday! Read more...
Games round-up for April 2009 I had hoped to get a good chunk of Brent Silby's games added to the games portal during April but I had to postpone that mission. Only one Silby game made it but fortunately a few other people were also kind enough to email me about their games. As always, just let me know if you know of a cool game that fits the profile.

3bored
A very creative and somewhat abstract canvas-based shooter. If you ever wanted to be a white rectangle with the power of flight and bad odds of survival, this is the game for you.
Read more about 3bored

Balloons and Droids
The only one of Brent Silby's games I got around to adding, Balloons and Droids delivers exactly what it promises - balloons and droids, all in good arcade style fun.
Read more about Balloons and Droids

Canvas Invaders
Yet another Space Invaders clone, made by Jason Brown to gain more canvas experience.
Read more about Canvas Invaders

Coverfire
A remake of the old Crossfire game - and it's Wii enabled.
Read more about Coverfire

mBlocks
Now, there are a lot (and I mean a lot) of Tetris clones out there but this one is so well done that it just puts most other attempts to shame.
Read more about mBlocks

Sarien.net
Sarien.net lets you play old Sierra On-Line adventure games in your browser and spices it up with some interesting multiplayer "action". Absolutely one of the coolest things I've seen in a while.
Read more about Sarien.net

Tetris Bricks Car Racing
Valentin Galea linked me to his nostalgia inducing racing game a'la Tetris, inspired by the handheld devices of yore.
Read more about Tetris Bricks Car Racing

Word Wombat
A fun way to hone your typing skills. Type the falling words before they hit the bottom of the page.
Read more about Word Wombat



Read more...
Games round-up for March 2009 I've been so busy this month, especially the past week or two, that I haven't had time to add a lot of games, but the collection did expand a bit afterall. A few new games were added in addition to a bunch of oldies as well as some of my own game-related experiments.

3D Tomb II
The master of all things tiny, Mathieu 'p01' Henri, created this impressive FPS game in just 4KB.
Read more about 3D Tomb II

Amoeba
A fun, little Roguelike where you have to survive in a dog-eat-dog world (or amoeba-eat-amoeba, I guess).
Read more about Amoeba

BeSlimed
Everyone's favorite puzzle game Bejeweled - MooTools style.
Read more about BeSlimed

DHTML Lemmings
This game says JavaScript gaming like no other. A classic game with a near perfect DHTML implementation.
Read more about DHTML Lemmings

HatenaRunner
From the talented Satoshi Ueyama comes a fun Lode Runner clone.
Read more about HatenaRunner

Helicopter 2K1
Classic chopper action in this nice arcade game.
Read more about Helicopter 2K1

Leisure Suit Larry AGI interpreter
One of my favourites, António Afonso has made an interpreter for the old AGI adventure game format used by Sierra OnLine way back when and is showing it off with some old school Larry Laffer fun.
Read more about Leisure Suit Larry

Scriptris
Tetris clones are plentyful and JavaScript versions are too, but this one has some nice multiplayer options.
Read more about Scriptris

Shapes
A DHTML arcade game inspired by the fast paced Geometry Wars.
Read more about Shapes

Space Invaders Emulator
Not just a JavaScript version of Space Invaders, this is an actual emulation of the hardware used in the old arcade games. It also runs a few other classic Taito games.
Read more about Space Invaders Emulator

Super Mario and Wolfenstein
Also added was three Nihilogic experiments/demos from last year. First the Super Mario game that basically gave life to Nihilogic about a year ago and was later followed up by a Mario Kart experiment. Finally, a partial remake of the first map of Wolfenstein using my own crappy 3D engine.
Read more about Super Mario Bros.
Read more about Super Mario Kart
Read more about Wolfenstein 3D

VideoPoker
Get a piece of casino action with this video poker game by Juan Mellado. No risk of loosing the kids' college funds.
Read more about VideoPoker


I think for April, I might try to dig into Brent Silby's archive of DHTML games. I've been putting it off since there are just so many but there's really no way around it.

Read more...
Creating pseudo-3D games... part 2 Part 2 of my series of articles about how to use JavaScript, DHTML and Canvas to create raycasting games like Wolfenstein 3D is up at Dev.Opera - read the article here.

In this article I've taken the result of the first article and improved upon it by, among other things, optimizing performance and adding sprites and scary (not really) enemies that run after you.

Note that the titles of the articles are a bit misleading since Canvas is only really used for drawing the minimap, everything else is plain DHTML.
Read more...
Games round-up for February 2009 Last month, I opened up another section of Nihilogic devoted to JavaScript games and I got a lot of nice feedback, so I'm hoping it will grow to be a successful site with time. To keep a connection between that section and the blog and for those who want to stay up to date without getting spammed every time a new game is added, I think I'll do monthly round-ups here, briefly summing up all games added during the month.

Ok, on with the games for February. I'll only mention those that were added after the initial announcement and since I'm still largely playing catch-up with several years worth of existing games, most games aren't that fresh anymore but there might a few that catch your eye anyway. As I work my way through the pile of games to add, the old-to-new ratio should hopefully improve.

ProtoRPG
Not really a game as such, ProtoRPG is actually a game engine ready to use if you feel like making your own roleplaying game. Built on Prototype and Scriptaculous.

Final Fantasy Mini Battle
A fun little diversion in this Final Fantasy inspired battle game.

JS Bomberman
A nice Bomberman-like game by Gabriel Munteanu.

Canvex
I really wish Philip Taylor would do something more with this since it's just awesome cool. Raycasting for fun and profit.

Digg Attack
One of my own experiments, a mashup of shoot'em-up action and data from the Digg API.

Stack the Log!
The first of two games from XWUZ, this is a test of quick reactions.

Bubble Trouble
The second XWUZ game is a SameGame-like puzzle game.

Clix
Another puzzle game like Bubble Trouble.

Invaders from Mars
Space Invaders meets Galaxians in this great looking game from Mark Wilcox.

Redline
Fun little side-scrolling racing game.

Z-War
Odds are against you as zombies try to eat your brains in this shooter.

World of Solitaire
This is a really impressive collection of online solitaire games.

Canvas Breakout Tutorial
A step-by-step manual to creating your own Breakout clone with canvas by Bill Mill.


Feel free to use the comments feature to comment on the games or to suggest games you'd like to see added.

I'm also looking for any tutorials and other good resources that would fit in, so don't keep them to yourself!
Read more...
Introducing Nihilogic Games - A JavaScript games portal A small expansion to the Nihilogic site! A new games subsite is now located at http://games.nihilogic.dk/, dedicated to JavaScript games.

As you probably know, there are about a billion sites that collect Flash games (yes, I've counted them), some small and dedicated to niche genres, some big and elaborate. But I've yet to come across a good resource dedicated to just DHTML/JavaScript games, which is why I decided to expand my little site here with a games portal of sorts. It's a subsite of nihilogic.dk and is located at http://games.nihilogic.dk/. It's still very much a work in progress, so I'm still moving things around and stuff.

So far I've only got about 35 games catalogued but there's a whole bunch more in the queue just waiting to be added. The games get tagged with genres, authors, year of production and the technologies used and a small review blurb will tell you what the game is about. The idea is that you shouldn't be able to just browse for, let's say, nice JavaScript platform games, but - since this is a code focused site - also find games that use a certain type of technology, like the YUI library, SoundManager2 or just plain DHTML.

You'll find that the left sidebar is dedicated to these categories and functions as the main navigation bar, while the right bar has a few dynamic lists, featuring the latest games and the popular games. Popularity is based on the ranking of the games, so I hope visitors will share their opinions both by leaving comments and by clicking the pretty stars.

I'll add a "suggest a game" form soon (right now there's just an email link), but until then you are more than welcome to suggest games to be added, either by leaving a comment here or by emailing me. There are not a lot of criteria for what I'll add, except that it should be at least somewhat noteworthy (ie. not Tic-tac-toe or something equally trivial). Tech demos are also welcome if they're in a "presentable" state. And of course - only games based on JavaScript/DHTML/Canvas (although Flash is allowed for sound and such).

There is of course also an RSS feed (in addition to the regular feed) with the latest games for those of you who are into that sort of thing.

Thoughts and ideas about what you'd like to see on such a site are of course more than welcome, just leave a comment below!
Read more...
DOMTRIS - Yet another Tetris clone I don't know how many JavaScript Tetris clones are out there, but I bet it's quite a few. Nevertheless, I decided I would have a go at it since it's just one of those things that a lot of people do when they're first getting into coding games but for some reason I never got around to it then and now I feel cheated.

It's a pretty standard, no frills Tetris game. There are no extra fancy features like some of the later editions, I've tried to keep it "sort of" close to the original. Clearing a line gives a certain amount of points depending on the level starting at 30 points. Clearing multiple lines gives even more points with 4 lines scoring 520 on level 1. As the level goes up, so does the speed of the falling tetrominoes. New levels begin at 500, 1000, 2000, 5000, 10000, 25000 points, etc.

The graphics, if we can call them that, are simply colored div elements. The embossed look is done with a simple CSS outset border type. I think it looks great in Firefox, Opera and Safari, but IE's borders look a bit different. That's ok, though, as I recall the appearance of these borders are not defined in the spec, so I guess IE is free to do as it pleases. It's cosmetic and not that big of a problem anyway.

You can save your progress at any time during the game by pressing "S" after which you will be presented with a URL that you can go to in order to load the saved game. What happens is that the game creates a URL to the game with a long ass querystring containing the current game state. This URL is then shortened via Tinyurl using Simon Willison's json-tinyurl service. So you get a short text string that will fit on the back of your hand, should you need to rush home from work to continue playing Tetris!

I actually had some bigger plans for this, including some interesting democratic "massively multiplayer" twists to the gameplay, but they will have to wait for now. Until then, this is just Tetris, not that that's not cool a game by itself.

Now play DOMTRIS!

Read more...
Creating pseudo 3D games with HTML 5 canvas Just a quick post to let you know that I've got an article up at Dev.Opera where I talk about creating a simple raycasting engine like the one I used in my WolfenFlickr project. Read the whole article here. Feel free to ask questions and leave comments both here and at dev.opera.com. Read more...
Digg Attack - A JavaScript Game Play Digg Attack A Digg-'em-up struggle against the overwhelming forces of social media.

Impatient? Click to play Digg Attack! (read the intro screen for instructions) or keep reading for details and background.

This is something I started a good while ago but only just recently got into a playable state. The goal was to create a small game where the action is based on an external data source. It turns out that the Digg API fits that bill fine as it provides both varied data and a steady stream of it, and thus the product, in its current state, is an unusual 2D shooter where the flow of enemies is based on stories that are "dugg".

The Heroes The protagonists come in the form of a small flock of social media heroes, controlled by targets set by the player and influenced by various objects on the map. They are also somewhat autonomous as they use simple flocking mechanisms to stay close together and move as a group.

With the exception of the music, it uses only the Canvas element and regular DHTML and another goal was that I wanted it to feel "fluid" and be able to compete with similar Flash games, even when there was a lot going on on the screen. I think it meets this goal just fine, at least when played on a moderately sized box. I also know there are some decent optimizations to be done in there once I get around to it (ie. the explosions could be prerendered rather than dynamically created as they are now, etc.) On the sound side there is currently only background music. I had some sound effects going on with SoundManager2, but it's giving me a bit of trouble, so I've sort of abandoned them for now. Also, apart from the vortex sprite and the prerendered text, all the graphics are created at runtime with Canvas drawing.

The music is by friend_kami and brainworks, all released under Creative Commons licenses and found at SectionZ.

Ok, get on with it!

You start each level with a number of heroes (ie. little blueish dudes). The game connects to Digg.com and as stories are dugg, enemies are spawned and enter the screen from either the left or the right side. The type and number of enemies spawned depend on how many diggs the story has received:

Enemies of type 'Antihero' 6-50 diggs: Antiheroes, similar to your heroes, but red (and evil!) Spawn in flocks of 2-7 antiheroes. These guys are small and weak but will nevertheless actively and tirelessly hunt your heroes.



Enemy of type 'Predator' 51-500 diggs: Predators, larger and more dangerous. Coming in packs of 1-3 predators, these also actively hunt your heroes but are easier to out maneuver. Their larger size more than makes up for this, however.



Enemy of type 'Biggie'501-infinity diggs: Biggies. Huge, slow and not very bright. These enemies wander around with no aim, just bouncing about the level. Are tougher to kill than the others, but move slowly.




The goal is to survive - or at least try to - for a number of seconds (typically 60-120) before you autmatically proceed to the next level. If you are so unfortunate as to lose all your heroes (chances are good that you will), reinforcements will be sent in at the low, low cost of 25% of your currently accumulated score.

Don't worry if you keep dying almost immediately, just try again and the next round might be more forgiving. The difficulty varies in time due to the unpredictable nature of the data the enemies are based on. You might be unfortunate and run into a stream of high/medium profile diggs and be flooded with strong enemies, or you might be able to just cut your way through small groups of antiheroes for most of the level.

The levels

As each level has a fixed amount of time, the ultimate goal is to get the highest score by the end of the last level. At present time there are a total of 12 levels with a combined game time of 15 minutes and 10 seconds.

The first level is just an empty playing field. Later levels feature blocking structures, attractors/deflectors, zappers and even small black holes. Here's a quick overview of what you could be facing:

The corner of an obstacle block Blocks: These are simple impassable structures that block your path and/or divide the map in smaller sections.


Director Directors: When you come in the range of a director, your heroes will feel a sudden urge to move in the direction of the arrow. They come in 4 flavours: up, down, left and right.


Attractor Attractors: Much like the directors, these also affect your heroes' senses of direction but rather than make them move in a specific direction, your heroes are compelled to move towards the center of the attractor. Be careful as it can be hard to escape once you've become trapped.

Repulsor Repulsors: The twin sibling of the attractor, the repulsor does the exact opposite and make your heroes move away from the point of repulsor.


Zapper Zapper: High powered electrical menaces that make short work of your magnificent heroes. Come within range of one of these bad boys and one of your heroes is sure to be toast. Fortunately it takes a second before the zapper is ready again.

Vortex Vortex: Gravitational pull will drag your heroes to the midst of these miniature black holes where nothing and everything meet and the very fabric of spacetime is torn apart (that includes your heroes).



Except for the walls and blocks, the enemies are not affected by any of these map objects.

Quick tips

  • The enemies go for the collective (average) center of your heroes. You can exploit this by spreading your heroes out over the entire map.
  • Even if you can't move through blocks, you can still shoot through them.

Mostly tested in Firefox 3 but looks to be working in Opera 9.6 and Safari as well. If you get graphical glitches in Safari, try with a recent WebKit nightly. IE is of course a no go.

So, there are still a bunch of outstanding issues and stuff, but mostly it plays well. Actually, I'm not entirely satisfied with the gameplay yet and would like to evolve it a bit but I'm not sure in what direction. The whole "external data" part is up in the air as well. If you have any suggestions for changes, bug reports :( or just want to comment, please do so below. And post some high scores, even if you don't bother finishing all 12 levels!

There have been reports of issues with Linux and I think it might be related to nVidia cards, so if you're having problems with Linux and have a non-nVidia card, please leave a comment below.

The general rules and the details about how to control your heroes are described on the intro screen, so make sure you read it.

Click to play Digg Attack!

And if you like it, why don't you...
Read more...
Particle acceleration - the JavaScript way In honor of the madly brilliant minds at CERN who are pushing the button tomorrow morning to fire up the Large Hadron Collider, the largest particle accelerator ever built, here is a (100% scientifically correct) JavaScript simulation of how all that physics stuff works.

By combining web technology with state of the art science you now have the chance to take on the role of a lone proton, just going about your business in the LHC awaiting inevitable collision. All delivered in classic monochrome arcade style, as if there was any other way.

Click for particle fun!

Use the arrow keys if you feel like it, your faith has been sealed either way. Happy colliding!

Works best in Firefox, Safari and Chrome, it seems. IE is rather slow due to excanvas Canvas emulation.

Also, for more information about the safety of the LHC, please refer to this link: http://www.hasthelhcdestroyedtheearth.com/.

Disclaimer: Any claims of this being an actual game and/or a correct physical simulation are complete bullocks. It is merely a few hours wasted for fun.
Read more...