danbuis / ArmadaAIEngineNew

Revisit of an old project to create an AI for Star Wars Armada
1 stars 0 forks source link

Discussion for interface to tie ships/squads together #72

Open danbuis opened 3 years ago

danbuis commented 3 years ago

Requirements

Attacks are easier to construct if we can say TypeA attacks TypeA, rather than Ship attacks Squadron.

Is it feasible/useful to create an interface to define functions that each type needs to interact with eachother, and then Ships can define implementation in a way that makes sense, and doesn't need to be the same as squadrons.

I'm thinking of things like selecting valid targets, taking damage etc.

Tagging @boredompwndu because you are good at this brainstorming thing.

I've been thinking that Attacks are constructed via something like public Attack (Thingy attacker, Thingy defender)

I want to avoid having 4 similar constructors for all combinations of squad/ship

boredompwndu commented 3 years ago

Keep talking. Does the Attack function live in the ship/squadron functions, or in its own little world separate from all other things?

If you just want a unified "Thingy" I would think about using inheritance. Say that squadron and ships and/or hull zones are "ArmadaFleetObjects" and that the former extend the latter. If you force AFO's to have rules for how they od things, you can overwrite the actual rules in the extended classes, and you should be able to do things like if(AFO.isType(Child)) to do what you want

danbuis commented 3 years ago

Attack isn't a function. Its an object. It is intended/anticipated to be the intermediary between ships/squadrons/attackpool etc for a single attack. That way the scope of an attack can be whatever we want instead of being scoped to a single function call. We can have a global currentAttack variable or whatever.

I don't have a super strong opinion about extends vs implements. Since we have 2 types of objects in question it ends up being pretty wishy washy and probably comes down to how much overlap there actually is in how they do the things they want to do.

I'm fine with doing extends and doing a switch on type or something of that ilk. I'm not wild about it because that smells like bad design, but again, only 2 types of things here, so its not too bad.

danbuis commented 3 years ago

Also big fan of UnifiedFleetObject so that I can talk about UFOs