0 Members and 1 Guest are viewing this topic.
I'm more concerned about how it generates areas and pieces them together (so you don't have scattered desert in the middle of a forest, etc.)
/* * for (int i = 0; i < w * h / 2800; i++) { int xs = random.nextInt(w); int ys = random.nextInt(h); for (int k = 0; k < 10; k++) { int x = xs + random.nextInt(21) - 10; int y = ys + random.nextInt(21) - 10; for (int j = 0; j < 100; j++) { int xo = x + random.nextInt(5) - random.nextInt(5); int yo = y + random.nextInt(5) - random.nextInt(5); for (int yy = yo - 1; yy <= yo + 1; yy++) for (int xx = xo - 1; xx <= xo + 1; xx++) if (xx >= 0 && yy >= 0 && xx < w && yy < h) { if (map[xx + yy * w] == Tile.grass.id) { map[xx + yy * w] = Tile.dirt.id; } } } } } */
// byte[] map = LevelGen.createAndValidateUndergroundMap(w, h, (d++ % 3) + 1)[0];// byte[] map = LevelGen.createAndValidateSkyMap(w, h)[0];
Quote from: leafiness0 on January 06, 2012, 01:59:47 pmActually, you could transfer the map in RAM to an appvar in archive, so changes would be persistent. Keep in mind that we also need to save object data as well (furnaces, workbench, etc.)Yes but first archiving a huge map is slow but also, when you want to make a new game, you can only play on the edited map (except if the game recreates it but then the executable will be huge). This is why I thought of an archived and non permanently editable map
Actually, you could transfer the map in RAM to an appvar in archive, so changes would be persistent. Keep in mind that we also need to save object data as well (furnaces, workbench, etc.)