Tilemap.build issue

Discuss suggestions to improve the Axel library.

Tilemap.build issue

Postby tharo » Sun Mar 31, 2013 10:22 am

Hi Arkeus, its not rlly a Bug but I like to report anyways:

If you pass a map to Tilemap.build that only contains 0 indexies, you get pretty weird buffer overlow issues at runtime.
Thad made me almost NUTS o.O Atm I quick-patched it by taking care of it in line 184 by setting a boolean and later returning zero.
I dont think that this is the best solution .. but well...

Code: Select all
         var rowArray:Array = mapString.split("\n");
         var index:uint = 0;
         var notzero = false;
         rows = rowArray.length;
         for (var y:uint = 0; y < rows; y++) {
            var row:Array = rowArray[y].split(",");
            cols = Math.max(cols, row.length);
            for (var x:uint = 0; x < cols; x++) {
               var tid:uint = row[x];
               if (tid == 0) {
               notzero = true;
               tid -= 1;
               var tx:uint = x * tileWidth;
               var ty:uint = y * tileHeight;
               var u:Number = (tid % tileCols) * uvWidth;
               var v:Number = Math.floor(tid / tileCols) * uvHeight;
               indexData.push(index, index + 1, index + 2, index + 1, index + 2, index + 3);
                  tx,             ty,               u,            v,
                  tx + tileWidth,      ty,               u + uvWidth,   v,
                  tx,               ty + tileHeight,   u,            v + uvHeight,
                  tx + tileWidth,      ty + tileHeight,   u + uvWidth,   v + uvHeight
               index += 4;

         if (notzero == false)
            throw new Error("Error: Bad Tilemap Data. As least one Index need to be not zero.");

or just return null ..
Posts: 15
Joined: Fri Mar 29, 2013 4:31 am

Re: Tilemap.build issue

Postby tharo » Sun Mar 31, 2013 12:36 pm

Okay. NOW I got a real Issue ..

We made a Tiled Map with 64x64 times 16x16 pixels tiles and ... well. Its fucked up. But take a look:

(only layer 0)

We are in the lower 20% of the map. As you can see something went terrebly wrong with the texture blending. Dont ask me what. All black fields are zero (0) valued fields.
If i scroll up to the first line of tiles and set something in its _not_ broken there.

(only layer 1)
Different Issue but I think its caused by the same thing: a big tile map with a "hole" of tiles. Inside of the hole we get data shit.

This Issues can stack up to a true nightmare:

Well. It SHOULD look like this:

Well. What went wrong on my side? I re-started the map. Yes. All this screenshots use 100% the same code. The only difference is the map file I loaded in ... and I think it might be because of all the zero fields ... :/

Well. In case: catch me on irc <.<
Posts: 15
Joined: Fri Mar 29, 2013 4:31 am

Return to Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest