270 likes | 380 Views
Aspect-Oriented Design of Game Application. H. Saygın Arkan, Murat Açar, Ender Demirkaya 30 December 2010. - Outline. Introduction About Aqua Bubble Object-Oriented Design Applied Patterns Problem Statement Aspect-Oriented Programming Related Work Discussion Conclusion Demo.
E N D
Aspect-Oriented Design of Game Application H. Saygın Arkan, Murat Açar, Ender Demirkaya 30 December 2010
- Outline • Introduction • About Aqua Bubble • Object-Oriented Design • Applied Patterns • Problem Statement • Aspect-Oriented Programming • Related Work • Discussion • Conclusion • Demo
- Introduction • The game at issue is “Aqua Bubble” • The requirements are in hand. • Limited Project • But good start for Aspect Application • Enhancements to the Project • Create & Solve Problems
- AquaBubble • Familiar Game • Shoot Gun • Collect 3 same colored bubbles • Balls are moving down • Bubbles are coming down with a certaintime period. • The time it takes to movedecreases with the increasing number of levels • Purpose: Finish all the balls before they came in the turret’s level.
- AquaBubble • Some sample screenshots...
- Object-Oriented Design • Already distributed responsibilities to packages, thereby classes • UI includes menu panels and visual items as usual. • Controller does the main operation behind. Two main packages:
- Object-Oriented Design • The package diagram is as follows:
- Object-Oriented Design • Ui package class diagram
- Object-Oriented Design • Controller Package class diagram
- AppliedPatterns • Singleton pattern • GameFrame, GameEngine, GamePanel and ControllerFacade, InGameFacade • Facade pattern • Deals with in-game managers as a one-stop solution • Abstract Factory pattern • Creation of balls in game is the subject entry • Strategy pattern • Balls have specific explosion types.Strategy smells
- AppliedPatterns • Singleton Pattern Exactly one instance is necessary and sufficient
- AppliedPatterns Facade Pattern
- AppliedPatterns • Abstract Factory Pattern • Different balls in game are the factory products
- AppliedPatterns • Strategy Pattern • For different type of explosions that the balls have. Context Class Interface View + findExplosion(ball: Ball) + findExplosion(ball: Ball) + findExplosion(ball: Ball) + findExplosion(ball: Ball) + findExplosion(ball: Ball)
- Problem Statement • High coupling & LowCohesion • Enhancements= Tangling Code and Crosscutting concerns. • Sound affects are to be happened instantaneously. • Will we define sounds for each and every UI object individually? • Logging mechanim crosscuts at all times. • Where are the logs of error handling and in-game controls to be kept? • Some game add-ons are to be integrated. • Additional code to all the classes. What a disaster!
- Problem Statement • SoundEffect Concern • Panel changes, button clicks, ball explosion... • Costly without Aspect, needs update & modification on all button listeners, panel change functions andthe related classes. • Logging Concern • Tracing all the process from beginning to the end. • Provides effective error handling • More controllable game process
- Problem Statement • GameAddOn Concern • Functionalities that recurred to the mind. • Graying the panel when game finishes (updating all objects behind) • Changing Ball Colors (gradient, more colorful) • AWTEnforcement Concern • AWT use is strictly forbidden.
- Aspect-Oriented Programming • Sound Effects Aspect is applied to Panel Changes, Button Clicks, Ball Explosions and Level Ends
- Aspect-Oriented Programming • Logging Aspect is applied to the set functions,constructor calls and panel changes.
- Aspect-Oriented Programming • Game Add-On Aspect is applied to change the color of all balls todark gray when the level is finished. Also, ball types shall be re-drawn with different ball images
- Aspect-Oriented Programming • Game Add-On Aspect Previous implementation New implementation
- Aspect-Oriented Programming • Game Add-On Aspect Previous implementation New implementation
- Aspect-Oriented Programming • AWT Enforcement Aspect ensures that the project keeps it’s packagestructure. Thus, only UI package classes would use java.awt library and the use of AWT classes in Controller package is prevented
- Related Work • Inside AspectJ documentation, there exists a computer game named Space War by which we are inspired. • After, we went beyond and made some core changes in the project, such as sound effects and changing theimage of bubbles in the game.
- Discussion • AOP stepped into the breach • Aspect discovery and refactoring are the bottlenecks as per usual. • Legacy code, aspect mining has vital necessity all along the migration process. • Manual examination of aspect candidates. • AspectJ is a useful to track pointcuts, weaving etc.
- Conclusion • The transition process of a non-modular application into a well-defined aspect-oriented structure is illustrated. • Almost at all levels that the old design congests, the fresh design pioneers the mechanism. • Shortfalls are attached to distinct aspect mechanisms with reference to the ostensible constraints. • Aspect-orientation is worth applying in the cases where the stakeholders do know much about the current system, and see the initiatory steps of migration process.