Hey Guys,
Look through Richard's code while on the plane. I didn't get a chance to pull in Jose's change before boarding but it's top of my list when I get somewhere stable (it sounds pretty good though and I am looking forward to seeing it in action).
Code base looks good - we've taken a step back functionality wise, but I'm good with that. Build it up slowly with a solid foundation we all agree on.
So some comments on design/next steps:
First thing that sticks out for me is the use of AnimationTimer vs Transitions. I feel like there's some inconsistency here (i.e. we have two ways of animating, which means two ways of pausing, two
ways of thinking, etc, etc). My code in this area was pretty similar to Richard's and it feels to me as if the inconsistency is really at the JFX animation layer and the API is a tad off here - how
do you guys feel about it?
Ignoring any possible API level changes I feel like we should at least come up with a consistent strategy. I think we can't get by without the "pulse" style functionality of the AnimationTimer. We
need the "pulse" so that things can "think" (e.g. Tower needs to look for Enemies, bullet needs to check if it hit anything) and Transition doesn't really allow for this cleanly as far as I can see.
On the other hand the Animation/Transition stuff is great in how simple it is to do complex stuff (like Path routing). We've used this to good effect in routing the path for Enemies but I'm wondering
how long we will get away with this. If we try to slow or speed up an enemy, or if the enemey needs to react to it's surrounds (e.g. a Tower killing enememy that blows up when it is in range of a
tower), then I suspect we will find ourselves limited by the Animation/Transition side of it?
So I'm wondering if there is any way we could use an Animation/Transition but instead of calling play() we manually call something like nextFrame() to an AnimationTimer - i.e. I kind of want the
transition logic of the Transition but want to decouple it from the animation thread. Is this possible? Or do either of you have thoughts on better/alternate ways to do this?
Whether we can avoid the Transition or not, I'd also wonder if we could simplify the logic around AnimationTimer and instead of the current design, we have just one central AnimationTimer inside the
Game object. We then have a GamePulseListener class that things can implement, and add themselves to the Game.addPulseListener(). Then we can centralise stuff like pausing (by just stopping the
central animator) and also hide how the animation works (in case we change from an AnimationTimer to something else later).
What are your guys thoughts on this?
I'd probably be looking to work next on this code base on Tuesday my time (probably Monday evening your time), so would be good to have something to target for that coding session.
Some other things I think could be looked at:
The Level doesn't need to be abstract in my book. If we had exactly as is, but not abstract, we could then create Levels without extending them (e.g. via FXML). For short ease term we can still just
create the as you are by extending them, but it's not required. Unless there are objections, I would like to make it non-abstract.
The Towers currently get their shooting/targeting logic from within LevelPanel when the Tower is created (in the placeTower method). I'd be more inclined to move this logic into the Tower itself - so
a Tower internally has a pulse method that decides how it shoots and what it shoots at. For example some towers might not even shoot, and might just increase the shooting tower of nearby Towers, etc.
Some Towers might fire lots of missiles, etc, etc. To me it makes sense to put this in the Tower class. I'm guessing Richard, you just didn't get round to moving it, but if you had a bigger plan here
let us know. If there's no objections by Tuesday I will likely look at moving this logic too.
There are lots of other areas to add to but I'd be keen to focus on those first. I think the simple Wave approach that Richard has in there is probably not what we want longer term but I'd be keen to keep it as is for now (i.e. simple!) and focus on the other areas of the game first. The Wave stuff can be improved later in my book and this will be easier/cleaner to do when we have fully locked down other things (like path routing, tower placement, etc).
I notice neither of you have joined the mailing list yet - I've cc'd the list on this email so it will get logged. It would be easiest if you both joined however and then we could all send only to that list instead of private emails. If there are objections to google groups idea, let me know.
Cheers!
Dan