My application's modules,
- Race game
- Cows and Bulls
- Bubble break
Challenges faced:
1.Race game:
- Animation done using setInterval is not optimized. It lead to slower processing. Overcome by using animation frames, an option provided by all major browsers to optimize animations in canvas.
- Cross browser compatibility in event handling . Used jquery initially to overcome this problem. But then I knew that using external libraries is always an overhead. So used addEventListener function which works well in all major browsers.
- What to render? Every object in the game world if rendered may pull down the game speed. Overcome by writing a function to find objects which are in current canvas view.
- Realism: to bring realism to the game, lot of factors like acceleration, top-speed, lateral steering movement, aftermath of collision have to be considered which is challenging.
- Event queue maintenance: the very idea of processing events is challenging. Improper way to process may bog down the performance. Event queue is maintained to overcome this problem.
- Collision detection: For every loop detection algorithm has to be run in optimized way to find any collisions.
- Gamestate and dashboard: Since pausing the game was also included the gamestate to be maintained became complex. In addition to this, when displaying time in dashboard these game states had to be kept in mind which was really a challenge.
2.Cows and bulls:
- Dictionary words only: The guesses have to be validated against dictionary words. But the dictionary words should be loaded into the application dynamically. Overcome by using AJAX request to local dictionary file.
3.Bubble break:
- Writing event driven code: Since i was using nowjs and nodejs everything needs to be written in a event driven way. Using callbacks and stuff which was really challenging initially.