Differential D4439 Diff 19522 ps/trunk/binaries/data/mods/public/maps/scenarios/unit_pushing_test.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/scenarios/unit_pushing_test.js
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | "spawn": (gx, gy) => { | ||||
for (let i = -6; i <= 6; i += 2) | for (let i = -6; i <= 6; i += 2) | ||||
for (let j = -6; j <= 6; j += 2) | for (let j = -6; j <= 6; j += 2) | ||||
QuickSpawn(gx + i, gy + 50 + j, REG_UNIT_TEMPLATE); | QuickSpawn(gx + i, gy + 50 + j, REG_UNIT_TEMPLATE); | ||||
WalkTo(gx, gy + 100, true, QuickSpawn(gx, gy, REG_UNIT_TEMPLATE)); | WalkTo(gx, gy + 100, true, QuickSpawn(gx, gy, REG_UNIT_TEMPLATE)); | ||||
WalkTo(gx, gy + 100, true, QuickSpawn(gx, gy-10, LARGE_UNIT_TEMPLATE)); | WalkTo(gx, gy + 100, true, QuickSpawn(gx, gy-10, LARGE_UNIT_TEMPLATE)); | ||||
} | } | ||||
}; | }; | ||||
experiments.units_superdense_forest_of_fast_units = { | |||||
"spawn": (gx, gy) => { | |||||
for (let i = -12; i <= 12; i += 2) | |||||
for (let j = -12; j <= 12; j += 2) | |||||
QuickSpawn(gx + i, gy + 50 + j, FAST_UNIT_TEMPLATE); | |||||
WalkTo(gx, gy + 100, true, QuickSpawn(gx, gy, FAST_UNIT_TEMPLATE)); | |||||
WalkTo(gx, gy + 100, true, QuickSpawn(gx, gy-10, LARGE_UNIT_TEMPLATE)); | |||||
} | |||||
}; | |||||
experiments.building = { | experiments.building = { | ||||
"spawn": (gx, gy) => { | "spawn": (gx, gy) => { | ||||
let target = QuickSpawn(gx + 20, gy + 20, "foundation|structures/athen/storehouse"); | let target = QuickSpawn(gx + 20, gy + 20, "foundation|structures/athen/storehouse"); | ||||
for (let i = 0; i < 8; ++i) | for (let i = 0; i < 8; ++i) | ||||
Do("repair", { "target": target }, QuickSpawn(gx + i, gy, REG_UNIT_TEMPLATE)); | Do("repair", { "target": target }, QuickSpawn(gx + i, gy, REG_UNIT_TEMPLATE)); | ||||
let cmpFoundation = Engine.QueryInterface(target, IID_Foundation); | let cmpFoundation = Engine.QueryInterface(target, IID_Foundation); | ||||
cmpFoundation.InitialiseConstruction("structures/athen/storehouse"); | cmpFoundation.InitialiseConstruction("structures/athen/storehouse"); | ||||
Show All 20 Lines | "spawn": (gx, gy) => { | ||||
}, storehouse); | }, storehouse); | ||||
// Make units gather instantly | // Make units gather instantly | ||||
cmpModifiersManager.AddModifiers("gatherrate", { | cmpModifiersManager.AddModifiers("gatherrate", { | ||||
"ResourceGatherer/BaseSpeed": [{ "affects": ["Unit"], "replace": 100 }], | "ResourceGatherer/BaseSpeed": [{ "affects": ["Unit"], "replace": 100 }], | ||||
}, 3); // Player 1 is ent 3 | }, 3); // Player 1 is ent 3 | ||||
} | } | ||||
}; | }; | ||||
experiments.sep1 = { | experiments.multicrossing = { | ||||
"spawn": (gx, gy) => {} | |||||
}; | |||||
experiments.battle = { | |||||
"spawn": (gx, gy) => { | "spawn": (gx, gy) => { | ||||
for (let i = 0; i < 4; ++i) | for (let i = 0; i < 20; i += 2) | ||||
for (let j = 0; j < 8; ++j) | for (let j = 0; j < 20; j += 2) | ||||
{ | WalkTo(gx+10, gy+70, false, QuickSpawn(gx + i, gy + j, REG_UNIT_TEMPLATE)); | ||||
QuickSpawn(gx + i, gy + j, REG_UNIT_TEMPLATE); | for (let i = 0; i < 20; i += 2) | ||||
QuickSpawn(gx + i, gy + 50 + j, REG_UNIT_TEMPLATE, ATTACKER); | for (let j = 0; j < 20; j += 2) | ||||
} | WalkTo(gx+10, gy, false, QuickSpawn(gx + i, gy + j + 70, REG_UNIT_TEMPLATE)); | ||||
} | } | ||||
}; | }; | ||||
experiments.sep2 = { | // Same as above but not as aligned. | ||||
"spawn": (gx, gy) => {} | experiments.multicrossing_spaced = { | ||||
}; | |||||
experiments.overlapping = { | |||||
"spawn": (gx, gy) => { | "spawn": (gx, gy) => { | ||||
for (let i = 0; i < 20; ++i) | for (let i = 0; i < 20; i += 2) | ||||
QuickSpawn(gx, gy, REG_UNIT_TEMPLATE); | for (let j = 0; j < 20; j += 2) | ||||
WalkTo(gx+10, gy+70, false, QuickSpawn(gx + i, gy + j, REG_UNIT_TEMPLATE)); | |||||
for (let i = 0; i < 20; i += 2) | |||||
for (let j = 0; j < 20; j += 2) | |||||
WalkTo(gx+10 + 5, gy, false, QuickSpawn(gx + i + 5, gy + j + 70, REG_UNIT_TEMPLATE)); | |||||
} | } | ||||
}; | }; | ||||
experiments.multicrossing = { | // Same as above but not as aligned. | ||||
experiments.multicrossing_spaced_2 = { | |||||
"spawn": (gx, gy) => { | "spawn": (gx, gy) => { | ||||
for (let i = 0; i < 20; i += 2) | for (let i = 0; i < 20; i += 2) | ||||
for (let j = 0; j < 20; j += 2) | for (let j = 0; j < 20; j += 2) | ||||
WalkTo(gx+10, gy+70, false, QuickSpawn(gx + i, gy + j, REG_UNIT_TEMPLATE)); | WalkTo(gx+10, gy+70, false, QuickSpawn(gx + i, gy + j, REG_UNIT_TEMPLATE)); | ||||
for (let i = 0; i < 20; i += 2) | for (let i = 0; i < 20; i += 2) | ||||
for (let j = 0; j < 20; j += 2) | for (let j = 0; j < 20; j += 2) | ||||
WalkTo(gx+10, gy, false, QuickSpawn(gx + i, gy + j + 70, REG_UNIT_TEMPLATE)); | WalkTo(gx+10 - 5, gy, false, QuickSpawn(gx + i - 5, gy + j + 70, REG_UNIT_TEMPLATE)); | ||||
} | |||||
}; | |||||
experiments.crossing_perpendicular = { | |||||
"spawn": (gx, gy) => { | |||||
for (let i = 0; i < 20; i += 4) | |||||
for (let j = 0; j < 20; j += 4) | |||||
WalkTo(gx+10, gy+70, false, QuickSpawn(gx + i, gy + j, REG_UNIT_TEMPLATE)); | |||||
for (let i = 0; i < 20; i += 4) | |||||
for (let j = 0; j < 20; j += 4) | |||||
WalkTo(gx - 35, gy + 35, false, QuickSpawn(gx + i + 35, gy + j + 35, REG_UNIT_TEMPLATE)); | |||||
} | } | ||||
}; | }; | ||||
experiments.elephant_formation = { | experiments.elephant_formation = { | ||||
"spawn": (gx, gy) => { | "spawn": (gx, gy) => { | ||||
let ents = []; | let ents = []; | ||||
for (let i = 0; i < 20; i += 4) | for (let i = 0; i < 20; i += 4) | ||||
for (let j = 0; j < 20; j += 4) | for (let j = 0; j < 20; j += 4) | ||||
ents.push(QuickSpawn(gx + i, gy + j, ELE_TEMPLATE)); | ents.push(QuickSpawn(gx + i, gy + j, ELE_TEMPLATE)); | ||||
FormationWalkTo(gx, gy+10, false, ents); | FormationWalkTo(gx, gy+10, false, ents); | ||||
} | } | ||||
}; | }; | ||||
experiments.sep1 = { | |||||
"spawn": (gx, gy) => {} | |||||
}; | |||||
experiments.battle = { | |||||
"spawn": (gx, gy) => { | |||||
for (let i = 0; i < 4; ++i) | |||||
for (let j = 0; j < 8; ++j) | |||||
{ | |||||
QuickSpawn(gx + i, gy + j, REG_UNIT_TEMPLATE); | |||||
QuickSpawn(gx + i, gy + 50 + j, REG_UNIT_TEMPLATE, ATTACKER); | |||||
} | |||||
} | |||||
}; | |||||
experiments.sep2 = { | |||||
"spawn": (gx, gy) => {} | |||||
}; | |||||
experiments.overlapping = { | |||||
"spawn": (gx, gy) => { | |||||
for (let i = 0; i < 20; ++i) | |||||
QuickSpawn(gx, gy, REG_UNIT_TEMPLATE); | |||||
for (let i = 0; i < 20; ++i) | |||||
QuickSpawn(gx+15, gy+15, REG_UNIT_TEMPLATE); | |||||
} | |||||
}; | |||||
var perf_experiments = {}; | var perf_experiments = {}; | ||||
// Perf check: put units everywhere, not moving. | // Perf check: put units everywhere, not moving. | ||||
perf_experiments.Idle = { | perf_experiments.Idle = { | ||||
"spawn": () => { | "spawn": () => { | ||||
const spacing = 12; | const spacing = 12; | ||||
for (let x = 0; x < 20*16*4 - 20; x += spacing) | for (let x = 0; x < 20*4*4 - 20; x += spacing) | ||||
for (let z = 0; z < 20*16*4 - 20; z += spacing) | for (let z = 0; z < 20*4*4 - 20; z += spacing) | ||||
QuickSpawn(x, z, REG_UNIT_TEMPLATE); | QuickSpawn(x, z, REG_UNIT_TEMPLATE); | ||||
} | } | ||||
}; | }; | ||||
// Perf check: put units everywhere, moving. | // Perf check: put units everywhere, moving. | ||||
perf_experiments.MovingAround = { | perf_experiments.MovingAround = { | ||||
"spawn": () => { | "spawn": () => { | ||||
const spacing = 24; | const spacing = 24; | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | for (let x = 100; x < 200; x += spacing) | ||||
{ | { | ||||
let ent = QuickSpawn(x, z, REG_UNIT_TEMPLATE); | let ent = QuickSpawn(x, z, REG_UNIT_TEMPLATE); | ||||
for (let ii = 0; ii < 20; ++ii) | for (let ii = 0; ii < 20; ++ii) | ||||
WalkTo(randFloat(100, 200), randFloat(100, 200), true, ent); | WalkTo(randFloat(100, 200), randFloat(100, 200), true, ent); | ||||
} | } | ||||
} | } | ||||
}; | }; | ||||
var woodcutting = (gx, gy) => { | var woodcutting = (gx, gy) => { | ||||
let dropsite = QuickSpawn(gx + 50, gy, "structures/athen/storehouse"); | let dropsite = QuickSpawn(gx + 50, gy, "structures/athen/storehouse"); | ||||
let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); | let cmpModifiersManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_ModifiersManager); | ||||
cmpModifiersManager.AddModifiers("root", { | cmpModifiersManager.AddModifiers("root", { | ||||
"TerritoryInfluence/Root": [{ "affects": ["Structure"], "replace": true }], | "TerritoryInfluence/Root": [{ "affects": ["Structure"], "replace": true }], | ||||
}, dropsite); | }, dropsite); | ||||
// Make units gather faster | // Make units gather faster | ||||
cmpModifiersManager.AddModifiers("gatherrate", { | cmpModifiersManager.AddModifiers("gatherrate", { | ||||
Show All 24 Lines | Trigger.prototype.Setup = function() | ||||
let start = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer).GetTime(); | let start = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer).GetTime(); | ||||
// /* | // /* | ||||
let gx = 100; | let gx = 100; | ||||
let gy = 100; | let gy = 100; | ||||
for (let key in experiments) | for (let key in experiments) | ||||
{ | { | ||||
experiments[key].spawn(gx, gy); | experiments[key].spawn(gx, gy); | ||||
gx += 60; | gx += 90; | ||||
if (gx > 20*16*4-20) | if (gx > 20*16*4-20) | ||||
{ | { | ||||
gx = 20; | gx = 100; | ||||
gy += 100; | gy += 150; | ||||
} | } | ||||
} | } | ||||
/**/ | /**/ | ||||
//perf_experiments.LotsaLocalCollisions.spawn(); | |||||
/* | /* | ||||
let time = 0; | let time = 0; | ||||
for (let key in perf_experiments) | for (let key in perf_experiments) | ||||
{ | { | ||||
cmpTrigger.DoAfterDelay(1000 + time * 10000, "RunExperiment", { "exp": key }); | cmpTrigger.DoAfterDelay(1000 + time * 10000, "RunExperiment", { "exp": key }); | ||||
time++; | time++; | ||||
} | } | ||||
/**/ | /**/ | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator