A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: [AS3] Enemy Database

  1. #1
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693

    [AS3] Enemy Database

    Without loading from any external files, does anyone have any suggestions as to what the best way to store a large amount of enemies' stats, name, skills, et cetera?
    mmm signature

  2. #2
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    xml?
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  3. #3
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    I thought XML was only used by loading external files, am I incorrect in that assumption? I can't seem to find any examples of XML within AS files...
    mmm signature

  4. #4
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    save where?,- if its on the internet perhaps better inside a databse like using mySql /php and flash. Or in combination AMFphp.

    XML would be my choise as well if its just offline and local- because its easier to handle alone with flash.

  5. #5
    Senior Member Sietjp's Avatar
    Join Date
    Jan 2005
    Location
    Paris, France
    Posts
    711
    If you are using flex you can embed xmls in your swf.
    If you are using cs3, you have to create a .as containing the data. It should be possible to create a string containing the Xml data in this class.

  6. #6
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,377
    Personally I try to keep every server side, so preferably, I'd go with a single Data class of sorts with a look up table embedded therein. If that wasn't an option (like you wanted longer-term saving) I'd go with php/MySQL 100%.
    The 'Boose':
    ASUS Sabertooth P67 TUF
    Intel Core i7-2600K Quad-Core Sandy Bridge 3.4GHz Overclocked to 4.2GHz
    8GB G.Skill Ripjaws 1600 DDR3
    ASUS ENGTX550 TI DC/DI/1GD5 GeForce GTX 550 Ti (Fermi) 1GB 1GDDR5 (Overclocked to 1.1GHz)
    New addition: OCZ Vertex 240GB SATA III SSD
    WEI Score: 7.6

  7. #7
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    If you're storing it internally ( External xml would be a lot better, that's why everyone's mentioned it already ) and not using as3 then just store them as objects and shove them in an external .as file(s)

    Squize.

  8. #8
    FK founder & general loiterer Flashkit's Avatar
    Join Date
    Feb 2000
    Location
    Sydney
    Posts
    1,149
    Quote Originally Posted by Sietjp
    If you are using flex you can embed xmls in your swf.
    If you are using cs3, you have to create a .as containing the data. It should be possible to create a string containing the Xml data in this class.
    TELL ME TELL ME TELL ME pleeeese how to do this
    Ive recently moved to flex for my dev environment and I will never go back... its awesome... now If I can learn how to embed all my xml data inline... my life will be somehow complete....
    Regards Mark Fennell - Flash Kit Founder, general loiterer
    -------------------------------
    I Hate Zombies - iPhone Game | markfennell.com

  9. #9
    Senior Member Sietjp's Avatar
    Join Date
    Jan 2005
    Location
    Paris, France
    Posts
    711
    You can use this
    PHP Code:
    <mx:XML id="xmlSource" source="data.xml"/> 
    or also the embed tag I think
    PHP Code:
    [Embed(source="data.xml")] 

  10. #10
    Senior Member hatu's Avatar
    Join Date
    Jan 2007
    Posts
    480
    I would probably make an associative array and fill it with Enemies.
    You know make a Enemy class with the properties you need like HP, ATTACK, etc.

    enemies["imp"] = new Enemy("Imp", 100, 10, 300);

    Simple and beautiful and useful because you can extend the Enemy class further and get everything needed with one line from the array.
    Last edited by hatu; 10-07-2008 at 01:08 PM.
    http://hatu.biz
    Portfolio & games

  11. #11
    Flash Incompetent ChaseNYC's Avatar
    Join Date
    Jun 2002
    Location
    new york city
    Posts
    693
    I decided to go with XML for now, as it seems to do the job. Currently it's being loaded from an external file but I'm curious just for hypothetical(if I were to EVER finish a game) and I wanted to upload to a site like newgrounds, I presume they don't accept xml files separately, so my xml would have to be in a dedicated location and I'm curious if that's true, would I have to worry about bandwidth? (not that I'm saying my game would be so awesome that I'd have billions of views, just curious if its something one would have to take into consideration)

    Anyways, thanks for all the input, feel free to continue discussing!

    ChaseNYC
    mmm signature

  12. #12
    Student
    Join Date
    Apr 2001
    Location
    -
    Posts
    4,756
    if the server is crap,- just upload the xml on your server. Be sure though to add the server policy XML file too otherwise you can't load data from other servers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center