Hi all,
Apologies for the long post, but just want to introduce myself and
also make sure everyone understands where I am coming from, and that
I’m not some n00b on a fools errand. I fully appreciate the
complexities involved in the ultimate goal I have set for myself and
have no illusions that there will be long, difficult lessons,
scrapping and rewritting of lots of code, and the typical stuff that
happens during development.
(For Array/Hash question skip to bottom of post)
Just to give a little background about myself. I am one of those
people who always wanted to learn to program, but was never able to
teach themslves to a large degree. I’m 27 now, but I started my
love/hate relationship with C++ when I was about 15. Over the years
I’ve made various attempts but always ended up stumped at some point,
I think mostly because I was unable to see the big picture in terms of
setting goals for myself, etc. I probably tried to do too much at
once. C++ in particular I got hung up on math related stuff and
learning integers in general, for what reason I don’t know why. But
I think it was a matter of wanting to actually comprehend what I was
reading and being frustrated that I literally could not understand
things or grasp certain concepts.
A few months ago I renewed my efforts once again, this time starting
with Python. I structured my learning as I had when I originally
taught myself HTML when I was 13/14. That being, have a goal to do
something overall, but break my learning into parts I could complete
to get immediate results, and gain knowledge at the same time. I had
a lot of success and experienced the joys of cracking a tough problem
with a (in retrospect) simple solution. However I’m largely not keen
on certain things about Python that are largely, minor annoyances but
nevertheless, I decided to give Ruby a try. Although my progress has
been a bit slower (Python really was just so easy to use and write out
syntax, Ruby is similar and I like it, but a little more difficult
for me), I think I will like Ruby a lot once I get to know it better.
So far the plan is to fulfull a long time goal of making a game. Don’t
worry I’m not looking to make the next DOOM blockbuster or anything
like that. Right now I am focusing on Text driven games in
particular. I have a long history and love of MUD style games, and
their complexity / interactivity even as a “solo” player. I’m NOT
interested in “Interactive Fiction” type games which are probably
simple in comparisson, but I am interested in creating and interactive
text adventure environment, with the included intricacies and level
of complex interactions that a typical MUD style game can provide,
even to a single player.
I am using this goal as a means to teach myself to program in general,
and right now it looks like that project will be used to teach myself
Ruby. I don’t have any concerns about the speed of Ruby vs even
Python, or even a compiled language such as C/C++ etc. Although I
know text game systems are notoriously complex and do involve tons of
calculations per second (in the case of a MUD server hosting hundreds
of players) but I am confident that whatever I design, Ruby should be
able to handle, especially when run on fairly modern hardware.
I have ideas about how I want to design the game in general, and what
I want to be able to do with it, and stuff like that. I also know at
the very least, that the persistant data backbone will be one or more
integrated SQLite databases. However from a design concept point of
view I would appreciate some recommended reading specifically aimed at
MUDs and Text Games in general. Stuff that deals with how to
organize certain data overall and keep track of it as it changes. In
particular I need to get an idea of the architecture of these types of
systems I will be developing, such as a “World Map” type reference
that contains the present location of a piece of generated loot, or a
generated MOB / NPC / The Player, etc. I do have general ideas and
theories but I don’t want to waste hours designing this or any other
system only to find out it is a flawed design, hard to update and add
functionality to, etc.
If anyone knows of good general reading targetted at Text/MUD games in
particular, and the various systems and design concepts, as well as
how they are implemnented. It would be very appreciated.
Arrays/Hashes: This is a secondary question I have regarding
efficiency and speed… It is highly likely I would be using both of
these in a given scenario, to hold game data coming from a database or
generated/updated by real-time calculations. Are there any
guidelines for which is more appropriate for a given situation? For
some tasks I definitely like the idea of using Hashes to keep track of
certain data, but can see a use for Arrays in other situations where
using a Hash may mean redundant data or redudant references to data…
For examples storing character, room, and NPC data in a Hash would be
pretty easy to manage with Key/Value pairs that make it easier to
read and understand in the large scope of things. Whereas keeping a
“Map” object to reference each instance of a Hash, and changes in its
state would probably be more efficient and easier to read versus using
a Hash where the key and value might essentially be the same string.
(i.e a instance of Room, called “0xc4” would be easy to manage in an
array whereas in a hash the Key and Value would both be 0xc4 and thus
a little redundant). Hope that makes sense.
So in general, are there speed considerations to take into account for
using one over the other?
-Zach