Forum Multiplayer Need guidance for data files...

Discussion and help relating to the PlayerIO Multiplayer API.

Need guidance for data files...

Postby maharg » May 12th, 2011, 9:55 am

Basically, I'm making a board/card game and I want the the card attributes like point values, modifiers and what art to use in a separate file. I was thinking it would be between gameFS or bigDB, I kind of would prefer gameFS so I can edit it in a text editor rather than doing it through the bigDB ui. I suppose another option is to make an editor client that adds and modifies the data to bigDB. Anyway, I'm sure this has come up before but I was unable to find a clear answer on the forums. Guidance would be appreciated.

Thanks,
-J
maharg
 
Posts: 4
Joined: April 25th, 2011, 10:00 pm

Re: Need guidance for data files...

Postby WindieGames » May 12th, 2011, 10:40 pm

We used gameFS and an XML file. That way we could collapse the card structure in Notepad++ and it was really easy for us to find what we needed to edit and quickly re-upload it. That way it's all in one file and ready to download when the client starts up.

Code: Select all
<CARDS>

  <CARD id="card1">
    <STATS>
      <VALUE>20</VALUE>
      <VALUE2>25</VALUE2>
    </STATS>
    <ART>card1.png</ART>
  </CARD>

  <CARD id="card2">
    <STATS>
      <VALUE>36</VALUE>
      <VALUE2>15</VALUE2>
    </STATS>
    <ART>card2.png</ART>
  </CARD>

</CARDS>


Hope I understood what you meant and that this helped. :)
WindieGames
 
Posts: 35
Joined: January 30th, 2011, 1:36 am

Re: Need guidance for data files...

Postby cjcenizal » May 13th, 2011, 12:37 am

I use GoogleDocs spreadsheets as my editing tool. You can publish the spreadsheet as a CSV file, download it with PHP and store it on GameFS, and then load it into Flash.
cjcenizal
Paid Member
 
Posts: 115
Joined: March 29th, 2011, 12:31 am

Re: Need guidance for data files...

Postby maharg » May 13th, 2011, 3:34 am

Hey Thanks for the replies. This was exactly the type of info I was looking for.

WindieGames, can I use the xml parsers in C#, I read in the forums that it didn't work yet?

cjcenizl, thanks, I will look into that, a CSV file is pretty simple to parse so that may work for my needs.

-J
maharg
 
Posts: 4
Joined: April 25th, 2011, 10:00 pm

Re: Need guidance for data files...

Postby WindieGames » May 13th, 2011, 7:32 am

I'm not too sure since I havn't worked with XML server side, but if you download the xml file straight to the client you shouldn't have any issues.

After reading about the spreadsheet option, it sounds like a much easier way to handle data, although I'm not sure that flash natively handles spredsheets. If it does, then all the more power to ya!
WindieGames
 
Posts: 35
Joined: January 30th, 2011, 1:36 am

Re: Need guidance for data files...

Postby cjcenizal » May 13th, 2011, 7:41 am

Under the "Sharing" settings in a GDoc spreadsheet, you can choose to publish the GDoc as a CSV file, e.g. make it downloadable as a CSV via a URL. An example URL would look like this:

Code: Select all
https://spreadsheets0.google.com/spreadsheet/pub?key=0AnLTvwS_KynjdEt4emRcb7d8cn5OWMySTjdEt4emRRWZ0pkTVE&single=true&gid=0&output=csv


I wrote a PHP file to download these CSV files, which I then upload to my GameFS account. The PHP looks like this:

Code: Select all
function downloadCSV( $location, $filename ) {
      $data = file_get_contents( $location );
      $file = fopen( $filename, "w+");
      fputs( $file, $data );
      fclose( $file );
      echo "saving from ".$location."<br />";
      echo "saving to ".$filename."<br />";
      echo "<br />";
}


Then, I use this AS3 CSV parsing library (http://code.google.com/p/csvlib/wiki/QuickStart) to parse the CSV into objects my game can work with. It's a bit circuitous, but you are right about using the GDoc spreadsheet -- it's a really handy editing tool! My biggest problem with XML is the extensive markup it requires. CSV is nice and simple. :)
cjcenizal
Paid Member
 
Posts: 115
Joined: March 29th, 2011, 12:31 am


Return to Multiplayer