Comments on The Art of ASCII

6 Comments.

If you want to have an angband / Ultima style “field of view” to go along with your fog of war, I found this library to be great:

http://code.google.com/p/libfov/

It’s in C, so it won’t work with your javascript. But you can at least use it as a coding guide for such a beast 🙂

-- Cheetah 2017-10-16 06:48 UTC


Thanks. There are many algorithms, including some simpler ones. RogueBasin has a nice selection. But I have plenty to do before having to worry about the FOV.

-- Felix 2017-10-16 06:49 UTC


For your terminal information, how about doing an array of DIVs each containing an array of one-character monospace SPANs? Then you can control the content and the style of the SPANs separately, and even just put references to all the character SPANs into a separate two-dimensional array (or even make a two-dimensional array of objects that handle the SPAN attributes using dynamic JS properties).

-- fluffy 2017-10-16 06:49 UTC


Actually, the natural solution here would be to use a table element. Unfortunately, it would end up having 1600 TDs, which means 1600 DOM elements, which means… tons of RAM. And it just seems ridiculous to have a simple roguelike (text-based, no less!) use up so many resources just because it happens to be running in a browser.

-- Felix 2017-10-16 06:49 UTC


Well, a browser isn’t a dumb terminal. One could argue it’s pretty ridiculous to want to emulate a dumb terminal in a browser to begin with. 🙂

As a compromise you could have your PRE contain 1600 SPANs to allow the formatting thereof, which is the same order of magnitude of memory use as the table (as was my previous answer) but at least it would run pretty efficiently (I think). But a PRE is really just a DIV with a couple of default style rules anyway.

-- fluffy 2017-10-16 06:50 UTC


Yeah. I’ll just go with more geometric levels until I can get actual graphics for the game; the browser version is going to need it anyway. But, gameplay first.

-- Felix 2017-10-16 06:50 UTC