Author Topic: Unicodetiles.js: JavaScript character tile engine  (Read 25583 times)

yam655

  • Rogueliker
  • ***
  • Posts: 59
  • Karma: +0/-0
    • View Profile
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #15 on: March 22, 2012, 09:41:35 PM »
@aave:
That's odd about unifont. I would have thought it would have exclusively been either 8x16 or 16x16. The fact that any of them became anything else would have to be a bug in the TTF conversion process. The things start off as an old-school bitmap font -- this is why it is blocky. The dual size thing is should be relatively common for a lot of fixed-width fonts -- it dates back to the old dumb terminals where a Chinese character would be twice as wide as a Latin character. Decent terminal emulators deal with this properly. (Though sometimes they only allow double-wide characters in every other location.)

In my "Blacken" Java library, I explicitly check to see if the max width of a character in the font is twice as wide as an "M". If so, it is a dual-width font. I have code to support it... but I've not gotten around to actually testing it.

I think one thing that would really benefit the roguelike community as a whole would be a high-quality "Roguelike" font. The focus would be on glyphs useful for roguelike games. Sort of a companion and alternative to the shared tile projects... So far, I've gotten as far as getting FontForge installed and working... We'll see how much steam I actually have for the project. ;)

In particular, I want doors which look like doors on architectural drawings -- complete with a directionality. I want to increase the clarity of the display -- something possible with the clear meanings of standardized iconography, but muddied with colorfully drawn tiles. That said, I also want monsters incomprehensibly horrible -- something only possible with fully abstract representations. Any tile graphic fails. With a tile you always eventually know what you're up against. With an letter you may never know...

The difference between basing a "Roguelike" font on DejaVu versus "FreeMono" is a one of license. DejaVu is public domain. FreeMono is GPLv3. For a web game, it means you can keep the source to DejaVu secret, but for FreeMono you need to make it available (along with any changes).

I actually think we would need three Roguelike fonts: 1 single width, 1 double width, and one dual width. I think the dual-width can be automatically created from the other two source fonts with a script, so it would be a distributed font but not one that would require a separate source file.

cherbert

  • Newcomer
  • Posts: 4
  • Karma: +0/-0
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #16 on: June 29, 2012, 12:09:32 PM »
Oh my god, this is exactly what I have been looking for for months and months! Thank you!

I want to develop an ASCII lookalike RogueLike with Multiplayer and this looks like the perfect engine for the job. You code is beautiful and well documented. The infinite forest demo is amazing and means I can have world sizes of infinite size and be fed from a database along with player positions.

Apart from posting to thank you I just wanted to please ask you to keep up with this project and I look forward to seeing it develop further. Its wonderful.

Chris.

Tapio

  • Newcomer
  • Posts: 46
  • Karma: +2/-1
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #17 on: June 29, 2012, 01:23:07 PM »
Oh my god, this is exactly what I have been looking for for months and months! Thank you!

I want to develop an ASCII lookalike RogueLike with Multiplayer and this looks like the perfect engine for the job. You code is beautiful and well documented. The infinite forest demo is amazing and means I can have world sizes of infinite size and be fed from a database along with player positions.

Apart from posting to thank you I just wanted to please ask you to keep up with this project and I look forward to seeing it develop further. Its wonderful.

Chris.
Thanks for the positive comments. As a side note, I'd recommend node.js with socket.io for your multiplayer server and communication library respectively. You'll get real-time communication, dead-simple API and the ability to write the server in JavaScript too.

Regarding the future of Unicodetiles.js, I'm currently not coding any web roguelike actively, so the library is also in "maintenance mode", which in this case means I'll probably make tiny tweaks/fixes from time to time and handle pull requests should some emerge, but chances are nothing major will happen, until I pick up a project that uses UT. If you have bugs or feature requests, feel free to shoot though.

cherbert

  • Newcomer
  • Posts: 4
  • Karma: +0/-0
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #18 on: June 29, 2012, 02:05:32 PM »
{deleted}

