Last weekend I spent Sunday rewriting the The Fruit Machine - Vampire Castle "event model", to put this simply, the existing system couldn't handle the combinations of clicks and options available on the fruit machine without some major code ugliness and risk of bugs.
The code is now in a state to progress it further feature wise. I particularly want to make it easier (not easy - because it isn't) for other developers to develop similar fruit machines using a shared fruit machine framework.
Two key parts of the framework are:
- An abstract fruit machine component "model" (a fruit machine consists of boards, which consists types of components such as buttons, lights etc), these have common features and functions that are exposed by the API
- A "pull" event framework. Instead of a central monolithic piece of code making decisions based on lot of variables (e.g. has start been pressed, are we spinning a reel, are we on the top board etc) and having button clicks setting off this behaviour ("pushing the data") there are now individual pieces of code "event handlers" to do the work. The event handlers are told to work out whether they individually in turn need to do anything and can ask the abstract fruit machine ("pulling the data") to return the states of components to find out whether anything should be done.
I'm thinking of GPL for the licence, however I may make additional modifications to the licence to ensure Silent Software remains as an acknowledgement on any splash screens.