Battletech Live

Online, Turn-Based Battletech – Development Logs

Using Battletech Live to import / export documents.

Today, I was working on a method of accessing the local file system to import text files, to pull designs from The Drawing Board, MegaMek, Mechworks and such but I discovered a limitation of the system and came to the realization of the security benefits of the limitation.  Using Flash Player 10, users can load files from their local hard drive and push them to a web server or they can download files from a web server and save them to their local hard drive, but Flash is unable to manipulate those files directly.  A friend gave an example of a banking website with a flash-enabled loader.  You load an excel file to the server and the limitations ensure that no modifications have taken place. Thinking about it, the file interaction bit will provide solutions to several aspects.

So, here’s how it works.  On my development box, Battletech Live has an import link within The Mech Lab.  When the button is clicked, it displays a file browser where the user is given access to only the file types applicable to Battletech Live.  Upon file selection, Battletech Live takes that file and posts it to the server.  A php script is then called to parse the new file and after correct formatting is verified, it saves it to the database and displays the Mech data to the user.  If the design is found to already exist in the database, the user is told that the design already exists and asks the user if they want to display the loaded information.  After php has finished parsing the design, it deletes the stored file from the server.  Any time a design is submitted by Administrator, the design will be considered to be a base configuration.  Another php script will then be called to generate a PDF of the design, which is then stored on the server.  Submitted designs may be modified or deleted only by the owner of those designs, although existing designs may be referenced, modified and saved as new revisions as long as there exists a substantial dissimilarity.

The Mech Lab also contains a browse button, which allows the user to view all stored designs and provides them criteria to narrow the scope.  When the user selects one of the designs, the information is retrieved and displayed to the user.  If a user wants to export a PDF of a selected design, a script is called to determine if the design in question is of a base configuration.  If so, it can immediately be pulled from the server and present the user with a file browser to select a save location.  If the design is user-submitted, it is not considered base.  In this instance, a PDF of the design is generated and sent to the user.  Afterward, the PDF will be deleted from the server to conserve space.

The import / export methods will also be used to import avatars to be used by players and/or characters except these files will be stored long-term.  The player will be given the option of making the avatar public, private or guild.  When set to public, the avatar will be browsable by all registered users, who can then set that avatar as their own if they wish.  If the avatar is set to private, others will be able to see the avatar when the owner is referenced, but usage of the avatar will be reserved strictly for the owner.  Guild, will make the avatar available for anyone who is in the same mercenary guild as the owner.  Using the same rules as for designs, avatars can be deleted only by the user who owns the avatar, or by the administrator if the avatar is determined to be offensive.  Members of the community may flag avatars as offensive, sending an email to the administrator, who will then review the avatar and will either provide the image with an appropriate rating or remove it outright.

These methods also apply to the email and instant messaging system, allowing users to send files to other users as long as users understand that Administrator sees all and can moderate traffic sent through the system.

Advertisements

January 7, 2009 - Posted by | Project Development

1 Comment »

  1. Upon further experimentation, I have figured out a way to parse the text of a loaded file directly within Flash. I’m not sure whether this will make things easier or harder. I almost prefer to still have PHP do the parsing so that the swf file size is smaller, but I can verify the file structure before sending to php and pull bits out of it for various purposes.

    Comment by Charles Shoults | January 7, 2009


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: