I am writing a roguelike in Elm, where there is a discrete 50x50 grid (see share-elm.com snippet). A roguelike is a video game, where objects (like enemies, items, walls, etc) are represented by ASCII characters. Therefore I should be able to have hundreds of different ASCII characters, aligned in a rectangular grid. Every character should be strictly within its grid cell.
To create this grid, I put every character in a square container
(1/50 size of the actual game container). This means I can have 2500 containers in the game maximum. Elm creates <div>
elements for containers, even if I convert these containers to Form
and put them inside a collage
. This makes my Firefox 39.0 very slow in performance.
How do I create a rectangular grid with nicely aligned ASCII characters (and possibly some other graphical elements) within its grid cells, so that no matter how many elements I have at the same time, the collage still stays quick and responsive? And what is the general idiomatic approach every time I'm writing a program with lots of containers and other elements inside a collage? Or maybe there is a completely different approach to creating snappy rectangular grids in Elm?