mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-08 03:44:25 +00:00
Added new cantabrian_generated.
This was SVN commit r3178.
This commit is contained in:
@@ -4,26 +4,32 @@ const SIZE = 208;
|
||||
const NUM_PLAYERS = 4;
|
||||
|
||||
|
||||
const tGrass = "grass1_a";
|
||||
const tCliff = "cliff_mountain";
|
||||
const tForest = "grass_forest_floor_oak|wrld_flora_oak";
|
||||
const tGrassDirt75 = "grass dirt 75";
|
||||
const tGrassDirt50 = "grass dirt 50";
|
||||
const tGrassDirt25 = "grass dirt 25";
|
||||
const tDirt = "dirt_brown_b";
|
||||
const tShore = "sand";
|
||||
const tShoreBlend = "grass_sand_50";
|
||||
const tWater = "water_2";
|
||||
const tWaterDeep = "water_3";
|
||||
const tGrass = ["grass1_a", "grass_highlands_a", "grass1_a"];
|
||||
const tGrassForest = "grass_forest_floor_oak";
|
||||
const tCliff = ["cliff_greekb", "cliff_greekb", "cliff_greekb_moss"];
|
||||
const tForest = "forrestfloor|wrld_flora_oak";
|
||||
const tGrassDirt75 = "sand_grass_75";
|
||||
const tGrassDirt50 = "sand_grass_50";
|
||||
const tGrassDirt25 = "sand_grass_25";
|
||||
const tDirt = "sand_path";
|
||||
const tGrassPatch = "grass1_dense";
|
||||
const tShore = "sand_path";
|
||||
const tShoreBlend = "sand_grass_50";
|
||||
const tWater = "sand_path";
|
||||
|
||||
const oTree = "wrld_flora_oak";
|
||||
const oTreeLarge = "flora/trees/oak_large.xml";
|
||||
const oBerryBush = "wrld_flora_berrybush";
|
||||
const oSheep = "wrld_fauna_sheep";
|
||||
const oDeer = "wrld_fauna_deer";
|
||||
const oMine = "wrld_rock_light";
|
||||
const oGrass = "props/flora/grass_tufts_a.xml";
|
||||
const oReeds = "props/flora/reeds_a.xml";
|
||||
const oDecorativeRock = "geology/gray1.xml";
|
||||
const oGrass = "props/flora/grass_field_lush_tall.xml";
|
||||
const oGrassShort = "props/flora/grass_field_lush_short.xml";
|
||||
const oReeds = "props/flora/reeds_pond_dry.xml";
|
||||
const oRockLarge = "geology/stone_granite_large.xml";
|
||||
const oRockMedium = "geology/stone_granite_med.xml";
|
||||
const oBushMedium = "props/flora/bush_tempe_me.xml";
|
||||
const oBushSmall = "props/flora/bush_tempe_sm.xml";
|
||||
|
||||
// some utility functions to save typing
|
||||
|
||||
@@ -42,7 +48,7 @@ function avoidClasses(/*class1, dist1, class2, dist2, etc*/) {
|
||||
// initialize map
|
||||
|
||||
println("Initializing map...");
|
||||
init(SIZE, tGrass, 10);
|
||||
init(SIZE, tGrass, 7);
|
||||
|
||||
// create tile classes
|
||||
|
||||
@@ -57,24 +63,24 @@ clBaseResource = createTileClass();
|
||||
|
||||
// place players
|
||||
|
||||
playerX = new Array(NUM_PLAYERS);
|
||||
playerY = new Array(NUM_PLAYERS);
|
||||
playerAngle = new Array(NUM_PLAYERS);
|
||||
playerX = new Array(NUM_PLAYERS+1);
|
||||
playerY = new Array(NUM_PLAYERS+1);
|
||||
playerAngle = new Array(NUM_PLAYERS+1);
|
||||
|
||||
startAngle = randFloat() * 2 * PI;
|
||||
for(i=0; i<NUM_PLAYERS; i++) {
|
||||
for(i=1; i<=NUM_PLAYERS; i++) {
|
||||
playerAngle[i] = startAngle + i*2*PI/NUM_PLAYERS;
|
||||
playerX[i] = 0.5 + 0.35*cos(playerAngle[i]);
|
||||
playerY[i] = 0.5 + 0.35*sin(playerAngle[i]);
|
||||
}
|
||||
|
||||
for(i=0; i<NUM_PLAYERS; i++) {
|
||||
for(i=1; i<=NUM_PLAYERS; i++) {
|
||||
println("Creating base for player " + i + "...");
|
||||
|
||||
// some constants
|
||||
radius = 17;
|
||||
cliffRadius = 2;
|
||||
elevation = 30;
|
||||
elevation = 20;
|
||||
|
||||
// get the x and y in tiles
|
||||
fx = fractionToTiles(playerX[i]);
|
||||
@@ -86,9 +92,9 @@ for(i=0; i<NUM_PLAYERS; i++) {
|
||||
size = PI * radius * radius;
|
||||
|
||||
// create the hill
|
||||
placer = new ClumpPlacer(size, 0.9, 0.5, 0, ix, iy);
|
||||
placer = new ClumpPlacer(size, 0.95, 0.6, 0, ix, iy);
|
||||
terrainPainter = new LayeredPainter(
|
||||
[cliffRadius+1], // widths
|
||||
[cliffRadius], // widths
|
||||
[tCliff, tGrass] // terrains
|
||||
);
|
||||
elevationPainter = new SmoothElevationPainter(
|
||||
@@ -103,23 +109,26 @@ for(i=0; i<NUM_PLAYERS; i++) {
|
||||
rampDist = radius - 1;
|
||||
rampX = round(fx + rampDist * cos(rampAngle));
|
||||
rampY = round(fy + rampDist * sin(rampAngle));
|
||||
placer = new ClumpPlacer(80, 0.9, 0.5, 0, rampX, rampY);
|
||||
painter = [new TerrainPainter(tGrass), new SmoothElevationPainter(ELEVATION_SET, (elevation-10)/3+10, 5)];
|
||||
placer = new ClumpPlacer(100, 0.9, 0.5, 0, rampX, rampY);
|
||||
painter = new SmoothElevationPainter(ELEVATION_SET, elevation-6, 5);
|
||||
createArea(placer, painter, null);
|
||||
placer = new ClumpPlacer(75, 0.9, 0.5, 0, rampX, rampY);
|
||||
painter = new TerrainPainter(tGrass);
|
||||
createArea(placer, painter, null);
|
||||
|
||||
// create the central dirt patch
|
||||
placer = new ClumpPlacer(PI*4*4, 0.3, 0.1, 0, ix, iy);
|
||||
placer = new ClumpPlacer(PI*3.5*3.5, 0.3, 0.1, 0, ix, iy);
|
||||
painter = new LayeredPainter(
|
||||
[1,1,1], // widths
|
||||
[tGrassDirt75, tGrassDirt50, tGrassDirt25, tDirt] // terrains
|
||||
);
|
||||
createArea(placer, painter, null);
|
||||
|
||||
// create the TC and the villies
|
||||
// create the TC and the "villies"
|
||||
group = new SimpleGroup(
|
||||
[ // elements (type, count, distance)
|
||||
new SimpleObject("hele_cc", 1,1, 0,0),
|
||||
new SimpleObject("hele_isp_b", 3,3, 5,5)
|
||||
new SimpleObject("hele_ijv_b", 3,3, 5,5)
|
||||
],
|
||||
true, null, ix, iy
|
||||
);
|
||||
@@ -132,7 +141,7 @@ for(i=0; i<NUM_PLAYERS; i++) {
|
||||
bbY = round(fy + bbDist * sin(bbAngle));
|
||||
group = new SimpleGroup(
|
||||
[new SimpleObject(oBerryBush, 5,5, 0,2)],
|
||||
true, clBaseResource, bbX, bbY
|
||||
true, clBaseResource, bbX, bbY
|
||||
);
|
||||
createObjectGroup(group, 0);
|
||||
|
||||
@@ -145,49 +154,60 @@ for(i=0; i<NUM_PLAYERS; i++) {
|
||||
mX = round(fx + mDist * cos(mAngle));
|
||||
mY = round(fy + mDist * sin(mAngle));
|
||||
group = new SimpleGroup(
|
||||
[new SimpleObject(oMine, 3,3, 0,2)],
|
||||
true, clBaseResource, mX, mY
|
||||
[new SimpleObject(oMine, 4,4, 0,2)],
|
||||
true, clBaseResource, mX, mY
|
||||
);
|
||||
createObjectGroup(group, 0);
|
||||
|
||||
// create starting straggler trees
|
||||
group = new SimpleGroup(
|
||||
[new SimpleObject(oTree, 3,3, 6,12)],
|
||||
true, null, ix, iy
|
||||
[new SimpleObject(oTree, 3,3, 8,12)],
|
||||
true, clBaseResource, ix, iy
|
||||
);
|
||||
createObjectGroup(group, 0, avoidClasses(clBaseResource,1));
|
||||
createObjectGroup(group, 0, avoidClasses(clBaseResource,2));
|
||||
|
||||
// create grass tufts
|
||||
for(j=0; j<10; j++) {
|
||||
gAngle = randFloat()*2*PI;
|
||||
gDist = 6 + randInt(9);
|
||||
gX = round(fx + gDist * cos(gAngle));
|
||||
gY = round(fy + gDist * sin(gAngle));
|
||||
group = new SimpleGroup([new SimpleObject(oGrassShort, 3,6, 0,1, -PI/8,PI/8)],
|
||||
false, clBaseResource, gX, gY);
|
||||
createObjectGroup(group, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// create lakes
|
||||
println("Creating lakes...");
|
||||
placer = new ClumpPlacer(170, 0.6, 0.1, 0);
|
||||
placer = new ClumpPlacer(140, 0.8, 0.1, 0);
|
||||
terrainPainter = new LayeredPainter(
|
||||
[1,1], // widths
|
||||
[tShoreBlend, tShore, tWaterDeep] // terrains
|
||||
[tShoreBlend, tShore, tWater] // terrains
|
||||
);
|
||||
elevationPainter = new SmoothElevationPainter(ELEVATION_SET, 5, 2);
|
||||
elevationPainter = new SmoothElevationPainter(ELEVATION_SET, -3, 3);
|
||||
createAreas(placer, [terrainPainter, elevationPainter, paintClass(clWater)],
|
||||
avoidClasses(clPlayer, 2, clWater, 13),
|
||||
round(1.5 * NUM_PLAYERS)
|
||||
avoidClasses(clPlayer, 2, clWater, 20),
|
||||
round(1.3 * NUM_PLAYERS)
|
||||
);
|
||||
|
||||
// create bumps
|
||||
println("Creating bumps...");
|
||||
placer = new ClumpPlacer(10, 0.3, 0.06, 0);
|
||||
painter = new SmoothElevationPainter(ELEVATION_MODIFY, 3, 2);
|
||||
painter = new SmoothElevationPainter(ELEVATION_MODIFY, 2, 2);
|
||||
createAreas(placer, painter,
|
||||
avoidClasses(clWater, 2),
|
||||
SIZE*SIZE/150
|
||||
avoidClasses(clWater, 2, clPlayer, 0),
|
||||
SIZE*SIZE/100
|
||||
);
|
||||
|
||||
// create hills
|
||||
println("Creating hills...");
|
||||
placer = new ClumpPlacer(30, 0.2, 0.1, 0);
|
||||
terrainPainter = new LayeredPainter(
|
||||
[2], // widths
|
||||
[tCliff, tGrass] // terrains
|
||||
[3], // widths
|
||||
[tCliff, [tGrass,tGrass,tGrassDirt75]] // terrains
|
||||
);
|
||||
elevationPainter = new SmoothElevationPainter(ELEVATION_SET, 25, 2);
|
||||
elevationPainter = new SmoothElevationPainter(ELEVATION_SET, 17, 2);
|
||||
createAreas(placer, [terrainPainter, elevationPainter, paintClass(clHill)],
|
||||
avoidClasses(clPlayer, 2, clWater, 5, clHill, 15),
|
||||
2 * NUM_PLAYERS
|
||||
@@ -195,22 +215,37 @@ createAreas(placer, [terrainPainter, elevationPainter, paintClass(clHill)],
|
||||
|
||||
// create forests
|
||||
println("Creating forests...");
|
||||
placer = new ClumpPlacer(25, 0.2, 0.05, 0);
|
||||
painter = new LayeredPainter([2], [[tGrass, tForest], tForest]);
|
||||
placer = new ClumpPlacer(32, 0.1, 0.1, 0);
|
||||
painter = new LayeredPainter([2], [[tGrassForest, tGrass, tForest],
|
||||
[tGrassForest, tForest]]);
|
||||
createAreas(placer, [painter, paintClass(clForest)],
|
||||
avoidClasses(clPlayer, 1, clWater, 3, clForest, 10, clHill, 0),
|
||||
7 * NUM_PLAYERS
|
||||
6 * NUM_PLAYERS
|
||||
);
|
||||
|
||||
// create dirt patches
|
||||
println("Creating dirt patches...");
|
||||
var sizes = [20,40,60];
|
||||
var sizes = [8,14,20];
|
||||
for(i=0; i<sizes.length; i++) {
|
||||
placer = new ClumpPlacer(sizes[i], 0.3, 0.06, 0);
|
||||
painter = new LayeredPainter([1,1], [tGrassDirt75,tGrassDirt50,tGrassDirt25]);
|
||||
painter = new LayeredPainter([1,1], [
|
||||
[tGrass,tGrassDirt75],[tGrassDirt75,tGrassDirt50],
|
||||
[tGrassDirt50,tGrassDirt25]]);
|
||||
createAreas(placer, [painter, paintClass(clDirt)],
|
||||
avoidClasses(clWater, 1, clForest, 0, clHill, 0, clDirt, 5, clPlayer, 0),
|
||||
SIZE*SIZE/6000
|
||||
SIZE*SIZE/4000
|
||||
);
|
||||
}
|
||||
|
||||
// create grass patches
|
||||
println("Creating grass patches...");
|
||||
var sizes = [5,9,13];
|
||||
for(i=0; i<sizes.length; i++) {
|
||||
placer = new ClumpPlacer(sizes[i], 0.3, 0.06, 0);
|
||||
painter = new TerrainPainter(tGrassPatch);
|
||||
createAreas(placer, painter,
|
||||
avoidClasses(clWater, 1, clForest, 0, clHill, 0, clDirt, 5, clPlayer, 0),
|
||||
SIZE*SIZE/4000
|
||||
);
|
||||
}
|
||||
|
||||
@@ -223,27 +258,36 @@ createObjectGroups(group, 0,
|
||||
3 * NUM_PLAYERS, 100
|
||||
);
|
||||
|
||||
// create decorative rocks for hills
|
||||
println("Creating decorative rocks...");
|
||||
group = new SimpleGroup([new SimpleObject(oDecorativeRock, 1,1, 0,0)], true);
|
||||
// create small decorative rocks
|
||||
println("Creating large decorative rocks...");
|
||||
group = new SimpleGroup([new SimpleObject(oRockMedium, 1,3, 0,1)], true);
|
||||
createObjectGroups(group, 0,
|
||||
new BorderTileClassConstraint(clHill, 0, 2),
|
||||
5 * NUM_PLAYERS, 100
|
||||
avoidClasses(clForest, 0, clPlayer, 0, clHill, 0),
|
||||
SIZE*SIZE/1000, 50
|
||||
);
|
||||
|
||||
// create large decorative rocks
|
||||
println("Creating large decorative rocks...");
|
||||
group = new SimpleGroup([new SimpleObject(oRockLarge, 1,2, 0,1),
|
||||
new SimpleObject(oRockMedium, 1,3, 0,2)], true);
|
||||
createObjectGroups(group, 0,
|
||||
avoidClasses(clForest, 0, clPlayer, 0, clHill, 0),
|
||||
SIZE*SIZE/2000, 50
|
||||
);
|
||||
|
||||
// create deer
|
||||
println("Creating deer...");
|
||||
group = new SimpleGroup([new SimpleObject(oDeer, 5,7, 0,4)], true, clFood);
|
||||
createObjectGroups(group, 0,
|
||||
avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0, clFood, 15),
|
||||
2 * NUM_PLAYERS, 50
|
||||
avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0, clFood, 20),
|
||||
3 * NUM_PLAYERS, 50
|
||||
);
|
||||
|
||||
// create sheep
|
||||
println("Creating sheep...");
|
||||
group = new SimpleGroup([new SimpleObject(oSheep, 2,3, 0,2)], true, clFood);
|
||||
createObjectGroups(group, 0,
|
||||
avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0, clFood, 15),
|
||||
avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clHill, 0, clFood, 20),
|
||||
3 * NUM_PLAYERS, 50
|
||||
);
|
||||
|
||||
@@ -251,22 +295,40 @@ createObjectGroups(group, 0,
|
||||
println("Creating straggler trees...");
|
||||
group = new SimpleGroup([new SimpleObject(oTree, 1,1, 0,0)], true);
|
||||
createObjectGroups(group, 0,
|
||||
avoidClasses(clWater, 1, clForest, 0, clHill, 0, clPlayer, 0),
|
||||
SIZE*SIZE/700
|
||||
avoidClasses(clWater, 1, clForest, 1, clHill, 1, clPlayer, 1),
|
||||
SIZE*SIZE/1100
|
||||
);
|
||||
|
||||
// create grass tufts
|
||||
println("Creating grass tufts...");
|
||||
group = new SimpleGroup([new SimpleObject(oGrass, 6,10, 0,2)]);
|
||||
// create small grass tufts
|
||||
println("Creating small grass tufts...");
|
||||
group = new SimpleGroup([new SimpleObject(oGrassShort, 3,6, 0,1, -PI/8,PI/8)]);
|
||||
createObjectGroups(group, 0,
|
||||
avoidClasses(clWater, 3, clForest, 0, clHill, 0, clPlayer, 0, clDirt, 0),
|
||||
SIZE*SIZE/800
|
||||
avoidClasses(clWater, 2, clHill, 2, clPlayer, 2, clDirt, 0),
|
||||
SIZE*SIZE/90
|
||||
);
|
||||
|
||||
// create large grass tufts
|
||||
println("Creating large grass tufts...");
|
||||
group = new SimpleGroup([new SimpleObject(oGrass, 20,30, 0,1.8, -PI/8,PI/8),
|
||||
new SimpleObject(oGrassShort, 20,30, 1.2,2.5, -PI/8,PI/8)]);
|
||||
createObjectGroups(group, 0,
|
||||
avoidClasses(clWater, 3, clHill, 2, clPlayer, 2, clDirt, 1, clForest, 0),
|
||||
SIZE*SIZE/900
|
||||
);
|
||||
|
||||
// create bushes
|
||||
println("Creating bushes...");
|
||||
group = new SimpleGroup([new SimpleObject(oBushSmall, 2,4, 0,2)]);
|
||||
createObjectGroups(group, 0,
|
||||
avoidClasses(clWater, 1, clHill, 1, clPlayer, 1, clDirt, 1),
|
||||
SIZE*SIZE/2000, 50
|
||||
);
|
||||
|
||||
// create reeds
|
||||
println("Creating reeds...");
|
||||
group = new SimpleGroup([new SimpleObject(oReeds, 2,3, 0,2)]);
|
||||
group = new SimpleGroup([new SimpleObject(oReeds, 5,10, 0,1.5, -PI/8,PI/8)]);
|
||||
createObjectGroups(group, 0,
|
||||
new BorderTileClassConstraint(clWater, 1, 2),
|
||||
5 * NUM_PLAYERS, 50
|
||||
);
|
||||
[new BorderTileClassConstraint(clWater, 3, 0), new StayInTileClassConstraint(clWater, 1)],
|
||||
10 * NUM_PLAYERS, 100
|
||||
);
|
||||
|
||||
|
||||
@@ -231,12 +231,15 @@ function BorderTileClassConstraint(tileClass, distanceInside, distanceOutside) {
|
||||
|
||||
// Object groups
|
||||
|
||||
function SimpleObject(type, minCount, maxCount, minDistance, maxDistance) {
|
||||
function SimpleObject(type, minCount, maxCount, minDistance, maxDistance,
|
||||
minAngle, maxAngle) {
|
||||
this.type = type;
|
||||
this.minCount = minCount;
|
||||
this.maxCount = maxCount;
|
||||
this.minDistance = minDistance;
|
||||
this.maxDistance = maxDistance;
|
||||
this.minAngle = minAngle!=undefined ? minAngle : 0;
|
||||
this.maxAngle = maxAngle!=undefined ? maxAngle : 2*PI;
|
||||
}
|
||||
|
||||
function SimpleGroup(elements, avoidSelf, tileClass, x, y) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user