Hello everyone.
I have some questions about the Actor interface in the book.
I understand that ActorParams work kind of like a factory for a kind of Actors. Makes pretty good sense to me, a kind of serializable object factory.
But... what I don't understand is why IActor has an Update method. Nowhere in the source code (and I've tried using the search function on Google code) can I find that this method is actually used.
The BaseGameActor seems to store enough information to be used in TeaPotWars. That is, it's a useful data container. But as I gather the structure proposed in the book is one of message passing (called events in the book), where things that listen to events update the game state.
I guess the GameLogic would be in charge of updating the actors. Something that feels a bit iffy to me, won't this result in a gargantuan switch-block?
After some contemplation I guess my actual question is this: we have GameLogic, we have events, but what if I have a bazillion different types of Actors (Door, Hovering Banana, Headless Kamikaze) etc with different behaviour. Where do I manage this?
In the Actor class, through the Update method? "Check we have zero health"... would the Actor notify the world about it's poor health?
TeaPotWars seems (and I'm probably wrong here) to encode all this Actor behaviour in it's event handler. But with a growing number of actors, I can see this becoming a massive problem.
Sorry for this rambling "question", thank you for any help in advance.
----------
Edit:
And some more thinking:
We could have different listeners that implement the Actors behaviour, but what use would the Actor objects be then, we could effectively replace them with just the ActorId and some kind of storage.
I have some questions about the Actor interface in the book.
I understand that ActorParams work kind of like a factory for a kind of Actors. Makes pretty good sense to me, a kind of serializable object factory.
But... what I don't understand is why IActor has an Update method. Nowhere in the source code (and I've tried using the search function on Google code) can I find that this method is actually used.
The BaseGameActor seems to store enough information to be used in TeaPotWars. That is, it's a useful data container. But as I gather the structure proposed in the book is one of message passing (called events in the book), where things that listen to events update the game state.
I guess the GameLogic would be in charge of updating the actors. Something that feels a bit iffy to me, won't this result in a gargantuan switch-block?
After some contemplation I guess my actual question is this: we have GameLogic, we have events, but what if I have a bazillion different types of Actors (Door, Hovering Banana, Headless Kamikaze) etc with different behaviour. Where do I manage this?
In the Actor class, through the Update method? "Check we have zero health"... would the Actor notify the world about it's poor health?
TeaPotWars seems (and I'm probably wrong here) to encode all this Actor behaviour in it's event handler. But with a growing number of actors, I can see this becoming a massive problem.
Sorry for this rambling "question", thank you for any help in advance.
----------
Edit:
And some more thinking:
We could have different listeners that implement the Actors behaviour, but what use would the Actor objects be then, we could effectively replace them with just the ActorId and some kind of storage.
The post was edited 1 time, last by skurmedel ().