I sorted my problem.
« Last Edit: June 29, 2012, 02:21:50 PM by cherbert »

konijn_

  • Newcomer
  • Posts: 29
  • Karma: +0/-0
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #19 on: June 29, 2012, 02:14:27 PM »
@aave : the only thing that I would want for this engine is to have smoother large maps, tripling map size makes the engine too slow.

Other than that the engine is pretty much spot on.

T.

cherbert

  • Newcomer
  • Posts: 4
  • Karma: +0/-0
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #20 on: June 29, 2012, 02:16:41 PM »
@aave : the only thing that I would want for this engine is to have smoother large maps, tripling map size makes the engine too slow.

Other than that the engine is pretty much spot on.

T.

Why not just use the infinate map example? You can then just populate the world dynamically as the player explores.

konijn_

  • Newcomer
  • Posts: 29
  • Karma: +0/-0
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #21 on: June 29, 2012, 02:36:27 PM »
@aave : the only thing that I would want for this engine is to have smoother large maps, tripling map size makes the engine too slow.

Other than that the engine is pretty much spot on.

T.

Why not just use the infinate map example? You can then just populate the world dynamically as the player explores.

Sorry, what I meant was tripling the viewport/screensize, not the map.

T.

cherbert

  • Newcomer
  • Posts: 4
  • Karma: +0/-0
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #22 on: June 29, 2012, 03:01:13 PM »
@aave do you have a quick solution to getting contents of a tile from a mouse click?
« Last Edit: June 29, 2012, 04:05:00 PM by cherbert »

Tapio

  • Newcomer
  • Posts: 46
  • Karma: +2/-1
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #23 on: June 30, 2012, 10:06:55 AM »
Quote from: konjin_
tripling map size makes the engine too slow.
I've spent quite a bit of time trying to optimize the performance, but in the end it's browser performance that counts. The canvas renderer is much faster than the DOM one and the choice of browser brand counts too: e.g. in one benchmark, I get average frame time on 20ms in Firefox, 12ms in Opera and 10ms in Chrome (there is a small pause at the start of Firefox benchmark, perhaps it analyzed that GPU acceleration should be used and switched to that, so the number might be affected by that initial pause). You can test yourself here: http://tapio.github.com/unicodetiles.js/tests/

You should also try enabling the tile cache, but it probably maters only if you do heavy procedural "infinite" stuff.

If you really want to fill the screen with tiles, you should make the font bigger with CSS. No roguelike uses hundreds of tiles x hundreds of tiles viewport anyway.

Quote from: cherbert
@aave do you have a quick solution to getting contents of a tile from a mouse click?
Nope. Somehow I dislike mouse in roguelikes, so I have not given it any thought before. For the DOM renderer, it would probably be rather easy to attach an event handler to all of the tile elements on the engine side, but the canvas renderer needs fiddling with mouse coordinates, i.e. you need to get the mouse x,y, subtract the canvas x,y from that, then divide by the canvas w,h, multiply by tile counts in w,h and take the integer portion (or something along those lines). Not actually that hard probably, but I'm not too interested in adding the feauture (patches welcome though).


PS. I uploaded a new example I had lying around. It's not too exciting and presents a feature that has been in the engine for some time now, but still.
« Last Edit: June 30, 2012, 10:10:25 AM by aave »

Tapio

  • Newcomer
  • Posts: 46
  • Karma: +2/-1
    • View Profile
    • Email
Re: Unicodetiles.js: JavaScript character tile engine
« Reply #24 on: July 03, 2012, 01:45:27 PM »
A quick dev update!
I added a QtWebkit based native wrapper app, so if you want to cheat those weird people who prefer native executables into liking you, this is what you have been wating for (works for any HTML5 game, not just Unicodetiles.js based). Also useful if you'd like to offer the game to someone who's stuck with IE.

In other news, I forgot to mention here that Kevin Mees has ported Unicodetiles to Ruby language. You can take a look at it here: http://kmees.github.com/projects/unicodetiles.html