Thursday, September 12, 2013

How to structure this project - multiple javascript games

Hello everyone :)
I'm currently working on a new project and need to ask you guys how to structure it, as it is a bit different than my usual cakephp-project (sorry for the long post).

Here are the project-details:
  • the project is a site where users can play "braintraining" games
  • the games use html5+Canvas
  • the user can login
  • for every game:
    • the result is saved if the user is logged in
    • the user gets a highscore after he finishes the game
    • (there are additional features but those are not important for my question)
  • at first there will be only 3 games, but the system should be flexible enough to handle even 200 games

Here are my questions:
  1. do I use 1 controller for all games or does each game gets his own controller? Or is there a completely different way to handle this?
  2. do I implement the "save_score()" functionality, as a method or as a component?
  3. how do I structure the database-tables for the games?

Here is how I would solve it right now:
  1. I would use 1 controller for all games and make the methods as abstract as possible so the methods can be used for all games
  2. I would implement it as a method, as I only have one controller
  3. I would create one table for one game. The tables would probably be named something like this: "_g1_results", "_g2_results" (for "game 1 results", "game 2 results" etc.)

Additional information:
  • my goal is to have a clean and logical structure
  • it should be easy to add new games

Every tipp/hint/optimization/suggestion is very welcome! :)

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: