A Flash Developer Resource Site

Results 1 to 17 of 17

Thread: [HELP] Password alternative to saved games

  1. #1
    Member
    Join Date
    Dec 2007
    Posts
    37

    [HELP] Password alternative to saved games

    Hey all:

    I'm working on a Flash-based adventure game with Flash Lite phones/PDAs as its main target, and playing online as its secondary target. Since I can't realistically allow for saved games, I thought I might do the old Nintendo style of having an access code to return to a previous spot. Here's a simple example of what I'm thinking.

    1. Each area you can occupy has a corresponding number (i.e. the antiques store is 12, the apartment is 28, etc.)

    2. Each item you could possess, event that could have occurred, or knowledge you could obtain, has a corresponding "yes" or "no" variable (i.e., you have the car keys, you've been told your doctor is dead, etc.) So carkeys=0 means you don't have the keys, and carkeys=1 means you do, and doctordead=0 or 1 as well.

    Let's say you're at a point in the game in which you're at your apartment, you have the keys, but don't know your doctor is dead. If you press quit, it will give you the following code:

    2810 (as in, location 28, yes to keys, no to doctor)

    In the future, if you want to come back to that part of the game, you would enter 2-8-1-0 after the game loads. So I'd need to break apart this entered code and set the variables, and it would be like you left off.

    I'd also have to have some code to prevent impossible positions. For example, suppose someone mistyped the code as 2801, but in the game it would have been impossible for you to get to your apartment if you didn't have the car keys.

    Now, to keep the number small, I'll likely have "levels" of the game which you could only obtain if you had acheived certain benchmarks/items. So lets add a number to the front of 2810 representing these levels. If you couldn't get to level 3 without having your keys and knowing your doctor is dead, then there's no point in the last two numbers of 3-2-8-1-0 to denote keys and doctor, because that's redundant. So lets free these up for other items, such as "found the body" and "purchased the gun".

    If someone types 22810 in the code box, that means you've achieved level 2, you're at the apt., have the keys, but don't know the doc is dead. If someone types 32810 in the code box, that means you've achieved level 3, you're at the apt., you have the keys, you know the doc is dead, you've found the body, but you haven't purchased the gun. See what I mean?

    The code would have to include something along the lines of:

    Code:
    if first_number_of_code = 2
      then carkeys = fourth_number_of_code
        and doctordead = fifth_number_of_code
      
    if first number of code = 3
      then carkeys = 1 and doctordead = 1
        and bodyfound = fourth_number_of_code
        and boughtgun = fifth_number_of_code
    Has anyone done anything like this and/or could see any problems with this approach?

    Thanks!

  2. #2
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    marmotte did this in a game he had a wile back.
    only recommendation i can think of is to use bits rather than numbers to make the code as small as possible.
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  3. #3
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Actually, bits would make it longer, not shorter. I suggest hexademical.

    Also it might be the case that you can do that bit shift thing they do with colour values to extract the red, green and blue components from one bigger value. Might help you store more information into a smaller space, or at least make it harder for people to hack the save files.

    Also, I think Flash Lite 2.1 does have SharedObject support?
    http://www.birchlabs.co.uk/
    You know you want to.

  4. #4
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    why would bits make it longer?
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  5. #5
    Pumpkin Carving 2008 ImprisonedPride's Avatar
    Join Date
    Apr 2006
    Location
    Grand Rapids MI
    Posts
    2,378
    The problem I see here is that other codes WILL work... If I was at 2810 when I left, but I came back and put in 36111111111, what would happen? I'd be in room 36, with any item checked for in my inventory.

  6. #6
    FK founder & general loiterer Flashkit's Avatar
    Join Date
    Feb 2000
    Location
    Sydney
    Posts
    1,149
    checksum it.... create a number say 2810 then add to the end a checksum say the total of the character codes of each number added up, then you can check to make sure the number is valid, if its valid then process it.

    so 2810000129
    where the 0000129 is a padded numercal value of say hte charCode(2) + Charcode(8) .... for example
    Regards Mark Fennell - Flash Kit Founder, general loiterer
    -------------------------------
    I Hate Zombies - iPhone Game | markfennell.com

  7. #7
    Member
    Join Date
    Dec 2007
    Posts
    37
    Quote Originally Posted by ImprisonedPride
    The problem I see here is that other codes WILL work... If I was at 2810 when I left, but I came back and put in 36111111111, what would happen? I'd be in room 36, with any item checked for in my inventory.
    Yeah, I'd definitely want to make it less obvious than that. It'd have to APPEAR random, at any rate. Maybe some items would be 5=yes and 9=no, or 3=yes and G=no, etc.

  8. #8
    Member
    Join Date
    Dec 2007
    Posts
    37
    Quote Originally Posted by Flashkit
    checksum it.... create a number say 2810 then add to the end a checksum say the total of the character codes of each number added up, then you can check to make sure the number is valid, if its valid then process it.

    so 2810000129
    where the 0000129 is a padded numercal value of say hte charCode(2) + Charcode(8) .... for example
    Wait... I think you lost me there.

  9. #9
    Member
    Join Date
    Dec 2007
    Posts
    37
    Quote Originally Posted by BlinkOk
    marmotte did this in a game he had a wile back.
    only recommendation i can think of is to use bits rather than numbers to make the code as small as possible.
    Ah, I see -- I found a marmotte quote that talked about MegaMan:

    http://www.mmhp.net/Passwords/PassCrack4.html

  10. #10
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Quote Originally Posted by BlinkOk
    why would bits make it longer?
    Room '255' expressed in bits would be:

    11111111

    The same room expressed in hex would be:

    FF

    So the larger the base you use, the shorter your code will be.
    http://www.birchlabs.co.uk/
    You know you want to.

  11. #11
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    i meant expressed not displayed.
    for example if he had 16 rooms and 16 objects he could easily express that as one byte rather than 9999. i prolly should have said "bit mask" rather than "bits"
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  12. #12
    DOT-INVADER marmotte's Avatar
    Join Date
    May 2002
    Location
    Dot-Switzerland
    Posts
    2,601
    Quote Originally Posted by symphy
    Ah, I see -- I found a marmotte quote that talked about MegaMan:

    http://www.mmhp.net/Passwords/PassCrack4.html
    YES!
    That was certainly a very old post, but yes, some Megaman games have their passwords "cracked", and they even explain how it works - it should be a good reference (there's also a password generator).
    I *think* that a game like Metroid has also been "cracked", and it looks even more complex, so if you find a place where they explain how it works, just be curious about it

    (I cannot believe that Blink remember about that btw. It was for the game "Forgotten Myths" :P )

  13. #13
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    Doesnt Flash Lite support Shared Objects?

  14. #14
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182
    Go with shared objects, your method is way too error-prone, either on your or the clients side.

    http://livedocs.adobe.com/flashlite/...49.html#261961

  15. #15
    Member
    Join Date
    Dec 2007
    Posts
    37
    Quote Originally Posted by tonypa
    Doesnt Flash Lite support Shared Objects?
    Hey, I didn't know you were on this board! I just assigned homework to my web and graphic design students to review your tutorials for tile games!

  16. #16
    When you know are. Son of Bryce's Avatar
    Join Date
    Aug 2002
    Location
    Los Angeles
    Posts
    838
    Since this is a Flash Lite thread... I've been wondering. Which phones support Flash Lite?

    Is Flash Lite built into the phone? Does it have to have Windows on the phone?

  17. #17
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,223
    For devices with FL support:
    http://www.adobe.com/mobile/supported_devices/
    Of course most things only have FL1 and wont never be upgraded to FL3.

    Windows is not required for it.

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