Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Asset pack] Tile Flipper development

Discussion in 'Works In Progress - Archive' started by CharlieSamways, Mar 13, 2012.

  1. CharlieSamways

    CharlieSamways

    Joined:
    Feb 1, 2011
    Posts:
    3,424
    Brief

    Currently, Me and fellow unity user Daniel Quick are working on an asset pack for the asset store. the asset pack it self will be a completed game in which you flip the tiles and the aim is to get all the tiles facing the correct way up. The pack will be priced from $5-$15 depending on the contents of the final piece, and also may extend higher if we manage to create it iOS ready. This project is just as much educational based for me and Daniel as it is commercial and we hope that it provides of use to the community. And we hope you follow us through the creation stages and support us as well as give critism and feedback,

    We are aiming to include:

    -Approx 100 levels of varied difficulty
    -Two polished, clean, visual great themes
    -Full and thorough documentation
    -Android ready
    -Full kitted GUI

    How the game is played
    The game is played by flipping tiles which in turn flip all adjacent tiles. In 'image' form:

    OOO
    OOO
    OOO

    Flipping the center tile will do this:


    OXO
    XXX
    OXO

    The game will get progressively harder forcing you to make more flips and thinking more tactically to complete the level in X amount of turns. Another feature we will be implementing is expanded board sizing.


    Preparation

    Currently, We have prepped the game mechanics and now working on the art style and levels.

    First of all, I took the liberty of creating a basic console program to show the core mechanic of the game. You can find this file here and test:
    http://dl.dropbox.com/u/21992753/Tile_Flipper.exe.exe



    Alternativly if you are uncomfortable downloading an EXE file you can simply copy this code and re-produce the program yourself through VB:

    Code (csharp):
    1. Module Module1
    2.  
    3.     Sub Main()
    4.         Randomize()
    5.         Dim gamecomplete As String
    6.         Dim flip(9) As Integer
    7.         Dim selected As Integer
    8.         Dim turncount As Integer
    9.         turncount = 0
    10.         gamecomplete = "no"
    11.         Call setnum(flip)
    12.         Do Until gamecomplete = "yes"
    13.             If gamecomplete = "no" Then
    14.                 Console.Clear()
    15.                 Call game(flip, selected, turncount)
    16.                 turncount = turncount + 1
    17.             End If
    18.  
    19.  
    20.         Loop
    21.  
    22.  
    23.  
    24.  
    25.     End Sub
    26.     Sub setnum(ByRef flip() As Integer)
    27.         flip(1) = (Rnd() * 1)
    28.         flip(2) = (Rnd() * 1)
    29.         flip(3) = (Rnd() * 1)
    30.         flip(4) = (Rnd() * 1)
    31.         flip(5) = (Rnd() * 1)
    32.         flip(6) = (Rnd() * 1)
    33.         flip(7) = (Rnd() * 1)
    34.         flip(8) = (Rnd() * 1)
    35.         flip(9) = (Rnd() * 1)
    36.  
    37.     End Sub
    38.     Sub setnew(ByRef flip() As Integer, selected As Integer)
    39.         'NUM PAD 1'
    40.         If selected = 1 Then
    41.             If flip(7) = 1 Then
    42.                 flip(7) = 0
    43.             ElseIf flip(7) = 0 Then
    44.                 flip(7) = 1
    45.             End If
    46.  
    47.         End If
    48.  
    49.         If selected = 1 Then
    50.             If flip(4) = 1 Then
    51.                 flip(4) = 0
    52.             ElseIf flip(4) = 0 Then
    53.                 flip(4) = 1
    54.             End If
    55.  
    56.         End If
    57.  
    58.         If selected = 1 Then
    59.             If flip(8) = 1 Then
    60.                 flip(8) = 0
    61.             ElseIf flip(8) = 0 Then
    62.                 flip(8) = 1
    63.             End If
    64.  
    65.         End If
    66.  
    67.         'NUM PAD 2'
    68.         If selected = 2 Then
    69.             If flip(8) = 1 Then
    70.                 flip(8) = 0
    71.             ElseIf flip(8) = 0 Then
    72.                 flip(8) = 1
    73.             End If
    74.         End If
    75.         If selected = 2 Then
    76.             If flip(9) = 1 Then
    77.                 flip(9) = 0
    78.             ElseIf flip(9) = 0 Then
    79.                 flip(9) = 1
    80.             End If
    81.         End If
    82.         If selected = 2 Then
    83.             If flip(7) = 1 Then
    84.                 flip(7) = 0
    85.             ElseIf flip(7) = 0 Then
    86.                 flip(7) = 1
    87.             End If
    88.         End If
    89.         If selected = 2 Then
    90.             If flip(5) = 1 Then
    91.                 flip(5) = 0
    92.             ElseIf flip(5) = 0 Then
    93.                 flip(5) = 1
    94.             End If
    95.         End If
    96.        
    97.  
    98.         'NUM PAD 3'
    99.  
    100.         If selected = 3 Then
    101.             If flip(8) = 1 Then
    102.                 flip(8) = 0
    103.             ElseIf flip(8) = 0 Then
    104.                 flip(8) = 1
    105.             End If
    106.         End If
    107.         If selected = 3 Then
    108.             If flip(9) = 1 Then
    109.                 flip(9) = 0
    110.             ElseIf flip(9) = 0 Then
    111.                 flip(9) = 1
    112.             End If
    113.         End If
    114.         If selected = 3 Then
    115.             If flip(6) = 1 Then
    116.                 flip(6) = 0
    117.             ElseIf flip(6) = 0 Then
    118.                 flip(6) = 1
    119.             End If
    120.         End If
    121.  
    122.         'NUM PAD 4'
    123.  
    124.         If selected = 4 Then
    125.             If flip(4) = 1 Then
    126.                 flip(4) = 0
    127.             ElseIf flip(4) = 0 Then
    128.                 flip(4) = 1
    129.             End If
    130.         End If
    131.         If selected = 4 Then
    132.             If flip(1) = 1 Then
    133.                 flip(1) = 0
    134.             ElseIf flip(1) = 0 Then
    135.                 flip(1) = 1
    136.             End If
    137.         End If
    138.         If selected = 4 Then
    139.             If flip(7) = 1 Then
    140.                 flip(7) = 0
    141.             ElseIf flip(7) = 0 Then
    142.                 flip(7) = 1
    143.             End If
    144.         End If
    145.         If selected = 4 Then
    146.             If flip(5) = 1 Then
    147.                 flip(5) = 0
    148.             ElseIf flip(5) = 0 Then
    149.                 flip(5) = 1
    150.             End If
    151.         End If
    152.  
    153.         'NUM PAD 5'
    154.  
    155.         If selected = 5 Then
    156.             If flip(8) = 1 Then
    157.                 flip(8) = 0
    158.             ElseIf flip(8) = 0 Then
    159.                 flip(8) = 1
    160.             End If
    161.         End If
    162.         If selected = 5 Then
    163.             If flip(6) = 1 Then
    164.                 flip(6) = 0
    165.             ElseIf flip(6) = 0 Then
    166.                 flip(6) = 1
    167.             End If
    168.         End If
    169.         If selected = 5 Then
    170.             If flip(4) = 1 Then
    171.                 flip(4) = 0
    172.             ElseIf flip(4) = 0 Then
    173.                 flip(4) = 1
    174.             End If
    175.         End If
    176.         If selected = 5 Then
    177.             If flip(5) = 1 Then
    178.                 flip(5) = 0
    179.             ElseIf flip(5) = 0 Then
    180.                 flip(5) = 1
    181.             End If
    182.         End If
    183.         If selected = 5 Then
    184.             If flip(2) = 1 Then
    185.                 flip(2) = 0
    186.             ElseIf flip(2) = 0 Then
    187.                 flip(2) = 1
    188.             End If
    189.         End If
    190.  
    191.  
    192.         'NUM PAD 6'
    193.  
    194.         If selected = 6 Then
    195.             If flip(6) = 1 Then
    196.                 flip(6) = 0
    197.             ElseIf flip(6) = 0 Then
    198.                 flip(6) = 1
    199.             End If
    200.         End If
    201.         If selected = 6 Then
    202.             If flip(9) = 1 Then
    203.                 flip(9) = 0
    204.             ElseIf flip(9) = 0 Then
    205.                 flip(9) = 1
    206.             End If
    207.         End If
    208.         If selected = 6 Then
    209.             If flip(5) = 1 Then
    210.                 flip(5) = 0
    211.             ElseIf flip(5) = 0 Then
    212.                 flip(5) = 1
    213.             End If
    214.         End If
    215.         If selected = 6 Then
    216.             If flip(3) = 1 Then
    217.                 flip(3) = 0
    218.             ElseIf flip(3) = 0 Then
    219.                 flip(3) = 1
    220.             End If
    221.         End If
    222.  
    223.         'NUM PAD 7'
    224.  
    225.         If selected = 7 Then
    226.             If flip(4) = 1 Then
    227.                 flip(4) = 0
    228.             ElseIf flip(4) = 0 Then
    229.                 flip(4) = 1
    230.             End If
    231.         End If
    232.         If selected = 7 Then
    233.             If flip(1) = 1 Then
    234.                 flip(1) = 0
    235.             ElseIf flip(1) = 0 Then
    236.                 flip(1) = 1
    237.             End If
    238.         End If
    239.         If selected = 7 Then
    240.             If flip(2) = 1 Then
    241.                 flip(2) = 0
    242.             ElseIf flip(2) = 0 Then
    243.                 flip(2) = 1
    244.             End If
    245.         End If
    246.  
    247.         'NUM PAD 8'
    248.  
    249.         If selected = 8 Then
    250.             If flip(5) = 1 Then
    251.                 flip(5) = 0
    252.             ElseIf flip(5) = 0 Then
    253.                 flip(5) = 1
    254.             End If
    255.         End If
    256.         If selected = 8 Then
    257.             If flip(3) = 1 Then
    258.                 flip(3) = 0
    259.             ElseIf flip(3) = 0 Then
    260.                 flip(3) = 1
    261.             End If
    262.         End If
    263.         If selected = 8 Then
    264.             If flip(1) = 1 Then
    265.                 flip(1) = 0
    266.             ElseIf flip(1) = 0 Then
    267.                 flip(1) = 1
    268.             End If
    269.         End If
    270.         If selected = 8 Then
    271.             If flip(2) = 1 Then
    272.                 flip(2) = 0
    273.             ElseIf flip(2) = 0 Then
    274.                 flip(2) = 1
    275.             End If
    276.         End If
    277.  
    278.         'NUM PAD 9'
    279.  
    280.         If selected = 9 Then
    281.             If flip(2) = 1 Then
    282.                 flip(2) = 0
    283.             ElseIf flip(2) = 0 Then
    284.                 flip(2) = 1
    285.             End If
    286.         End If
    287.         If selected = 9 Then
    288.             If flip(3) = 1 Then
    289.                 flip(3) = 0
    290.             ElseIf flip(3) = 0 Then
    291.                 flip(3) = 1
    292.             End If
    293.         End If
    294.         If selected = 9 Then
    295.             If flip(6) = 1 Then
    296.                 flip(6) = 0
    297.             ElseIf flip(6) = 0 Then
    298.                 flip(6) = 1
    299.             End If
    300.         End If
    301.  
    302.  
    303.     End Sub
    304.     Sub game(ByRef flip() As Integer, selected As Integer, turncount As Integer)
    305.         Console.WriteLine("                                To play use the numpad")
    306.         Console.WriteLine("           Make all the sides = 0, Flipping one tile will flip all adjacent")
    307.         Console.WriteLine()
    308.         Console.WriteLine("                                      Turns: "  turncount)
    309.         Console.WriteLine()
    310.         Console.WriteLine("                                     "  flip(1)  "   "  (flip(2)  "   "  flip(3)))
    311.         Console.WriteLine()
    312.         Console.WriteLine("                                     "  flip(4)  "   "  (flip(5)  "   "  flip(6)))
    313.         Console.WriteLine()
    314.         Console.WriteLine("                                     "  flip(7)  "   "  (flip(8)  "   "  flip(9)))
    315.         selected = Console.ReadLine
    316.             Call setnew(flip, selected)
    317.        
    318.     End Sub
    319. End Module
    I Hope my code isn't to awful as an artist..



    Development

    From here, we have started to build the pack. so far we have a base build which contains the core mechanic of the game just like in the console version, Dan has put this together and now we are focusing on the design of the blocks and also the level difficulty.

    First build:

    -Basic mechanic
    http://dl.dropbox.com/u/17638504/Webplayers/TileGame/WebPlayer/WebPlayer/WebPlayer.html

    http://youtu.be/Y0ECLpSHAUU

    Please feel free to give us you're feedback on what levels (If any) you found difficult and which you think are in the wrong order.

    Currently doing:

    -Working on the level design
    -Working on test levels

    To do graphically:
    -Create UI
    -Finalize level design
    -Texture
    -Create other menus
    -Animate tiles

    To do programming:
    -Create necessary responses such as amount of turns taken
    -Timer
    -Level difficulty
    -game mode
    -other necessary programming such as camera movement




    Concept of tile design:

    Similar to that of a circuit board.

    I will be updating this thread over the next few days until the completion of this project on behalf of me and Dan, posting regular web builds and screenshots of development. I hope you to recieve some insightful feedback, and I thank you for reading.

    Kind regards

    -Charlie



    All programming by Dan
    All Art by me
     
    Last edited: Mar 13, 2012
  2. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Good luck mate, although I think 100 levels is probably a little crazy...

    There are only 512 (2^9) possible board combinations, and for all intents and purposes problems that are a rotation or a reflection of each other are the same puzzle, i.e. it's pointless to have two different puzzles like

    001 100
    001 100
    001 100


    With that in mind 100 levels is getting pretty close to every meaningful combination (i.e. you might as well just auto generate the puzzles).

    Why not include 20 or so graduated levels of difficulty and then a random puzzle generator? (I'm not sure if the 3x3 board is always solvable, but it should be pretty easy to write a program to determine if it is... wikipedia describes a general solver for the game http://en.wikipedia.org/wiki/Lights_Out_(game)#Light_chasing).

    Another extension would be to make the game board a flexible size, or even a flexible shape.


    - John A

    EDIT: You probably don't even need to create the 20 levels... you can probably get a pretty good estimate of difficulty just generating puzzles using a fixed number of moves from the final position. i..e. Easy levels are 2-3 moves, Medium are 4, and Hard 5+.

    PS: If you use use an integer as flags the you can replace all your switches with something like this:
    Code (csharp):
    1.  
    2.     public int state = 0;
    3.  
    4.     private int [] masks = {11,23,38,89,186,308,200,464,416};
    5.  
    6.     public void ApplyMove(int pos) {
    7.         state = state ^ masks[pos];
    8.     }
    9.  
    10.     public bool IsPositionLit(int pos){
    11.         return ((1 << pos)  state) == (1 << pos);
    12.     }
    13.  
     
    Last edited: Mar 13, 2012
  3. CharlieSamways

    CharlieSamways

    Joined:
    Feb 1, 2011
    Posts:
    3,424
    Thanks for the feedback John,

    Initially we were hoping to produce the 100 marker through the varies level type schemes. I,e, Larger boards, more tile faces ect ect. Although it may have been a pretty large judgement.

    To me, that chunk of code goes straight over my head :D but thanks for the advice, ill make sure Dan see's it.
     
  4. jedy

    jedy

    Joined:
    Aug 1, 2010
    Posts:
    579
    A cool level idea would be an unfolded rubick's cube.
    With a slight adjustments to the mechanics ( rubick's cube has row and column movement, not initial squares ) it would be awesome.
    I like the idea by the way - simple, portable and with great potential to become an addicting little game.
     
  5. CharlieSamways

    CharlieSamways

    Joined:
    Feb 1, 2011
    Posts:
    3,424
    Thanks for the response :) although im not sure what you mean by the rubix idea.
     
  6. jedy

    jedy

    Joined:
    Aug 1, 2010
    Posts:
    579
    Basically this :
    You have the standard flipper mechanic - when you click a square the adjacent squares flip too.
    And you have the thing I referenced a cube for - when you click a corner square, its neighbors flip, and the corresponding neighbors as if the whole thing was a cube ( Color markings on the image ).

    Adding even more complex rotation ( different colors ), may even mimic some of the rubick's cubes mechanics and result complex and interesting puzzles.
     

    Attached Files:

  7. CharlieSamways

    CharlieSamways

    Joined:
    Feb 1, 2011
    Posts:
    3,424
    Ahh thats a really nice idea, may be hard to implement on touch devices for control use but ill point it to dan, Thanks!
     
  8. CharlieSamways

    CharlieSamways

    Joined:
    Feb 1, 2011
    Posts:
    3,424
  9. CharlieSamways

    CharlieSamways

    Joined:
    Feb 1, 2011
    Posts:
    3,424
    -Bump

    Finally back to work on this.

    Split it up and were making it so we can increase and change the boardsize/shape.



    Texture time.
     
  10. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Dude, are you aware that the recent version of Blender is 2.62?
     
  11. CharlieSamways

    CharlieSamways

    Joined:
    Feb 1, 2011
    Posts:
    3,424
    Yes I am, are you aware my dell dimension 3100 can't run it :D
     
  12. nipoco

    nipoco

    Joined:
    Sep 1, 2011
    Posts:
    2,008
    Lol, no I wasn't.
    That is some bad luck.
     
  13. CharlieSamways

    CharlieSamways

    Joined:
    Feb 1, 2011
    Posts:
    3,424
    Indeed, im saving for a new desktop but things keep popping up unfortunately, luckily ive had no projects yet which have required me to use anything more than this for modelling.