Re: game development question:reading and writing game data to and from files

  • From: "Tyler Littlefield" <tyler@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 12 Jul 2009 13:13:59 -0600

gotcha. I was sorta brain storming that one out.
If I were to make an inventory with inventory_id, item_type, item_id that would 
work, but I'd have to have something that would define the stats on each 
weapon. No weapon will be the same, it will drop with random stats etc. So I'd 
have to work off a basic weapon, but then store the weapon that is created on 
the mob or player or something so I could actually create the object when the 
world is initialized.

  ----- Original Message ----- 
  From: E.J. Zufelt 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Sunday, July 12, 2009 1:10 PM
  Subject: Re: game development question:reading and writing game data to and 
from files


  Hey Tyler,


  You could have a separate table for weapons, rooms, quests, etc.


  You would then have a player_quests table that would only store the id of a 
player and the id of a quest, and possible any other details particular to that 
player and that quest.


  HTH, 

  Everett

  Follow me on Twitter
  http://twitter.com/ezufelt

  View my LinkedIn Profile
  http://www.linkedin.com/in/ezufelt







  On 12-Jul-09, at 3:06 PM, Tyler Littlefield wrote:


    I'd thought about mysql. I'm not quite sure how I'm going to organize it, 
though.
    Like I could have a table for players,
    name,email,password,id
    But then if I decide to add things I have to add a new colemn, no?
    I could add a table for things like stats, currency etc and keep a unique 
ID and another field that would store the player's id, but that doesn't work 
for things like keys.
    For example, if I wanted to add a key to a player that said they did this 
quest, or they went to this room, I'd have to add a new table for each area or 
something.
    Same with items; I could have weapons, containers, and books. I would have 
to have a table for every new item type and then a table that stores the 
players inventory.
    XML might be my best bet, not quite sure how I'd do that one quite yet, 
eother.
    Any good xml libraries?
    I know I could check google, but I'd like to see what people prefer rather 
than just going to my first search result and trying to make sure it works.
    I seen tineyxml, but with that I may as well just write my own parser.

    ----- Original Message ----- From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
    To: <programmingblind@xxxxxxxxxxxxx>
    Sent: Sunday, July 12, 2009 12:04 PM
    Subject: RE: game development question:reading and writing game data to and 
from files




    I use Bison and Flex in my current mud engine which is still one of the few
    commercial ones left.  I find it is too much work keeping up the grammar
    though and I am slowly converting to an xml / mysql based file system.
    Right now I have a full compiler that compiles the zone files and
    proprietary functional language into a binary structure and a parser that
    reads the player files but over the years I have come to find that it would
    be much easier as a relational database that would allow much quicker look
    up with less memory use.

    I am not saying bison and flex is not a good choice if you really want to
    get down and dirty but I am saying if your thinking of running your game
    server on multi platforms like Windows and Linux it is easier to have
    something like a relational database underneath than porting the file system
    stuff over each operating system.

    Now with that said if you must build everything from ground up I would
    really look into Boost and the serialization library over writing a parser
    with Bison and flex there are limitations to the type of parser you will get
    out of bison but you won't find those till much later in your development.
    A game like a mud is well fitted to a relational database and an xml
    interface.  You could easily use xml to both interface with the players and
    to create web page interfaces with the game like clan pages that could list
    who was on and clan standings or quest hints and help pages.  Again you
    could do this by creating your own file systems but you are then reinventing
    a lot of code that has been done for you if you were to use something like
    c++ bindings, mysql and php, python, or pearl as the mud languages for
    scripting..

    I can tell you when changes have been made to the g++ compiler over the
    years I have spent more time fixing my bison grammar and c++ problems with
    the file systems then I have actually adding to the game.  You want to make
    the base code easy enough to upkeep that you will have time to add features
    to the game for your users.  I just don't want to see you get to where I am
    and have to re-engineer your game server while your players wait for those
    features they have been asking for.


    Ken


    -----Original Message-----
    From: programmingblind-bounce@xxxxxxxxxxxxx
    [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Bill Cox
    Sent: Sunday, July 12, 2009 12:49 PM
    To: programmingblind@xxxxxxxxxxxxx
    Subject: Re: game development question:reading and writing game data to and
    from files

    In general, for complex databases, I prefer to write custom
    reader/writers using bison/flex.  An ASCII file that mirrors your
    classes well has many advantages.  You can edit it easily, and it's
    fairly simple to maintain backwards compatibility with previous
    versions.

    Bill

    On Sun, Jul 12, 2009 at 12:39 PM, Tyler Littlefield<tyler@xxxxxxxxxxxxx>
    wrote:

      hmm, so I would store the pointer to an int/string/double.

      I need to be able to tell what it is though, no?



      ----- Original Message ----- From: "Sina Bahram" <sbahram@xxxxxxxxx>

      To: <programmingblind@xxxxxxxxxxxxx>

      Sent: Sunday, July 12, 2009 10:36 AM

      Subject: RE: game development question:reading and writing game data to

    and

      from files





        The map definitely handles this bro.



        Just don't make it a map of primative to primative, make it a map of

        primative to object. That object can be of any type you like.



        Take care,

        Sina



        ________________________________



        From: programmingblind-bounce@xxxxxxxxxxxxx

        [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Tyler

        Littlefield

        Sent: Sunday, July 12, 2009 12:18 PM

        To: programmingblind@xxxxxxxxxxxxx

        Subject: game development question:reading and writing game data to and

        from

        files





        Hello all,

        I've started work on a custom mud, and am trying to figure something 
out.

        Each player will have a set of keys that will be stored, name, connect

        time,

        creation time, etc.

        I was thinking of storing these in a map, but that requires that the map

        hold multiple values; something which the c++ map doesn't do.

        So, I'm trying to figure something out.

        I'd like to be able to store player data, and a list of the player's

        inventory so the objects can be recreated when the player connects

        somehow.

        I would need to store object type, name, etc etc.

        I'm not quite sure how I could achieve this easily; I could possibly

        itterate through the map once I've gotten the data type thing figured 
out

        and do something like write key=value.

        Then when I loaded it I could just strtok on the = and set that up, but

        I'm

        not quite sure how I'd handle inventory and that.

        This is the only snag I'm having so far, and I'm not able to move on

        without

        it, as I'm to the point where I need to start saving player data, so 
help

        would be really appriciated at this point. :)

        Thanks,



        __________

        View the list's information and change your settings at

        //www.freelists.org/list/programmingblind





      __________

      View the list's information and change your settings at

      //www.freelists.org/list/programmingblind





    __________
    View the list's information and change your settings at
    //www.freelists.org/list/programmingblind

    __________
    View the list's information and change your settings at
    //www.freelists.org/list/programmingblind

    __________
    View the list's information and change your settings at 
//www.freelists.org/list/programmingblind


Other related posts: