Closed ngokevin closed 8 years ago
If options
are specific to the pattern, I'll change that to something like:
pattern: {
type: "random",
options: {}
}
We'll need also some kind of way to define this for each enemy type probably, it's not just enough to define enemyNumber: 3
as we could have 3 for type1, 2 for type2, and so on.
yup!
[
{
"name": "wave 1",
"bpm": 220,
"sequence": [
{
"start": 7,
"enemies": ["enemy0", "enemy0", "enemy1"],
"number": 3,
"separation": 0.5,
"pattern": { "type": "random", "options": { } }
},
// sequence 2, etc ...
]
},
// wave 2, etc ...
]
enemies array defines what enemies to instance (they share the same movement pattern, if we want another pattern, we use another sequence).
If number is not defined, enemies.length
is used
If enemies is a string, the same enemy is used number
of times
It'll be difficult to manually choreograph if decoupling the movement patterns from the enemies, or applying the same movement pattern to multiple enemies. I imagine most enemies will have different movements and start points. We can add delays and beats after and start simple.
Will probably learn more as we go on. It might get complex and we start needing helpers. What about to start:
{
// A wave where enemies create an X formation.
xwave: {
enemies: [
{enemyType: normal, position: '-1 -1 0', movementPattern: {type: 'waypoints', closed: true, points: [['-2 -1 0']]}},
{enemyType: normal, position: '0 0 0', movementPattern: {type: 'waypoints', closed: true, points: [['-1 0 0']]}},
{enemyType: normal, position: '1 1 0', movementPattern: {type: 'waypoints', closed: true, points: [['-1 1 0']]}},
// ...
]
}
}
That list of enemies and positions are defined for each enemy on the wave? it would be better to define probably just the type and add the rest of the points randomly? So every run of the game will be different.
Regarding your concerns about the patterns for the enemies this is what I was discussing about implementing boids, that way it could be easy to decouple.
We could have a boid_dummy_enemy = { id: 1234, movementPattern: ..., }
and then we could add N enemies to that "dummy/ghost" leader, so they will create a boid that will follow it. So just the main entity will be animated and the rest will follow him and they'll get rearranged as you go killing them and so on.
We could leave it as stretch goal but it's something I would like to try as I love boids :D maybe for just some wave, who knows..., but I agree that for know just keep with the most simple and easy to get it working as a MVP/POC
OK I see, thanks for the info! Like https://www.youtube.com/watch?v=PVigxemSHrs ... So I'll forget about formations and swarming for now.
I'll try the suggestion above with wave management and incorporating delays.
I think waves could be manually choreographed. We could use a
waves.json
with a structure similar to this:bpm: Each wave would go at an specific BPM (Beats Per Minute, same as the music playing), and time units in the json are in BPM (so
start: 7
is saying "start at beat 7")number: number of enemies separation: beats of separation between enemies pattern: movement pattern to use options: options object specific to that pattern