event-driven-design

Turn-based Game Design: Event-Driven vs. Game Loop

此生再无相见时 提交于 2019-11-30 07:08:08
I am creating my first game in Java. The game is Monopoly. I am struggling with how I should design the game to model its turn-based structure (managing player turns). I want to allow for both a single human-controlled and one or multiple AI-controlled players to play the game. My specific issue is that I do not know whether to implement a game loop or not, meaning a loop which can manage the players and the variables directly related to the game of Monopoly, (think of things such as prompting each player for their turn, incrementing the turn to the next player, or getting dice rolls from each

best practices for handling UI events

主宰稳场 提交于 2019-11-29 02:02:13
I have put the all the binding code for UI events on OnCreate(). It has made my OnCreate() huge. Is there pattern around implementing UI events in android ? Can I add methods in View xml file and then I can put all the handler code somewhere else. In a nutshell , I think I am asking how can I implement MVVM pattern with android app code ? Stuff that I do: Keep all onClick functions in the XML. Avoids a lot of clutter in the Java code. Initialize event listeners as members of the activity class rather than keeping them in a function. I don't like too many curly braces in my code. Confuses the

Event-driven architecture and hooks in PHP

懵懂的女人 提交于 2019-11-28 17:19:51
I am planning on working on a game that has a PHP back-end to communicate with the data repository. I was thinking about it and concluded that the best design paradigm to follow for our game would be event driven. I am looking to have an achievement system (similar to the badges system of this website) and basically I would like to be able to hook these "achievement checks" into a number of different events that occur in the game. ie: When a user does action X hook Y is fired and all attached functions are called to check against an achievement requirement. In structuring the architecture like

Why are commands and events separately represented?

做~自己de王妃 提交于 2019-11-28 16:57:06
What is the difference between commands and events in architectures that emphasize events? The only distinction I can see is that commands are usually sourced/invoked by actors outside the system, whereas events seem to be sourced by handlers and other code in a system. However, in many example applications I have seen, they have different (but functionally similar) interfaces. Commands can be rejected. Events have happened. This is probably the most important reason. In an event-driven architecture, there can be no question that an event raised represents something that has happened . Now,

Event-driven architecture and hooks in PHP

烂漫一生 提交于 2019-11-27 10:24:05
问题 I am planning on working on a game that has a PHP back-end to communicate with the data repository. I was thinking about it and concluded that the best design paradigm to follow for our game would be event driven. I am looking to have an achievement system (similar to the badges system of this website) and basically I would like to be able to hook these "achievement checks" into a number of different events that occur in the game. ie: When a user does action X hook Y is fired and all attached

Why are commands and events separately represented?

核能气质少年 提交于 2019-11-27 09:56:03
问题 What is the difference between commands and events in architectures that emphasize events? The only distinction I can see is that commands are usually sourced/invoked by actors outside the system, whereas events seem to be sourced by handlers and other code in a system. However, in many example applications I have seen, they have different (but functionally similar) interfaces. 回答1: Commands can be rejected. Events have happened. This is probably the most important reason. In an event-driven