gdquest-demos / godot-2d-space-game

A 2D space exploration and mining game made with Godot and our AI framework
MIT License
837 stars 108 forks source link

Pirate squad system refactor #17

Open Razoric480 opened 4 years ago

Razoric480 commented 4 years ago

Currently, the way the pirates coordinate between one another is a little awkward. You have a squad leader, and different behaviors are used in the same state machine state depending on whether a pirate is a squad leader or not.

When a leader dies, this leads to situations where the state has to be 'reset' so that new behaviors are recreated, and the correct signals connected to.

Alternative ideas

The former would be simple in implementation, while the second one could help with extension down the line or more complex behaviors if the game expands that far.

Since, ultimately, it'd be nice to have pirates that do different jobs - attackers, miners and workers, transports that go to their own station, etc - the latter will probably be more useful in the long run.

Pomb commented 4 years ago

@Razoric480 This sounds like the same system that could be used for #27 Drones, where drones are squaddies - with a different set of behaviours and where the player is set as the Leader. I imagine you could have a property on a ship/drone that allows it to be a leader, so that when a leader dies, the squad can get notified and a new leader can be chosen from those who are able. This could be quite interesting, because it means if you killed a leader and there's no ship in the squad that is capable the ships can disperse and become angry lone wolves, lost in the belt, much easier to fight one ship at a time, would give fighting an tactic of trying to kill the leader first.