Ok, short explanation about what's going on:

There's this game that looks like this: http://www.tigsource.com/features/images/dwarffortress-big.png And i'm writing this to get something that looks like this: http://www.videogames.net.au/images/dwarf-fortress-3d-visualizer-beautiful-fortress1.jpg

The game internally stores the data as 16x16 blocks of single tiles. My script grabs the current cursor position and then grabs the data around the cursor and converts it into a big unified multi-dimensional by extracting the tile type and storing it in said array. That array is then later used to render images in OpenGL.

$bx and $by are the coordinates of each 16x16 block on the 2d plane, while $bz is the z dimension that's equal for tiles and blocks. I get the data for each block as an array of 256 values, through which i cycle, and which i then insert into the "real" coordinates it would have, which is why i'm doing the ($bx*16)+$x stuff.

A diagram of the refresh loop is available here: http://dwarvis.googlecode.com/svn/trunk/lifevis/lifevis.dia

As for your suggestions: I can't even figure out what you're doing with the binary operations there and i'd like to strike a balance between readability and performance. PDL, i have never heard about that and from glancing at the linked page i also can't figure out how it would help me. Sorry if i'm being dumb here and thanks for trying.

In reply to Re^2: How to speed up a nested loop? by Xenofur
in thread How to speed up a nested loop? by Xenofur

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.