Im making a strategy game (not in Drupal, only PHP with Javascript, you can see in in here www.iasoftgroup.com/xeno). For the login system I use a simple user login/register module. It doesn't do a lot, just the basic data sanitation, so it ocurrs to me that maybe i can use the Drupal API to make it work for me.
So I wanna know similars experiences and ideas of how this could be done. If it easy to do it?. Are there any problem or pitfall that we should be aware of?
Also there's another question i would like to put on talk. Taking my game as an example, I have two databases, one for drupal (the web page of the game) and one for the game itself. Would it be convenient to have all the data in just one database? The only problem that I see so far of having two databases is the backup and restore of the game. But better to ask you guys.
Comments
Well.
I assume you have probably moved on by now, but in an effort to revive this group... I will give you my thoughts.. Drupal has saved me hundreds of hours of work and I recommend using it as a platform. So many things are done by drupal that you don't have to worry about. User accounts, security, etc. You don't have to use the node system if you don't want and you can create all your pages via hook_menu() and skip nodes all together. I won't ever do another php website without drupal again.
I want to get to know the services module as well. Using that, it appears you can do so much more as well. I have only scratched the surface but if you are doing flash or other stuff, it seems to be the recommended route.
Hi tpainton, well i decided
Hi tpainton, well i decided to give Drupal a Chance an now im integrating my game with the user and session modules from Drupal. I have to admit that it wasn't an easy task, particulary the session part of Drupal ( my sessions variables just dissapeared, but it was more an PHP related thing) and redirecting from hook_user wasnt an easy task (nothing than some googling couldnt handle), but i finally managed to integrate the login to my Game!. Im writing some of that stuff in my personal blog www.taurencreate.blogspot.com if anyone wants to do the same.
Before merging my game with Drupal, i never mess up with the Drupal API so i looked for some help and found the book "Pro Drupal Development, Second Edition". Ithelp me alot, so i recommend it if you are new to Drupal api.
For the record, im now using two databases, one in Mysql that handle all my Drupal & Session stuff and one in Postgrest, that manage all my ingame stuff.
Im not using the hook_menu, just static pages and some Drupal bootstrapping.
I made some performance checks (nothings serious, just some PHP microtime metrics) and its seem that using DRUPAL_BOOTSTRAP_SESSION, dont affect too much my performance (and maybe it make it faster), but enabling the whole DRUPAL_BOOTSTRAP_FULL just make my game at least 5 times more slower.
Im curious about the use of hook_menu, how do you use it? and where?
hook_menu
hook_menu is used to tie a URL to a menu, and/or to have its associated functions run when that URL is requested. For example, let's say you have a magical function you want to run on http://yourdomain.com/admin/mymagicalfunction and you want it to happen only for people who can administer nodes. You would do this in your module:
function mymodule_menu() {
$items = array();
$items['admin/mymagicalfunction'] = array(
'title' => t('My Magical Function'),
'page callback' => 'mymodule_do_magical_function',
'access arguments' => array('administer nodes'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
function mymodule_do_magical_function() {
// SOMETHING HAPPENS HERE
// return $whatever;
}
And refresh your theme registry. Now whenever the URL gets requested, the function "mymodule_do_magical_function()" will be run and you can spit out whatever you want. This is also a great place to launch calls to the Forms API if you're doing a "Module Settings Page" or etc.
LVX
TF