[Bookcarnival-code] Started First Game - DB CHANGE!

Josh Hoover jhoover6672000 at yahoo.com
Thu Mar 15 09:28:00 EDT 2007


Magic.  That is the answer. ;-)  The code goes into your environment/development.rb file and will look something like this:

ActionMailer::Base.smtp_settings {
    :address => smtp.server.com
}

All the options for the SMTP server can be found at:

http://api.rubyonrails.com/classes/ActionMailer/Base.html

Do a search for "smtp_settings" on that page and you should be in good shape.  If that doesn't work for you for some reason, then you can just manually blank out the activation_code field for your user in the users table and should be good to go.

Thanks!

Josh

----- Original Message ----
From: Joe Kueser <joe at kuesers.net>
To: bookcarnival-code at rubyforge.org
Sent: Wednesday, March 14, 2007 9:39:51 PM
Subject: [Bookcarnival-code] Started First Game - DB CHANGE!

First off...Josh, I can't log in anymore.  I assume this is because  
of the activation you added.  Can you let us know how to set that up  
locally?  (I'll dig through the emails in a second to see if you  
already told us. ;-)

I've started coding the first game, "Tilt-A-Whirl".

I love Rails!  I'm already probably half done with the game and I  
haven't written any code yet :-D

In an effort to make the games more generic, and make it so multiple  
instances of the same game could be played simultaneously, I made  
some changes to the database.  First I added a "game_instances"  
table.  Each game instance has its own title, description, and user  
associated with it, and is, of course, associated with a game.

So, I had to change the games table as well, to define that  
relationship.

Finally, I had to change the book_transactions table, making it so  
each transaction was related to a game_instance instead of a game.

So...

Before you do anything else, run:

rake db:migrate VERSION=0

and then

rake db:migrate

This should clean and rebuild your database.  This isn't something we  
want to do in production, as it wipes out the database, but since  
nobody will have much data to worry about yet, why not?


Real (somewhat) quickly, here's how the Tilt-A-Whril game will work.   
I suspect most if not all games will be similar.

When the user navigates to the TiltAWhirl page, they will be given  
the option to ether participate in a currently running game, or  
create their own instance.

If they create their own instance, they will provide a name for the  
instance, and a description.  For example, the name might be  
"Computer Languages" and the description might be "Any books about  
learning to program."  Behind the scenes, we'll need to know 1) the  
user ID, 2) the game ID, and 3) the current time.

On this same page, the user will also put the first book up for grabs  
for this game.  Ultimately, we'd allow them to enter the ISBN or BCID  
numbers, but for now, entering the title, author, category, language,  
and number of pages.  This would be a GREAT place for AJAX.  If they  
enter the ISBN or BCID, we can fill out the rest for them.  On all  
other fields, we can put an autocomplete textbox, so if they type  
"Step" they will get a list containing "Stephen King".  Here they  
will also be allowed to put a URL for a book cover picture, or upload  
a picture.

Now that the game instance is created, someone can come along and  
play in this game.  This is where specific rules for this game come  
in to play.  When a person selects the book to grab, the rules kick  
in, in the case of Tilt-A-Whirl, the rule would be that in order to  
take the book, the user must offer another book, and pay 5 tickets.

So the new user specifies the info for the book they want to offer,  
and another book_transaction is created.

This will go on until no books have been traded for 3 days, with a  
new book_transaction being created each step along the way.  The  
book_transaction also has a transaction_status associated with it,  
which eventually the users will be able to update when a book is  
mailed, received, etc.

Off to a good start.  I should have a basic version of the game done  
this week.

Joe
_______________________________________________
Bookcarnival-code mailing list
Bookcarnival-code at rubyforge.org
http://rubyforge.org/mailman/listinfo/bookcarnival-code





More information about the Bookcarnival-code mailing list