Search Unity

Jewel Match Framework

Discussion in 'Assets and Asset Store' started by kurayami88, Aug 30, 2013.

  1. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    Do you check my last question on forum? I'm 2dTk user.
     
  2. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    whoops sorry i missed it ...

    1. Is it possible on "Unity2d" same as 2dTk mask?
    the 2dTkMask affects most (if not all) renderers ... meaning you can hide Unity2D sprites as well if i'm not mistaken :)

    2. Is it good for the performance(include drawcall) compared Unity2d to 2dTk
    they both should be good provided you atlas your assets.... 2dtk provide atlas-ing much easier for you.... while Unity2D does not provide atlas creation (not that I know of) ... you can still use atlas (manual configuration) in unity2D to achieve low draw calls :)
    ---------
    now, i havent tried the newer unity2D canvas so I cannot comment on that ....
     
    NeoUnity likes this.
  3. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    Now, JMFP is updated v3.0.1
    Thank you a lot:)
    In JMFP release>Manual update>Board diff... etc
    How check the difference(now and before) easily? The new method is radically different from the old.
    p.s. "Exam Diff" is not free.
     
    kurayami88 likes this.
  4. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    try
    http://www.diffnow.com
    :)
     
    NeoUnity likes this.
  5. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    In Runtime, by BoardType... Can i change NormalPiece's skins with one JMFP prefab?

    Board Type : Normal Piece Skin
    - Square : old (default)
    - Hexagon : new (change)
     
  6. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    I don't quite understand your question... but in any case, each custom PieceDefinition has two sets of skin... one for hex and one for square board type.... and there is a selector for auto-mode (uses both skin types according to boardType) or force square/hex skin list only :)
     
  7. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    It is not boardType... my mistake... Actually...I want to change normal Piece's skins on runtime
    Level 1 : default images + default logic
    Level 2 : my custom images + my custom piece logic
    Level 3,4... : default images + default logic

    JMFRelay.onPreGameStart() {
    if (wc.isMyCustomGame) {
    1) change NormalPiece skin or
    2) add MyNormalPiece+inactive NormalPiece
    .....???
    }
     
    Last edited: May 28, 2015
  8. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    unless you are not using scenes for each level (meaning, each level is a different scene) ...
    you can just swap the GameObjects used for the skins in the scene you want... the default will not be touched...
    same goes for specific custom PieceDefinitions you want... in the scene you want, just add it to the PieceManager and it will be unique for that scene only (unless you press the 'apply' button to the master prefab; which you shouldn't)
     
  9. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    These are your TODO lists.
    1. GameManager.boardRadiusDistance()
    // TODO squareMode not available in JMFP...
    // if(squareMode == squareMode.CrossType){ // specific for cross-type square
    2. Board.initNeighbourReferences()
    // TODO diagonal square neighbours disabled in JMFP

    What's the SqureMode or Box9x9Type?
    Does next update include these TODO list?
     
  10. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    Hi,
    these TODO list is a feature brought over from JSF ... it makes the neighbour references of topLeft topRight bottomLeft bottomRight available... with it enabled, will allow users to swipe in those directions as well (which is not correct) ... it is purposely disabled in JMFP...
    it is marked as TODO as bookmark that I disabled it :)
    you don't have to worry about it....
    what i actually need to do now is to further clean up the PoolManager codes... v3.0.1 has a broken poolManager... i would need to post a v3.0.2 to fix it.... sigh... but if you are not using poolManager, it does not affect you in any way :)
     
    NeoUnity likes this.
  11. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    I'm PoolManager user. I don't have been checked using PoolManager :oops:
    Cheer Up :)
     
  12. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    These images are same function on Famous Game "Free Fall" magic bottle(?) & "Cookie Jam" Cookie Cutter(!)
    - Would you make above function sample for newbie's studying about more custom script usage & save users times? Because old example samples are consist of truly basic functions except tresurePiece & portal panel
     

    Attached Files:

    Last edited: Jun 1, 2015
  13. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    Hi,
    I'm not sure what you are trying to ask/show....
     
  14. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    public class RoadPanel : PanelDefinition {
    public override void onPanelCreate(BoardPanel bp){
    Vector3 temp = this.transform.localScale;
    this.transform.localScale += new Vector3 (temp.x * 100, temp.y * 100, temp.z * 100);
    Debug.Log ("create"+temp.x);
    }

    public override void onGameStart(Board board){
    Debug.Log ("start"+temp.x);
    }

    1. How to change the panel scale for runtime? Because the scale is not changed.
    2. On checkind my debug, onPanelCreate is called twice than onGameStart. Is it right?
     
  15. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    you are using onPanelCreate wrongly....
    // *choose either backPanel/frontPanel gui depending on your setting...*

    Vector3 temp = bp.*backPanel/frontPanel*.transform.localScale;
    bp.*backPanel/frontPanel*.transform.localScale += new Vector3 (temp.x * 100, temp.y * 100, temp.z * 100);
     
    NeoUnity likes this.
  16. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    Example 3 - 6 gems 9*9 (portalA : 2 pieces, portalB : 3 pieces)
    - PortalA.syncPortals()
    int count =0 ; // amend add
    boardA.Clear(); // clears any old references before proceeding
    boardB.Clear(); // clears any old references before proceeding

    foreach(BoardPanel bpRef in portalA){
    for( int x = 0; x < gm.boardWidth; x++){
    for( int y = 0; y < gm.boardHeight; y++){
    if(gm.board[x,y].panel.pnd is PortalB){ // find the exit pair
    if(gm.board[x,y].panel.durability == bpRef.durability){ // matching exit pair
    boardA.Add(bpRef.master); // save the entry pair reference
    boardB.Add(gm.board[x,y]); // save the exit pair reference
    } } } } }
    count++; // amend add
    Debug.Log (count+" "+portalA.Count+" "+boardA.Count+" "+boardB.Count); // amend add
    }
    => console.debug :
    1 0 0 0
    2 0 0 0
    3 0 0 0
    4 1 0 0
    5 2 0 0
    6 3 1 1
    7 4 0 0
    8 5 0 0
    9 5 0 0
    ======================================
    I know It will be called by total Portal A & B on panel creating.
    1. I don't know why it needs 9 times check count. I hope to need 1 or 2 check times.
    2. potalA total count is 2 pieces. why 5? (portalA : 2 pieces + portalB : 3 pieces)
    3. I know boardA.Clear(),boardB.Clear() make 0 0. It also does 9 times.
     
    Last edited: Jun 3, 2015
  17. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    I dont understand why you are running diagnostics on the portal panels...

    the onPanelCreate is called each time a panel is created.... or rather, when the GUI object is being made...
    and the syncPortals() function is called by both portalA and portalB scripts...
    ---------
    the onCreate is called during initial board setup... as well as perhaps several other times when multi-panel is involved... the new portal scene includes the use of multi-panels...

    when the multi-panels overlap each other... the onCreate is called for the bottom panel before the top panel takes over... then called again when the top panel is destroyed... it will always be called whenever the panel is shown given the order of panel creation...

    it might sound confusing but that is the current system in place so far...

    ============
    FYI,
    I need to call the sync each time a portal panel is hidden or shown... to sync portal abilities.... portals can be disabled when a multi-panel is on top of it.... hence the demo ....
    when the top panel is destroyed to reveal the portal underneath it, the sync function is called to ensure that the portal is working correctly....

    there are a total of 6 portals in the scene (3 portal A and 3 portal B) .... and a there are 3 portals that are multi-panel ... 2 frosted and 1 walled .... so when the 6 portals are created, onCreate is called 6 times... then each time a portal is revealed by destroying the multi-panel, the onCreate is called again which then called the syncPortal() function...

    so 6 initial + 3 multi-panel = 9 calls... which is correct :)
     
    NeoUnity likes this.
  18. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    I hope to make famous panel(=rail?) like as below images(Candy Crush & Cookie Jam).
    I think that rail panel will be same as portal logic. But numbers of rail panels is many than portals.
    =============
    As users request, you have been making the new Pieces(Treasure) & Panel(Portal). Now, SubPanel(Wall) is fantastic!!!
    Could you make the rail(?) panels, then save the time for high-skilled user & many newbies?
     

    Attached Files:

  19. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    the rail requires moderate-high scripting....
    even if I were to offer it, it will probably be in the form of JXF-addOns....
    and I currently have other work to attend to now.... which also includes upgrading JSF with the sub-panels as well ( i havent even started upgrading it)...

    it will be quite awhile before i can get my hands on it ...
    you are welcome to try :)
    JMF / JSF kit is all about custom panels and pieces :D
     
    NeoUnity likes this.
  20. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    Hi!
    I've been using the JMF for a while now and it has been a real treat to work with. I've been able to add all my custom functionality to the engine and it has been preforming very well.

    As a final addition to my current build I want to have a 'demo mode' in which the game plays itself. I was wondering if there is an easy way to do this. I've thought about rewriting the 'Suggestion timer' to a self-playing device (as soon as it detects a new playable move, it plays it itself), but this might be tricky.

    I was wondering if you ever thought of this and / or what your thoughts were on the matter. Hope to hear from you.
     
    kurayami88 likes this.
  21. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493

    Hi,

    Thanks for the feedback :)
    just to clarify, do you mean an actual demo mode (with AI playing) or a tutorial mode to help new players?
     
  22. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    I mean an actual demo mode (AI playing without player interference). AI can be stupid as hell by the way, it's just to show a simple demo.
     
  23. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    Yes sure it can be done =)... I personally did a modification once ( long ago) ...
    What i can recommend is that you duplicate the game manager script... Then diaable the player interaction segment and modify the suggested piece segment of which instead of suggesting a piece, make the move instead...

    On how to make the move, remember the disabled player interaction segment? Just call the functions used there instead...

    All these only require moderate scripting as the functions are already in place mostly... =P

    =====
    P. S..> the suggest piece is not a smart system... It only scans for legal moves, not best moves... If you are fine with a "dumb" AI then the above suggested modifications should be just fine =)
     
  24. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    Thanks for the directions. I'll manage from here.

    Keep up the good work. All the best.
     
  25. jack021457

    jack021457

    Joined:
    Mar 18, 2015
    Posts:
    22
    Hi, I want to make a BOSS mode, How can I do it.
    thanks
     
  26. jack021457

    jack021457

    Joined:
    Mar 18, 2015
    Posts:
    22
    Hi,
    I have another question, how to move a custom panel in playing game. when I move once, the lock random move once too.
    thanks
     
  27. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    make a new custom panel (or piece) with your boss mode specifications.... will require moderate to high scripting depending on your coding skills and idea difficulty.

    how to move it? there isn't a 'ready-made' API call for it... you can do it manually by re-assigning the references...
    e.g.
    board[x,y].panel.removePanels(); // i think this is the correct API call, don't remember the exact name; removes current GUIs
    board[x,y].panel = board[x2,y2].panel; // swaps the panels
    board[x,y].panel.createPanels(); // inits back the current GUI
    board[x2,y2].panel = new BoardPanel(x,x,x); // makes a new panel since the old one was given away...

    just don't forget to remove the old GUIs and also init the new GUI ... as well as replace the reference for the missing panel...
    also, depending on the complexity of your panels and it's attributes/properties, you may also need to sync their values (if the values still refers to the old position rather than the new position)
     
  28. jack021457

    jack021457

    Joined:
    Mar 18, 2015
    Posts:
    22
    thank you very much, I will try it, thanks again
     
  29. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    forgot to mention that you will definitely need to sync the master reference of the panels if you swapped it manually...

    board[x,y].panel = board[x2,y2].panel; // swaps the panels
    board[x,y].panel.master = board[x,y]; // sync the master reference
     
  30. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    Is it possible JMFP change the BoardType(from square to hexagon) on runtime with same piece on same panel?
    If so, Please give me a little hint.
     
    kurayami88 likes this.
  31. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    Hi! I've tried your suggestion but I get a lot of conflicts as the GameManager class parses itself to a lot of other classes (Board.cs, JMFRelay.cs, etc). I get a lot of 'cannot convert GameManagerDemo class to GameManager class'. Casting doesn't work unfortunately.

    Is there a way to use the regular classes for Board and JMFRelay (and others) with the custom (renamed) GameManagerDemo.cs? I don't think it's a good idea to copy ALL the classes and customise them to use the GameManagerDemo.cs instead of GameManager.cs. I'm guessing there is a coding-trick (using aliases perhaps?), but I'm not that hardcore of a coder.

    Thank you in advance!
     
    kurayami88 likes this.
  32. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    technically yes it can be done.... just change it and call the gm.refreshBoardPosition(); *i think thats the correct name*

    make your GameManagerAI inherit from GameManager.... then it should be fine :)

    public class GameManagerAI extends GameManager {
    // etc
    }
     
    Last edited: Jun 16, 2015
    NeoUnity likes this.
  33. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    JMFRelay.onBoardStabilize () // your own stuff here...
    - add (for test)
    gm.boardType = BoardType.Hexagon;
    gm.refreshPosition();

    The Type is changed. But it doesn't work.
    => error :
    IndexOutOfRangeException: Array index is out of range.
    (wrapper managed-to-managed) object:ElementAddr_3_4 (object,int,int,int)
    Board.get_subPanelTopLeft () (at Assets/JMF PRO/Scripts/area 51/Game Manager related/Board.cs:90)
    GameManager.checkThisPosition (Int32 xPos, Int32 yPos, Int32 mType, Check dir) (at Assets/JMF PRO/Scripts/area 51/Game Manager related/GameManager.cs:1121)
    GameManager.checkThisPosition (.Board _board, Int32 type, Check dir) (at Assets/JMF PRO/Scripts/area 51/Game Manager related/GameManager.cs:1029)
    GameManager.checkNeighbourMatch (.Board temp, Int32 type) (at Assets/JMF PRO/Scripts/area 51/Game Manager related/GameManager.cs:997)
    GameManager.detectPossibleMoves () (at Assets/JMF PRO/Scripts/area 51/Game Manager related/GameManager.cs:735)
    GameManager+<updater>c__Iterator8.MoveNext () (at Assets/JMF PRO/Scripts/area 51/Game Manager related/GameManager.cs:634)
    UnityEditor.Toolbar:OnGUI()
     
    Last edited: Jun 17, 2015
    kurayami88 likes this.
  34. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    ah yes... the board's neighbour reference are different.... i'll get back to you on this....
     
    NeoUnity likes this.
  35. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    @NeoUnity

    try this code segment... ( add gm reference where needed as this was coded from within the GameManager)

    Code (csharp):
    1.  
    2. boardType = BoardType.Hexagon; // change type
    3.         refreshPosition(); // update position
    4.  
    5.         SubBoardPanel[,,] newSubPanelH  = new SubBoardPanel[boardWidth+1,boardHeight+1,2]; // create subPanels-H
    6.         for( int x = 0; x < boardWidth+1; x++) { // for the board width size
    7.             for( int y = 0; y < boardHeight+1; y++) { // for the board width size
    8.                 for( int z = 0; z < 2; z++) { // for the board height size
    9.                     newSubPanelH[x,y,z] = new SubBoardPanel(); // creates a new subPanel class
    10.                 }
    11.             }
    12.         }
    13.         // copy old to new
    14.         for(int i = 0; i < subPanelH.GetLength(0); i++){
    15.             for(int j = 0; j < subPanelH.GetLength(1); j++){
    16.                 for(int k = 0; k < subPanelH.GetLength(2); k++){
    17.                     newSubPanelH[i,j,k] = subPanelH[i,j,k];
    18.                 }
    19.             }  
    20.         }
    21.         subPanelH = newSubPanelH; // use new reference
    22.  
    23.         // sync back references
    24.         foreach(Board _board in board){
    25.             _board.allSubPanels.Clear();
    26.             _board.initNeighbourReferences();
    27.             _board.syncSubPanelReference();
    28.         }
    29.  
    30.         // ensure the panels are in the proper place
    31.         foreach(SubBoardPanel _sbp in subPanelH){
    32.             if(_sbp.spnd != null) _sbp.createPanels();
    33.         }
    34.         foreach(SubBoardPanel _sbp in subPanelV){
    35.             if(_sbp.spnd != null) _sbp.createPanels();
    36.         }
    37.  
    ===========
    unrelated... but it seems there is a error (bug) with the gravity check during hex layout when the top is blocked or something... will fix that another time unless ppl are experiencing it (then i have to make it top priority)
     
    NeoUnity likes this.
  36. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    @kurayami88
    It works well in reverse process.
    Thank you for your effort :)
     
  37. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    This had been written on Apr/2014. The MLM also has been updated continuously.
    Now, are you have a same decision?
     
    kurayami88 likes this.
  38. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    MLM sorta uses their own camera system....
    it's actually not bad.... recommended for users who don't mind what system is in use... as for me, i still like to do things my way :)
    but i must say that it is a powerful engine and a lot of feature are already in place that you can make use of :)
    it'll definitely save a lot of time rather than making your own approach from scratch ;)
     
    NeoUnity likes this.
  39. oneuppedgames

    oneuppedgames

    Joined:
    Jul 30, 2013
    Posts:
    15
    I figured that one out as soon as I typed the previous post :D
    Thanks for your support!
     
  40. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    MyWallSubPanel has 2 skin - wood & red color
    Red wall can be switchable when only red gem is switching.
    Wood wall can not switching all color's gems.

    1) red wall is pink gem(2,1)'s subPanelTop.
    2) red wall is red gem(3,0)'s subPanelTop.

    If so, Would you give me a little hint?
     

    Attached Files:

    Last edited: Jul 10, 2015
  41. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    a custom subPanelDefinition with the isSwitchable() function modified...
    foreach(Board master in sbp.masters){
    if(master.isFilled && master.piece.slotNum == *num you want* )
    return true;
    }
    return false;

    or something similar to that...
     
    NeoUnity likes this.
  42. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
  43. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    Wrapped Candy in Candy Crush Saga is formed by 5 candies of the same colour in a L or T shape like as Bomb in JMF. The explosion of both occurs one time.
    Wrapped Candy in Candy Crush Soda has two times of explosion continuously.
    Would you give me a hint?
     
  44. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    use a ienumerator function to set delays in the code execution.... then u can call it twice with the 2nd 1 over 'x' delay
     
    NeoUnity likes this.
  45. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    1. What's the your final decision among 3 articles of this above thread ?
    2. Would you let to know when's the v3.0 after May 5,2015?
     
  46. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    i don't understand your question....
    v3 is out for quite a long while already?
     
  47. NeoUnity

    NeoUnity

    Joined:
    Sep 4, 2013
    Posts:
    156
    OMG My mistake.
    2) i am thinking of dropping the JMFP 2D Toolkit support for future updates=> Are you have a decision for this?
     
  48. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    at the present moment... the current release of v3 had 2D Toolkit support as well :)
    will see how it goes .... if i decide to drop it, i'll inform again :D
     
    NeoUnity likes this.
  49. shoni-wheeler

    shoni-wheeler

    Joined:
    Oct 25, 2014
    Posts:
    102
    Hi Kurayami,

    Seems to be a bug if you set New Piece Mode to Appear, it does not always pick up a match.
    Plus if you use weighted pieces you can end up with a board of one piece.
    Plus you cannot use treasure Game as pieces do not drop.

    John
     
    Last edited: Jul 19, 2015
  50. kurayami88

    kurayami88

    Joined:
    Aug 30, 2013
    Posts:
    493
    will check on the Appear-mode...
    could you please elaborate on the weighted pieces with treasure game? what is happening and what is it not suppose to do or not do?