# MacD

Members

8

122 Neutral

• Rank
Newbie

## Personal Information

• Location
The Netherlands
1. ## Why is this terrain using 4d simplex noise not tiling?

Pffffttt. Finally got it running! My main problem was that I didn't really grok the distinctions and relations between the mapping of the total loop, the resulting noisemap and the final tiles I wanted. I was trying a lot of wierd things with the mapx/y chunks, partial mapping etc. I think I saw pics of every way this could go wrong [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Anyway, in the end it was quite easy: I just set the submap to the size of the loop and grabbed chunks of that using an offset: for (int i = 0; i<numberOfTilesHeightInt; i++) { for (int j = 0; j<numberOfTilesWidthInt; j++) { for (int localy = (i * tileheight); localy < ((i+1) * tileheight); localy++) { for (int localx = (j * tilewidth); localx < ((j+1) * tilewidth); localx++) { s = (double) localx / (double) m_dxloop; t = (double) localy / (double) m_dyloop; nx = m_loopx0 + Math.cos(s * 2 * Math.PI)*m_dxloop/(2*Math.PI); ny = m_loopy0 + Math.cos(t * 2 * Math.PI)*m_dyloop/(2*Math.PI); nz = m_loopx0 + Math.sin(s * 2 * Math.PI)*m_dxloop/(2*Math.PI); nw = m_loopy0 + Math.sin(t * 2 * Math.PI)*m_dyloop/(2*Math.PI); noise = SimplexNoise4D.noise(nx* scalingfactor, ny * scalingfactor, nz * scalingfactor, nw * scalingfactor); noise = ((noise + 1) / 2); noisedpixelsarray[(localx - (j * tilewidth))+ ((localy - (i*tileheight)) * tilewidth)] = tileColor; } } noiseTileBitmap.setPixels(noisedpixelsarray, 0, tilewidth, 0, 0, tilewidth, tileheight); //draw the colour noisemap in grayscale: tmpTileCanvas.drawBitmap(noiseTileBitmap, null, dstRect, tmpPaint); //and draw on h-index-w-index text: _tmpTileCanvas.drawText("w" + String.valueOf(j) + "-" + String.valueOf(i), tmpTileBitmap.getWidth() * 0.5f, tmpTileBitmap.getHeight() * 0.5f, penPaint); saveTile(tmpTileBitmap, j, i); } } Anyway, thanks for helping me out! Now I'm off to find some good octaves and making some postprocessing routines [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] PS: wtf? CODE tags eat my newlines again?!? It looks OK in preview, but as soon as I post and reload the page, it's all one line? Well, let's see what removing the tags does...
2. ## Why is this terrain using 4d simplex noise not tiling?

Thank you for looking it over. Thank you even more for the reply! I knew I was doing something bad by replacing the static loopxy0 with a variable absxy, but it was the only thing which led to a resulting terrain. Looking at your explanation, am I correct that loopxy0 will always be 0 (if you take the noise from the range 0 to (tilewidth*NoOfTiles)? Then I could define loopx/y/0/1 and dx and dy outside of the whole loop, and then define mapx and mapy per tile, instead of per pixel, but I would have to do the second s and t calculations (which I had commented out)? I'm just trying to get this to work, so for now all I'm trying is to get a tiling from 0 to (tilewidth*NumberOfTiles) ... wouldn't that also mean that in [CODE] p=p*(ranges.mapx1-ranges.mapx0)/(ranges.loopx1-ranges.loopx0); q=q*(ranges.mapy1-ranges.mapy0)/(ranges.loopy1-ranges.loopy0); [/CODE] the loop1-loop0 is always constant, and map1-map0 (call this: dxmap) is also always a tilewidth or a tileheight (because for each tile, mapx0 AND mapx1 shift a tile's width? Hmm, I think I'm starting to get it: and I think I understand now why using absx/y DID give me a terrain where loopxy0 didn't! I'll give it a shot right now! PS: sorry about the code; it looked fine in preview [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img] I added a couple of carriage returns in one code block and now it seems to display ... ok. When I post the page looks ok too, but when I reload the page, everything is back to one-liners!

4. ## [.net] C# CF 3.5 why isn't this loop being entered?

Yup, that was it. Thanks for looking through this; I guess I'm still not an experienced enough coder to catch on to things like that. I'd screwed around with everything in that loop statement, EXCEPT for that :) Now I hope you've taught me another troubleshooting tip. Thanks for the lesson, Mike :)