G
Gavin Kistner
(I know there's a rails mailing list. For some reason this feels more
appropriate to ruby-talk. I'll go to the other ML if this one fails
Summary:
I'm writing a rails app where I want to save information about a
user's session, so that they may return at a later date and pick up
where they left off. The information being saved is an object with
arbitrary instance variables. What's the best way (or any good way)
to save this? So far, the only thing I can think of is Marshal dump/
load to a db row, but this seems off for some reason. Is this the
best way?
Details:
I'm writing an app that's an odd mixture of interactive fiction,
wiki, and MUD. (Well, single-user for now.) Think of a web version of
a "Choose Your Own Adventure" book, where anyone can write the pages/
choices, and every page and choice can have arbitrary ruby code
associated with it. Each page and choice is an ERB template (in the
future, with wiki markup), allowing the contents of the story and
text of the choices to vary.
Each page can run Ruby code against a 'ReaderSession' before the page
is viewed, setting the consequences of getting to the page. Each
choice can run Ruby code to decide if it may be shown (e.g. has the
user already made this choice? does the user have enough gold to buy
the rabbit? does the user have the sword needed to slay the dragon
here?). When the user makes a choice, code specific to that choice
can be run before the destination page is shown (e.g. subtract the
right amount of gold and add the rabbit to the inventory).
When the user starts a story, a blank ReaderSession object is
created. The code for each page/choice is run within the scope of
this instance, so that any instance variables may be set without
harming others (a sort of namespace) and I can easily start the story
over by clearing out the instance variables.
Certain details haven't been ironed out yet: should each choice be
hardcoded to a destination page, or can the 'result code' for a
choice change which page you go to? How will I use AJAX to make this
a multi-user/reader game, so that when someone else arrives at the
same page, you know they're there? Can pages have time limits that
force the user to make a choice before a default action is taken
automatically?
Thanks for any advice/brainstorming. As with all my personal
projects, this will be an (advertisement-free), free service for
the .net to enjoy. (In other words, helping me isn't helping with
some commercial project you'll never see.
appropriate to ruby-talk. I'll go to the other ML if this one fails
Summary:
I'm writing a rails app where I want to save information about a
user's session, so that they may return at a later date and pick up
where they left off. The information being saved is an object with
arbitrary instance variables. What's the best way (or any good way)
to save this? So far, the only thing I can think of is Marshal dump/
load to a db row, but this seems off for some reason. Is this the
best way?
Details:
I'm writing an app that's an odd mixture of interactive fiction,
wiki, and MUD. (Well, single-user for now.) Think of a web version of
a "Choose Your Own Adventure" book, where anyone can write the pages/
choices, and every page and choice can have arbitrary ruby code
associated with it. Each page and choice is an ERB template (in the
future, with wiki markup), allowing the contents of the story and
text of the choices to vary.
Each page can run Ruby code against a 'ReaderSession' before the page
is viewed, setting the consequences of getting to the page. Each
choice can run Ruby code to decide if it may be shown (e.g. has the
user already made this choice? does the user have enough gold to buy
the rabbit? does the user have the sword needed to slay the dragon
here?). When the user makes a choice, code specific to that choice
can be run before the destination page is shown (e.g. subtract the
right amount of gold and add the rabbit to the inventory).
When the user starts a story, a blank ReaderSession object is
created. The code for each page/choice is run within the scope of
this instance, so that any instance variables may be set without
harming others (a sort of namespace) and I can easily start the story
over by clearing out the instance variables.
Certain details haven't been ironed out yet: should each choice be
hardcoded to a destination page, or can the 'result code' for a
choice change which page you go to? How will I use AJAX to make this
a multi-user/reader game, so that when someone else arrives at the
same page, you know they're there? Can pages have time limits that
force the user to make a choice before a default action is taken
automatically?
Thanks for any advice/brainstorming. As with all my personal
projects, this will be an (advertisement-free), free service for
the .net to enjoy. (In other words, helping me isn't helping with
some commercial project you'll never see.