Friday, November 09, 2007

Doryen in Javascript ?

You may already know this if you read the r.g.r.d newsgroup, but I'm taking some fresh air by prototyping a javascript port of The Chronicles Of Doryen using the recent canvas HTML tag. Javascript has some advantages over C++ :
  • no need to download/install
  • almost no work to port the game to different platform (the canvas tag works out of the box on Firefox and Safari).
  • well, a pure javascript game is sexy, isn't it ? :)
Since my failed attempt to port TCOD to the D language, I'm strongly convinced that any rewrite is a bad thing, so I'm not reassessing the whole project. I definitely keep working on the C++ version. Consider this as a form of relaxation and a technical study.

I have two prototypes for now. If you have Firefox 2 or Safari 2, you can see the real thing by clicking on links below. Theoretically, it should also work on Opera 9, but it's not. Theoretically, it should not work on IE, and guess what ? It's not ;)

  • the TCOD flaming title screen which tests the performances when there are heavy changes on the screen between each frame. On a 80x50 console, this represents up to 4000 calls to the canvas drawing API in each frame. Definitely too much for the current implementation...

  • a simple dungeon test trying to reproduce the TCOD look and feel. Here, there are less console cells updated between each frames, but I still had to do concessions. Thanks to Jotaf for suggesting updating the LOS and lighting every n frames.

If you're interrested in using this framework to create a full featured or 7DRL roguelike, feel free to ask for informations/support/new features/... I'll keep improving the dungeon prototype to see how far I can go (multiple lights for example).