@galactical Thank you so much for your feedback! I appreciate it lots
> Cool game! I had a hard time strategizing about what exactly I could do to counter my opponents setup, it seemed, to me at least, like the outcomes of battles were fuzzy, and it was hard to see where my setup is wrong. I just sent my soldiers out to battle and hoped for the best, which is still a very fun feeling!
Sorry to hear! I'm not surprised. I've heard it from other people, and I can see how depending on how the rounds go for you, it may have been difficult to spot the advantages and disadvantages that a unit has against another. I was thinking that a campaign mode with "pre-designed puzzles" could help alleviate this, and also provide more content where there is a surmountable amount of challenge. Happy to hear ideas!
(Spoiler about the rock-paper-scissor nature of the units)
By design, the following _should_ be true: - Warriors beat Archers - Archers beat Healers - Healers "beat" Warriors
(Spoiler about the values under the hood driving the units)
- Warriors have 10HP and do 1dmg every 1s. - Archers have 5HP and do 2dmg every 2s. And they take double-damage from Warriors. - Healers have 5HP and heal 1hp every 1s.
(Spoiler about how the rock-paper-scissors takes place in practice)
Warriors take down archers in 3 hits. Archers take warriors down in 5 hits. However, archers can attack at a distance, so they are able to hit the warrior once before the warrior gets to them. Additionally, if there's any ally unit between the archer and the warrior, the warrior will go for that unit... so while warriors beat archers, that is if they can get to the archers.
Healers "beat" warriors in the sense that they can heal as much hp as warriors can damage. Additionally, if you have 2 columns of units, warriors on the column behind the fight can't really contribute to the fight (except pushing). Healers on the 2nd column, behind the fight, _are_ able to heal units in the front line. So it's very difficult or impossible for 2 columns of warriors to beat 2 columns of healers. Also, any damage the warriors take from archers (behind the healers) will not be able to be healed, unless they have healers too.
Archers "beat" healers in the sense that 2 archers beat 3 healers. 2 archers will deal 4 damage to a healer (hopefully they focus on the same one), and then healers have to react and come to heal the unit. However, due to reaction times, they will only be able to heal the unit once before archers are able to strike it again for 4 damage. Meaning that the healer or archer will be gone. It's a different story if the archer is attacking a warrior given they have 10hp, so the reaction time by the healer does not affect much.
> I’d be curious to know how exactly you are handling the collisions between the large number of units. It worked well for the most part, but I often noticed that some enemy units would clip into each other, perfectly overlapping. I imagine this is due to some necessary shortcuts taken for performance, and it wasn’t anything game breaking. Nice work!
Every unit has the following code:
// collisions const closestUnit = getClosestEntity(this, { type: Unit }) if (closestUnit) { const distance = pointToPointDistance(this, closestUnit) if (distance < 19) { const dx = distance/10 * (this.x - closestUnit.x) / distance const dy = distance/10 * (this.y - closestUnit.y) / distance this.x += dx this.y += dy closestUnit.x -= dx closestUnit.y -= dy } }
So it slightly pushes the closest unit (that is <19 distance) away from itself, and it pushes itself a bit away from that unit.
I suspect that by only considering the closest unit for collision, it doesn't work well when too many units are pushing against each other.
So it's not really for performance, rather that's the way I wrote it, and didn't have time / was not a priority to make it better :)
Thank you again for your feedback! <