1
0
forked from 0ad/0ad

This was SVN commit r2713.

This commit is contained in:
Matei 2005-09-13 22:58:54 +00:00
parent fd3437d181
commit 2766242181
4 changed files with 127 additions and 46 deletions

View File

@ -4,19 +4,26 @@ const SIZE = 208;
const NUM_PLAYERS = 4;
const tGrass = ["grass1_a", "grass2"];
const tCliff = ["cliff2", "cliff2_moss"];
const tForest = "grass_forest_floor_oak|flora/wrld_flora_oak.xml";
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_a";
const tShore = "dirt_brown_rocks";
const tDirt = "dirt_brown_b";
const tShore = "sand";
const tShoreBlend = "grass_sand_50";
const tWater = "water_2";
const tWaterDeep = "water_3";
const oTree = "wrld_flora_oak";
const oBerryBush = "wrld_flora_berrybush";
const oSheep = "wrld_fauna_sheep";
const oDeer = "wrld_fauna_deer";
const oMine = "wrld_rock_light";
const oGrass = "foliage/grass_tufts_a.xml";
const oTree = "flora/wrld_flora_oak.xml";
const oReeds = "foliage/reeds_a.xml";
const oDecorativeRock = "geology/rock_gray1.xml";
// some utility functions to save typing
@ -44,6 +51,9 @@ clHill = createTileClass();
clForest = createTileClass();
clWater = createTileClass();
clDirt = createTileClass();
clRock = createTileClass();
clFood = createTileClass();
clBaseResource = createTileClass();
// place players
@ -108,16 +118,44 @@ for(i=0; i<NUM_PLAYERS; i++) {
// create the TC and the villies
group = new SimpleGroup(
[ // elements (type, count, distance)
new SimpleObject("hele_cc", 1, 0),
new SimpleObject("hele_isp_b", 3, 5)
new SimpleObject("hele_cc", 1,1, 0,0),
new SimpleObject("hele_isp_b", 3,3, 5,5)
],
true, // avoid self
null, // tile class
ix, iy // position
true, null, ix, iy
);
createObjectGroup(group, i);
// maybe do other stuff, like sheep and villies?
// create berry bushes
bbAngle = randFloat()*2*PI;
bbDist = 9;
bbX = round(fx + bbDist * cos(bbAngle));
bbY = round(fy + bbDist * sin(bbAngle));
group = new SimpleGroup(
[new SimpleObject(oBerryBush, 5,5, 0,2)],
true, clBaseResource, bbX, bbY
);
createObjectGroup(group, 0);
// create mines
mAngle = bbAngle;
while(abs(mAngle - bbAngle) < PI/3) {
mAngle = randFloat()*2*PI;
}
mDist = 9;
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
);
createObjectGroup(group, 0);
// create starting straggler trees
group = new SimpleGroup(
[new SimpleObject(oTree, 3,3, 6,12)],
true, null, ix, iy
);
createObjectGroup(group, 0, avoidClasses(clBaseResource,1));
}
// create lakes
@ -125,7 +163,7 @@ println("Creating lakes...");
placer = new ClumpPlacer(170, 0.6, 0.1, 0);
terrainPainter = new LayeredPainter(
[1,1], // widths
[tGrassDirt50, tShore, tWaterDeep] // terrains
[tShoreBlend, tShore, tWaterDeep] // terrains
);
elevationPainter = new SmoothElevationPainter(ELEVATION_SET, 5, 2);
createAreas(placer, [terrainPainter, elevationPainter, paintClass(clWater)],
@ -139,7 +177,20 @@ placer = new ClumpPlacer(10, 0.3, 0.06, 0);
painter = new SmoothElevationPainter(ELEVATION_MODIFY, 3, 2);
createAreas(placer, painter,
avoidClasses(clWater, 2),
SIZE*SIZE/200
SIZE*SIZE/150
);
// create hills
println("Creating hills...");
placer = new ClumpPlacer(30, 0.2, 0.1, 0);
terrainPainter = new LayeredPainter(
[2], // widths
[tCliff, tGrass] // terrains
);
elevationPainter = new SmoothElevationPainter(ELEVATION_SET, 25, 2);
createAreas(placer, [terrainPainter, elevationPainter, paintClass(clHill)],
avoidClasses(clPlayer, 2, clWater, 5, clHill, 15),
2 * NUM_PLAYERS
);
// create forests
@ -147,26 +198,13 @@ println("Creating forests...");
placer = new ClumpPlacer(30, 0.2, 0.06, 0);
painter = new LayeredPainter([2], [[tGrass, tForest], tForest]);
createAreas(placer, [painter, paintClass(clForest)],
avoidClasses(clPlayer, 2, clWater, 5, clForest, 5),
8 * NUM_PLAYERS
);
// create forests
println("Creating hills...");
placer = new ClumpPlacer(60, 0.2, 0.1, 0);
terrainPainter = new LayeredPainter(
[3], // widths
[tCliff, tGrass] // terrains
);
elevationPainter = new SmoothElevationPainter(ELEVATION_SET, 32, 2);
createAreas(placer, [terrainPainter, elevationPainter, paintClass(clHill)],
avoidClasses(clPlayer, 2, clWater, 5, clForest, 5),
3 * NUM_PLAYERS
avoidClasses(clPlayer, 1, clWater, 3, clForest, 10, clHill, 0),
7 * NUM_PLAYERS
);
// create dirt patches
println("Creating dirt patches...");
var sizes = [25,45,70];
var sizes = [20,40,60];
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]);
@ -176,22 +214,59 @@ for(i=0; i<sizes.length; i++) {
);
}
// create mines
println("Creating mines...");
group = new SimpleGroup([new SimpleObject(oMine, 4,6, 0,2)], true, clRock);
createObjectGroups(group, 0,
[avoidClasses(clWater, 0, clForest, 0, clPlayer, 0, clRock, 13),
new BorderTileClassConstraint(clHill, 0, 4)],
3 * NUM_PLAYERS, 100
);
// create decorative rocks
println("Creating decorative rocks...");
group = new SimpleGroup([new SimpleObject(oDecorativeRock, 1,1, 0,0)], true);
createObjectGroups(group, 0,
new BorderTileClassConstraint(clHill, 0, 2),
5 * NUM_PLAYERS, 100
);
// 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
);
// 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),
3 * NUM_PLAYERS, 50
);
// create straggler trees
println("Creating straggler trees...");
group = new SimpleGroup([new SimpleObject(oTree, 1, 0)]);
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/7000
SIZE*SIZE/800
);
// create grass tufts
println("Creating grass tufts...");
group = new SimpleGroup([
new SimpleObject(oGrass, 2, 0.4),
new SimpleObject(oGrass, 2, 1.1),
new SimpleObject(oGrass, 3, 2.0)
]);
group = new SimpleGroup([new SimpleObject(oGrass, 6,10, 0,2)]);
createObjectGroups(group, 0,
avoidClasses(clWater, 1, clForest, 0, clHill, 0, clPlayer, 0),
SIZE*SIZE/2500
avoidClasses(clWater, 3, clForest, 0, clHill, 0, clPlayer, 0, clDirt, 0),
SIZE*SIZE/800
);
// create reeds
println("Creating reeds...");
group = new SimpleGroup([new SimpleObject(oReeds, 2,3, 0,2)]);
createObjectGroups(group, 0,
new BorderTileClassConstraint(clWater, 1, 2),
5 * NUM_PLAYERS, 50
);

View File

@ -63,6 +63,10 @@ function tan(x) {
return Math.sin(x);
}
function abs(x) {
return Math.abs(x);
}
function round(x) {
return Math.round(x);
}
@ -227,10 +231,12 @@ function BorderTileClassConstraint(tileClass, distanceInside, distanceOutside) {
// Object groups
function SimpleObject(type, count, distance) {
function SimpleObject(type, minCount, maxCount, minDistance, maxDistance) {
this.type = type;
this.count = count;
this.distance = distance;
this.minCount = minCount;
this.maxCount = maxCount;
this.minDistance = minDistance;
this.maxDistance = maxDistance;
}
function SimpleGroup(elements, avoidSelf, tileClass, x, y) {

Binary file not shown.

Binary file not shown.