Ruby "Save Game" function

M

Michael Brodeur

Hello!

I am currently working on a text-based RPG and I wanted to implement a
function that allowed the user to save their game at any point, so that
it could be resumed later. Of course, this would need to be complimented
by a load function that would resume the game at that previous state.

Anybody know how I would do this? ^_^

Thank you in advance!

-SS
 
B

Bill Kelly

Michael said:
I am currently working on a text-based RPG and I wanted to implement a
function that allowed the user to save their game at any point, so that
it could be resumed later. Of course, this would need to be complimented
by a load function that would resume the game at that previous state.

For starters, I'd suggest looking at PStore and YAML::Store.

PStore:

http://ruby-doc.org/stdlib/libdoc/pstore/rdoc/classes/PStore.html

YAML::Store exmaple:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/113207


PStore and YAML::Store are essentially equivalent in functionality,
the difference is PStore saves objects in Ruby's binary marshal
format, whereas YAML::Store saves objects in human-readable YAML
text format. And the trade-off is that YAML is slower than marshal.


Further possibilities for key/value stores with Ruby:

http://www.engineyard.com/blog/2009/key-value-stores-in-ruby/
http://www.engineyard.com/blog/2009/key-value-stores-for-ruby-part-2-tokyo-cabinet/
http://www.engineyard.com/blog/2009/cassandra-and-ruby-a-love-affair/
http://www.engineyard.com/blog/2009/key-value-stores-for-ruby-part-4-to-redis-or-not-to-redis/
http://www.engineyard.com/blog/2009/mongodb-a-light-in-the-darkness-key-value-stores-part-5/
http://www.engineyard.com/blog/2009/key-value-stores-in-ruby-the-wrap-up/


Hope this helps,

Bill
 
M

Michael Brodeur

Bill,


Thank you for the links! It's still a lot to chew on, but I'll try to
figure it all out. :p

Best Regards,

-SS
 
O

Ozgun Koyun

Michael said:
Hello!

I am currently working on a text-based RPG and I wanted to implement a
function that allowed the user to save their game at any point, so that
it could be resumed later. Of course, this would need to be complimented
by a load function that would resume the game at that previous state.

Anybody know how I would do this? ^_^

Thank you in advance!

-SS

May I suggest "sequel + sqlite"? http://sequel.rubyforge.org/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top