Some More Jewel Game Clones (Work In Progress)

KevinCrossKevinCross London, UKMember Posts: 1,894
edited September 2013 in Working with GS (Mac)
Unfortunately this Bejewelled clone template has taken a lot longer than I hoped, and there's still a way to go but I am working on it.

I think I'll be sharing it again for free once it's finished, even though this one has been a lot more complicated then the last. However I'm not going to be able to make it public until the loops have been improved in GameSalad, because at the moment it takes too long to loop through 64 iterations which is why in the video below you see a delay before the jewels are destroyed. I've tried it with a timer, an alternative to a timer someone sent me a little while ago, and the loop behaviour in the nightlies. I'm hoping the loop behaviour will be fixed in the next version of the nightly because I have a game idea that I want to build myself with this template.

This one has been set up a little different from the last template because this time I'm looping through a table.

What I need to work on next is filling in the empty slots in the grid when jewels are destroyed.

«13

Comments

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    @imGua if I want to make a clone, I will!
  • alexconsincalexconsinc Member Posts: 54
    @KevinCross Looks awesome!
  • brickamatorbrickamator Member Posts: 316
    I really want this template to make a async multiplayer candy crush saga.
  • LumpAppsLumpApps Member Posts: 2,881
    @imGua if I want to make a clone, I will!
    If its going to result in people posting pictures like above then I have to disagree.
    Sjee, that will keep me awake for a while :)
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    If its going to result in people posting pictures like above then I have to disagree.
    Sjee, that will keep me awake for a while :)
    I thought the picture was a bit harsh to be honest but oh well, I will continue with it regardless as to what others think about clones, because someone may find it useful

  • brickamatorbrickamator Member Posts: 316
    I will. Thanks for you hard work.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    Thanks to someone that PM'd me I was able to adapt a suggestion they made to check for adjoining jewels instantly without loops and in doing so created another game type. Does anyone know what type of game this is please? I know it's not Bejewelled but I've played it before, and remember seeing someone here create a version months ago.

    If you can let me know the game type I will rename the file accordingly, add in notes and upload it as it is as another starting template before taking what I've learnt from this one to create a Bejewelled clone/template.

    I love how fast it is :)

    P.S. I reloaded it a couple of times to show the jewels dropping in the grid, the destroying of jewels starts about 8 seconds into the clip. The white boxes that show before the jewels are destroyed are there for testing purposes. In the final game they would be invisible.

  • brickamatorbrickamator Member Posts: 316
    Block braker? Really want to download this!!!
  • brickamatorbrickamator Member Posts: 316
    By the way, I like the candy crush saga better. Will this still be posible?
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    @brickamator I do intend to continue with the Candy Crush Saga/Bejewelled clone, and I will make this Block Breaker one available either today or tomorrow. It'll be basic like shown in the video and will require you to put in scores, menus and any extra bells and whistles :)

    I need to set it so that you can choose the minimum number of blocks need to be adjoining before they're destroyed which should be easy enough.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    Here's the block breaking project: http://www.kevincross.co.uk/?attachment_id=151

    Enclosed is a README.pdf and the project has notes throughout it. What's missing from this (aside from the obvious like menus and scoring) is that it does not refresh the grid if there aren't any possible moves. You might be able to use what's in the project to check through the grid or even loop through the table regularly.

    It has the option to set the minimum number of blocks that need to be adjoining before they're destroyed.

    If I update the project in the future I will update the file in the same location. Next on the list is the Bejewelled clone.

    This is a nightly only build. It will probably open in 10.3 and 10.4 but for some reason it runs painfully slow in both of those versions, yet blisteringly fast in the nightly build.
  • MillionairAppsMillionairApps Member Posts: 110
    It's coming along nicely, might want to give some credit to the guy :) He knows how to get things done and thinks "outside the box". But anyhow cheers for sharing.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    @MillionairApps I chose not to mention their name for other reasons, not to take credit for it myself :) But ok, thanks to an idea given to me by @Jeromy where he mentioned he set up something with two collision detecting actors to check the jewels 1 square around it I was able to come up with something similar, and was able to spread the search out further in the grid.

    Apologies to anyone that has recently downloaded it and opened it in GameSalad 10.3 or 10.4 and found it really slow/buggy. I originally created it in the nightly build where it worked fine, but decided to convert it over to 10.4 as it isn't using things like loops and the first couple of times I tried it it seemed fine but after a while noticed a couple of settings not quite copied across correctly and that it was painfully slow.

    I've since updated the zip file (about 6 minutes ago).

    I have no idea why the nightly is running much quicker than 10.3 and 10.4. I'm going to continue sticking with the nightlies from now on.
  • brickamatorbrickamator Member Posts: 316
    Thanks
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879
    Nice!

    I like that it does not take any timers to loop through the table. And that is an interesting technique for checking adjacent squares.

    Have you thought about using the table exclusively to check adjacent squares. That eliminates the need to spawn any actors and can be an efficient method too.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    @RThurman, in my last jewel template http://forums.gamesalad.com/discussion/59895/jewel-drops-a-basic-starting-template-you-might-find-useful I used self attributes on each jewel to store the table cells value of 8 jewels surrounding it i.e. 2 left, 2 right, 2 up and 2 down.

    That worked fine in that template but I was experiencing problems with it when I was working on a Bejewelled template, problems I might still experience with this new approach (hopefully I don't). Ideally I need to be able to destroy jewels and still be able to swap other jewels while those are being destroyed, which is something I've not been able to achieve with loops and relying on values in the table due to speeds and delays.

    I imagine I'm going to need to do some full table reads when it comes to checking whether or not it's possible to make any more moves so it may end up being a mix of different methods.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,879
    @KevinCross -- yes, I like what you are doing. And I'm certainly not trying to tell you that you should approach it differently.

    I was just thinking out-loud that you can do the same kind of algorithm with tables that you are doing with spawned actors. And you still wouldn't need to worry about loops or timers. (Just like you don't need to worry about loops with the spawning actor approach you are using.) It's the same algorithm. It's just done by referring to table cells to designate which actor to test (rather using spawned actors).

    It was just an idea. But I like your approach. Its all good!
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    @RThurman, I wasn't being all defensive, honest :) I was just saying I didn't have much luck with it but that could just be because the project was starting to get a little messy.

    I woke up at about 4am this morning with an idea how I can adapt the spawning method for a jewel swapping game which I'll be looking at soon :)

    I'm not sure if it was a coincidence I woke up at the same time I had the idea, or if I was dreaming about GameSalad before waking. The latter possibility is slightly worrying >.<
  • POMPOM Member Posts: 2,599
    edited September 2013
    Hey @KevinCross
    Nice work on your template!
    Im making match 3 type of game also at the moment.

    I see and follow your progress, and recently I read you have a new technique of detecting matches while abandoning the loops and the tables, If it works for you then carry on with it, but I want to remind you (just in case you forgot due to the enthusiasm of making a game) to keep thinking forward about the game/template, meaning, match 3 is an array type of game, while you have a current state of the array, and the game mechanics is making decisions based on that current state, whether if its activating power ups, finding special shapes of matches, finding possible matches etc, and making all of these without an array to hold the board data, might be extremely difficult, myself, I have more then one array of the board,for each state, have the board array, and the tmpBoard array, while the tmpBoard array is remained untouched, and the board array is being contaminated with special bread crumbs, like 0 for popped, -4 for 4 in a row/col
    -5 for 5 in a row/col , -6 for T shape.. you got the point.

    Now, I guess (and its just a guess) the reason you neglected the loops and arrays was due to the long time it takes for loop to finish, correct me if im wrong cause otherwise I dont see any other reason to not using loops.
    See, the way loop is triggered is frameBased , meaning, if your game is working at steady 60 fps, then the loop will fire 60 times per sec, the lower your frame rate, the slower your loop will fire (this is not official, these are just my findings), so say you have a 8x8 board, that means 64 'gems' to check, which will take more then a second ( and thats on a perfect world when your game runs at 60 fps), thats just too much, thanks to @FryingBaconStudios (AKA the GS Guru) help and findings, the better method will be to use 8 loops, one for each row, and another 8 loops, one for each column, running simultaneously, this way, you can scan 8x8 board TWICE (by rows and by cols) in just 8 frames, converting it to time, if your game runs at say 50 frames per sec, that means 0.16 sec to scan the whole board, (witch is VERY SLOW comparing to a real code loop, but since this is what we have at the moment in GS, its not bad at all and almost unnoticed)

    So, sorry for the long post, like I said if you like your new method, stick to it, but dont forget to think forward.
    Keep the progress posts coming.

    Cheers and good luck!
    Roy
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    Thanks @POM. That is correct I gave up on the loops due to my findings that it took a little over 1 second to loop through 64 cells. I did report it and the GS team said that they'd look at it, and that it should be an easy fix, so I'm hoping it will make it in to the next nightly.

    And thanks for the column and row loops suggestion, it'll definitely be an option that I will look at too. I need to be able to check regularly if the board is unplayable and whether or not it needs a refresh/reshuffle so I haven't given up on tables completely.

    Can I ask if you're using game phases to trigger each event please? i.e. something like this:

    phase 0: awaiting player action
    phase 1: selecting jewels
    phase 2: switching jewels
    phase 3: checking jewels
    phase 4: destroying jewels
    phase 5: falling jewels
    ...loop 3-5 until no more jewels have been destroyed
    ...and then loop back to phase 2 to switch them back if no jewels were destroyed, otherwise it goes back to phase 0.

    This is one of the several approaches I took but it stops you from switching two lots of jewels instantly because it can only ever be one game phase at any one time. In Jewel Mania you can switch the second set of jewels while the first lot is being destroyed. Trying to get something like this working a long with the slow loops made it unjoyable to build and play.

    I tried it without phases and things were triggering at the wrong time, probably because the project was getting a little messy. One of the biggest problems I had with game.phase was trying to get the game to register when no more jewels were falling and switch from that phase to another. This is something I could have achieved by looping through the table but it was already running slow enough.

    In theory the spawning collision detection actors should detect 3 or more blocks horizontally and vertically, if I tackle it the way I thought of early this morning, and because of the speed of it I won't need to have game.phases. However I haven't given much thought to power ups yet though. It's not that I've forgotten completely about them, it's more of a "I'll think about it later once I've got the basic game working smoothly." kind of thing :)

    By the way, the speed that yours runs in that video makes me sick! :P

  • VolontaArtsVolontaArts Member Posts: 510
    nice kevin! your doing some good stuff with this
  • POMPOM Member Posts: 2,599
    edited September 2013
    @KevinCross ,
    I use multiple booleans (I like working with booleans to trigger events), and not a single integer for the phases, but the end result is the same basically, I dont scan the board all the time, I only make a scan after the player swapped 2 gems, and after all the gems finished their falling down animation.
    As for the swapping, in my game, the player can NOT make another swap while the gems are in the middle of the fall, I admit, Ive been trying to achieve this effect and could not come up with a working algorithm, it made me nervous at first thinking that the players would want such a feature, but then I came across 'candy crush' which also not giving this option, so I was relief :)

    Roy.
  • FajlajpFajlajp Member Posts: 666
    @kevincros
    I can't download this template from your site. Could you pm me the file instead using dropbox or something like that? :)
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Thanks again for taking the time to answer @POM, it's all useful. I have to admit I've never played Candy Crush as I was put off by all the hype, but it's good to know they don't allow multiple events.

    @Fajlajp, sure I'll put it on Dropbox in an hour or two when I get into work.
  • FajlajpFajlajp Member Posts: 666
    edited September 2013
    Thank you so much :)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Yeah the best way to do loops or any large blocks is to break them up. I think a recycle method would work best for this type of game. Having all the blocks you need already on the scene. Each with their own unique ID and reporting to game level attributes for each place on the grid. Then the color et could be picked randomly by each block that is called on and use a numerical value to id type and grid location. If we could change tags at runtime this would be easier to tackle.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    @FryingBaconStudios thanks for your suggestions, I had an idea yesterday where changing the tags would have been useful but after testing it I noticed that it wasn't possible to do so. I can't remember what that idea was now though.

    I will definitely break up the loops for when it comes to checking the whole board for possible moves but I'm going to try and work with spawning collision detecting actors (my current approach) for when it comes to swapping jewels because I feel it would be quicker than loops and tables, and I quite like it the simplicity of it :) I just don't see it being practical for checking the whole board.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Yeah, right now this type of games in GS are tough to do. Without a more robust collision detection system where you can detect the area of the contact. The code get's pretty bloated. You'd have to build a stacked algorithm based on a grid with an integrated ID system that can me referenced against eachoher.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Look how fast this bad boy runs :)



    It only matches 3 or more horizontally at the moment, and for the purpose of the video I've set the grid to only show 2 colours so that there's more chance of it making those matches.

    It cycles through these game phases:

    1 = Fill grid
    2 = Check grid
    3 = Destroy
    4 = Falling
    ... back to phase 2 if number of jewels destroyed > 0
    5 = Awaiting player action

    I haven't set up phase 5 yet so you can't switch the jewels. I've been spending a very long time trying to get the other phases to run correctly and quickly, which I now think I've nailed.
Sign In or Register to comment.