You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the main challenge here is determining what belongs in a message bus response vs not. And it's all about repeatability, predictability, and isolation.
If it's something that happens every time, it's not really a message bus thing. So, like, all of this happens on every combat or turn. It doesn't need to be "reactive" to the message bus. It could just be something the combat class calls on every entity in combat:
for entity in [player, *all_enemies]:
entity.start_combat()
bus.publish(START_COMBAT, ....)
Similarly, we can call start_turn(), end_turn(), etc... on everything. (Or alternate between a player turn and an enemy turn).
The point of message bus is for reactive things, like relics and buffs/debuffs. We want to separate the code of these things from the "game engine" that's handling the flow of the game and combat flow.
Ex: It should be easy in the future to make this a 2-player game if you want, simply by swapping who's in combat. If it's coded well, it can do that.
I suggest for now removing all message bus stuiff from Player and Enemy, cause they tend not to react to things outside of the effects that are put on them.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I think the main challenge here is determining what belongs in a message bus response vs not. And it's all about repeatability, predictability, and isolation.
If it's something that happens every time, it's not really a message bus thing. So, like, all of this happens on every combat or turn. It doesn't need to be "reactive" to the message bus. It could just be something the combat class calls on every entity in combat:
Similarly, we can call start_turn(), end_turn(), etc... on everything. (Or alternate between a player turn and an enemy turn).
The point of message bus is for reactive things, like relics and buffs/debuffs. We want to separate the code of these things from the "game engine" that's handling the flow of the game and combat flow.
Ex: It should be easy in the future to make this a 2-player game if you want, simply by swapping who's in combat. If it's coded well, it can do that.
I suggest for now removing all message bus stuiff from Player and Enemy, cause they tend not to react to things outside of the effects that are put on them.
Beta Was this translation helpful? Give feedback.
All reactions