Seed for grid based level

ArcticSquireArcticSquire Member Posts: 14
edited October 2015 in Working with GS (Mac)

Hello.

I'm trying to come up with a way to generate a grid/level from a seed.

I'm thinking of using a 6 x 6 grid with 3, possible tiles in each.
The seed for that would be 108 characters long, i doubt anyone would want to copy 108 char long seed.
(Any ways of shortening it?)

I thought a fun way would be to use words.
Separate the the grid into three 2 by 6 lines. and have each line represented by an english word.
The player would then just type in 3 words which is a lot easier & gives a kind of name to the level.

Any thoughts on how i could achieve this?

Thank you for your time,

Jordan

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited October 2015

    If you store all 108 possible combinations in table rows, you can just give the player a single number (e.g. 22 for row 22 of the table) and then generate the level from the column data. Or if you want words instead, tack on a column for the seed name and pick something simple ("lion", "tiger", "bear"). When they enter that seed name, search for that value in the table and use the resulting row as your level data.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2015

    @tatiang said:
    If you store all 108 possible combinations . . .

    If there are 3 possible tiles and 36 grid spaces then there would be over 150 quadrillion combinations (150,094,635,296,999,140). 108 is just the number of grid spaces, or the 'seed' (if each of the 108 characters / numbers represents 1 of 3 choices).

  • SocksSocks London, UK.Member Posts: 12,822

    I made a similar suggestion elsewhere recently, but your seed could be an angle (like 274.062deg), you could then extract the sin(angle) and use this for row 1, increment the angle by, for example, 123.456deg (so now we have 397.518deg) extract the sin of that for row 2, add another 123.456deg for row 3 and so on.

    You'do then do a simple bit of maths on each digit to bring it into range (to produce 1-3).

    This would given you an unknowingly complex series of numbers from a simple seed (274.062 or whatever angle you start with).

  • SocksSocks London, UK.Member Posts: 12,822

    @ArcticSquire said:
    I thought a fun way would be to use words.
    Separate the the grid into three 2 by 6 lines. and have each line represented by an english word.

    The problem with using words . . . (entirely depending on how you extract 1 of 3 values from each character) . . . is that some letters are massively over represented (e, t, a, o . . .) whereas others are much rarer (j, q, x, z . . .), which would skew tile frequency.

  • ArmellineArmelline Member, PRO Posts: 5,368

    108 seems excessive, you can create a seed very easily with 36 characters. If you're willing to do some leg work, that can be reduced down to a 9 character seed pretty easily.

    Just use letters, and if you want to keep it short, work out all the possible combinations of a 2x2 grid and assign each one a letter. Slit your grid into 9 "mini-grids" and that's 9 characters to represent the whole grid.

  • SocksSocks London, UK.Member Posts: 12,822

    @Armelline said:
    Just use letters, and if you want to keep it short, work out all the possible combinations of a 2x2 grid and assign each one a letter.

    You'd be short by 55 letters ! :smile:

  • kobayaashikobayaashi Member, PRO Posts: 143

    Sometimes I can feel as though I've just walked into a room where everybody is speaking in Serbo-Croat! Could somebody do me a favour, and direct me to some decent resources, so that I can learn what seeds are, why they're useful, and what I could possibly do with them? Muchas gracias in advance! :smile:

  • ArmellineArmelline Member, PRO Posts: 5,368

    @Socks said:
    You'd be short by 55 letters ! :smile:

    Why? Each 2x2 grid would need to accommodate only the possibilities within that grid.

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2015

    @Armelline said:
    Why? Each 2x2 grid would need to accommodate only the possibilities within that grid.

    There would be 81 possibilities, each of the 4 grid squares can contain 1 of 3 possible tiles (3 x 3 x 3 x 3 = 81).

    You can also extract the overall possible combinations number I mentioned earlier (to tatiang) from this:

    81 x 81 x 81 x 81 x 81 x 81 x 81 x 81 x 81 = 150,094,635,296,999,140

    That's not to say you couldn't create a 9 character seed, but the character set couldn't be base 26 !

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited October 2015

    @Socks said:
    That's not to say you couldn't create a 9 character seed, but the character set couldn't be base 26 !

    I think you're misunderstanding what I'm proposing. Edit: I'm wrong. But you'd have 62 characters to play with, so you'd not be that much short :P

  • SocksSocks London, UK.Member Posts: 12,822

    @Armelline said:
    I think you're misunderstanding what I'm proposing. If you take the 6x6 grid and split it into 9 grids of 2x2, you have 9 grids that can be represented by one of 12 characters, giving a total of 9 characters.

    Yes ! :smile: I understand, I'm just saying that you'd need 81 characters (rather than 12) to represent all the possible combinations in a 2x2 grid (with 3 possible tiles for each position).

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited October 2015

    @Socks said:
    Yes ! :smile: I understand, I'm just saying that you'd need 81 characters (rather than 12) to represent all the possible combinations in a 2x2 grid (with 3 possible tiles for each position).

    Yes sorry, as I edited my last post to say I was completely wrong, way too little sleep last night! With 64 different letters (including numbers) to play with, it would still be pretty possible to stick to a 9 character seed if you branched into special characters.

  • SocksSocks London, UK.Member Posts: 12,822

    @Armelline said:
    I think you're misunderstanding what I'm proposing. Edit: I'm wrong. But you'd have 62 characters to play with, so you'd not be that much short :P

    Lol, near enough ! And what alphabet are you using that has 62 characters !? :smile:

  • ArmellineArmelline Member, PRO Posts: 5,368

    @Socks said:
    Lol, near enough ! And what alphabet are you using that has 62 characters !? :smile:

    A lower case and upper case letter aren't the same :P

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2015

    @Armelline said:
    Yes sorry, as I edited my last post to say I was completely wrong, way too little sleep last night! With 64 different letters (including numbers) to play with, it would still be pretty possible to stick to a 9 character seed if you branched into special characters.

    26 letters + 38 numbers !?

    I'm confused !

    :smiley:

  • ArmellineArmelline Member, PRO Posts: 5,368

    @Socks said:
    :smiley:

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
    a b c d e f g h i j k l m n o p q r s t u v w x y z
    1 2 3 4 5 6 7 8 9 0

  • SocksSocks London, UK.Member Posts: 12,822

    @Armelline said:
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
    a b c d e f g h i j k l m n o p q r s t u v w x y z
    1 2 3 4 5 6 7 8 9 0

    Ah ! I see !

    If only the intenational alphabet authority listened to my suggestion for lowercase numbers we'd nearly be in bussiness now.

  • SocksSocks London, UK.Member Posts: 12,822

    Why am I now thinking of Ouija boards ?

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited October 2015

    How about these? ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₀

  • SocksSocks London, UK.Member Posts: 12,822

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
    a b c d e f g h i j k l m n o p q r s t u v w x y z
    1 2 3 4 5 6 7 8 9 0 < > * & ^ % $ £ @ ! € # ¢ ∞ § ¶ • [ ]

    81 ! we're in business ! :smile:

  • ArmellineArmelline Member, PRO Posts: 5,368

    @Socks said:
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
    a b c d e f g h i j k l m n o p q r s t u v w x y z
    1 2 3 4 5 6 7 8 9 0 < > * & ^ % $ £ @ ! € # ¢ ∞ § ¶ • [ ]

    I'd go with < > ! @ $ % ^ & * ( ) # { } [ ] - +

    You don't want someone to have to press three keys at a time. That confuses people!

  • SocksSocks London, UK.Member Posts: 12,822

    > @Armelline said:

    You don't want someone to have to press three keys at a time. That confuses people!

    I think it's going to be a little confusing regardless ! :smiley: . . . EEi&[9lg£ . . .or s(<8^jQ{- . . . aren't that easy to remember ! I say go with angles, your seed need be little other than 32.70° or 115.92° . . . ?

  • SocksSocks London, UK.Member Posts: 12,822

    @Armelline said:
    How about these? ₁ ₂ ₃ ₄ ₅ ₆ ₇ ₈ ₉ ₀

    Lol ! :) At last my dream has come true ! :D

  • kobayaashikobayaashi Member, PRO Posts: 143

    Gentlemen, my head is bleeding, and it's all your fault...

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited October 2015

    @Socks corrected:
    If there are 3 possible tiles and 36 grid spaces then there would be over 150 quadrillion combinations (150,094,635,296,999,140). 108 is just the number of grid spaces, or the 'seed' (if each of the 108 characters / numbers represents 1 of 3 choices).

    See this is why math is no fun.

    :)

    Edit: I like how Vanilla Forums changes my devil into a smiley face. Can't get anything right today... lol.

    At least now you know that all you have to do is populate your table with all 150,094,635,296,999,140 possible combinations and then pull a row from that table and...

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    backs out slowly
    then quietly closes the door

  • ArcticSquireArcticSquire Member Posts: 14
    edited October 2015

    @Socks said:
    I made a similar suggestion elsewhere recently, but your seed could be an angle (like 274.062deg), you could then extract the sin(angle) and use this for row 1, increment the angle by, for example, 123.456deg (so now we have 397.518deg) extract the sin of that for row 2, add another 123.456deg for row 3 and so on.

    You'do then do a simple bit of maths on each digit to bring it into range (to produce 1-3).

    This would given you an unknowingly complex series of numbers from a simple seed (274.062 or whatever angle you start with).

    Sounds like a plausible idea. Im not the best with math, how would I create the angle?
    Say i do 9 rows of 6. so starting from 111.111 all the (base block type). I take that string and make it an angle. (repeat for all rows).

    Could i then combine all the rows? and do something similar to make one string of
    ---.---

    what would i do to reverse the sin(angle)?

    Thanks

    EDIT:

    I think i understand now. Not fully sure how id implement it though. Any help/ideas would be appreciated.

  • ArcticSquireArcticSquire Member Posts: 14

    The idea is that levels would be made, and then shared with the seed.
    So a random seed will probably give an unplayable.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited October 2015

    @ArcticSquire , attached is a project with a word as seed.

    This uses some "lua pattern matching functions" to speed things up.

    How it works:

    1. Take the seed word (public key) and replicate it to fill at least 36 characters
    2. Mix in an app specific private key (see global attribute)
    3. Mod(6) the value of each of the 36 positions to pic one of the possible answer combinations from game.CellSeed
    4. Populate the grid when done

    Change the game.SeedWord in the Control actor to test

    Could be added (left out for simplicity):

    1. Offset the private key according to a letter combination from the SeedWord
    2. Speed up the loop in the control actor even more by processing each row at once, in stead of looping 36 times.

  • ArcticSquireArcticSquire Member Posts: 14

    @Hopscotch said:
    ArcticSquire , attached is a project with a word as seed.

    This uses some "lua pattern matching functions" to speed things up.

    How it works:

    1. Take the seed word (public key) and replicate it to fill at least 36 characters
    2. Mix in an app specific private key (see global attribute)
    3. Mod(6) the value of each of the 36 positions to pic one of the possible answer combinations from game.CellSeed
    4. Populate the grid when done

    Change the game.SeedWord in the Control actor to test

    Could be added (left out for simplicity):

    1. Offset the private key according to a letter combination from the SeedWord
    2. Speed up the loop in the control actor even more by processing each row at once, in stead of looping 36 times.

    Thanks for your time Hopscotch. Looks like it could be what i need.

    How would i set the "seed word".
    I've made an editor, to spawn the grid and edit the "tile type". I have a one column table with all the tile types (1-4) set from the editor. could you talk me through how id translate those into the seed?

    Heres what i have so far (excuse the sloppiness, I'm new)
    https://www.dropbox.com/sh/ut76nwws9t3ol9p/AABIxiM0Nm7LyqThMqiY_N1Ha?dl=0

    Thanks

Sign In or Register to comment.