mekonbekon's Recent Forum Activity

  • Yes please, Tom - really looking forward to this :-)

  • I put this together, which should work for you:

    dropbox.com/s/gavzxhalnxdur6n/probabilityTable.capx

    The data is in a json array file in the project settings and I import it into an array object using the AJAX object.

    If you run the project in debug you can check the a_fish object and see that the probabilities have been added correctly.

    I've used percentage figures you supplied, but a bonus of this system is that you don't have to use percentages - you can use counts (10 of fish A, 6 of fish B etc) and it will still work fine, meaning that if you change the value for one fish you don't have to recalculate the percentages for the other fish.

    Each fish is a separate object as you requested, but if you had a single fish object with each fish as an animation then you could set the animation in a single event directly from the "fish" variable rather than needing an event to check for each fish object.

    In Construct 3 there is a probability table feature in the Advanced Random plugin which makes this very easy to do. Sadly there isn't that option for C2.

  • I think this may be the C2 demo created by R0J0hound for parabolas to a point:

    dropbox.com/s/sp4npl259hcudia/parabola.capx

  • Assuming that you are using each frame as a different piece, you can do it like this:

    1. Create an array with dimensions (12, 1, 1)

    2. Give the array a variable "n"

    3. Add the following events on start (or put in a function):

    //First set the values of the array to 0-11, one for each frame.

    Array | for each XYZ element : Array | Set value at (Array.CurX, Array.CurY) to Array.CurX

    //Shuffle the array

    System | For "i" from 0 to array.Width-1 :

    >> Array | Set n to floor(random(Array.Width-loopindex("i")))

    >> Array | Push back Array.At(n,0) on X axis

    >> Array | Delete index n from X axis

    //Assign frames to the pieces using the shuffled array values

    Pieces | Set Animation Frame to Array.At(self.IID)

    To be able to use the IID in this way to assign you shouldn't have any other puzzle pieces in the scene. If you do need additional pieces in the scene for some reason, then instead give the piece sprite a variable e.g. pieceNo, number the pieces 0-11 and use that pieceNo instead of the IID.

    Hope that helps! :-)

  • Been having the same problem for a while now, somehow missed this thread. I also install the latest C3 beta as a desktop app, and have to go through the rigmarole of uninstalling and reinstalling updates in order to get them to stay updated.

    I agree that it is confusing to receive the "update success" message only to have the version revert next time you open, especially when you also receive "downloaded, ready to use offline" notification as well.

    If part of the problem is beta and stable releases use different URLs, so if you're using beta then your URL is not going to point to the latest stable, when there is a new stable release couldn't the beta track be updated to match it e.g. if there is a stable 100, create a beta 100.0?

  • Hi mekonbekon

    Thanks for your reply and it really helped me to understand these words, still there are some points

    1) I got understand Threshold complete and no confusion.

    2) Now I understand what is Permutation but a little confusion

    > For example a length of 3 with an offset of 1 will generate the numbers 1, 2 and 3, and then randomly shuffle them.

    according to above line I understand that offset of 2 will generate the number 1,2 and 3 and then again 1,2 and 3 and after this randomly shuffle. I mean if offset is 1 then there will no randomness for the first time and if offset will be 2 then there will No randomness for 2 times and then after than random will start. Am i right ?

    No, the offset determines the starting number for the permutation table so, a length of 3 with offset 2 will shuffle 2,3 and 4; an offset of 5 would shuffle 5,6 and 7 etc. The numbers in the table will remain in that order from the initial table creation until you use the "shuffle permutation table" action.

    3) From your explanation about seed i understand that if seed will be 0 then each time random sequence will be different but if seed will be 1 then first random sequence will be repeated for all next sequences. Am I Right?

    Think of it like this: when you pick a random number it does so from a very large list of random numbers - this list is fixed and unchanging; the seed says "start reading numbers from this point in the list". If you use the same seed then it will always start reading from the same point, so you get the same (pseudo-)random number sequence each time. If you don't add a seed value then it will start reading from any point in the list, so you'll get a different sequence each time.

    Note that you don't have to use a number for this list - it can be a string, so if the player has entered a character name (for example) you could use that to always generate the same random number sequence.

  • Hi luckyrawatlucky,

    1) Seed

    From the manual:

    Seed

    A string of characters used as the seed for random number generation. The same seed will always provide the same sequence of numbers. An empty string (the default) will use a random seed, ensuring the sequence of numbers is different every time.The seed is effectively a key for ensuring you produce the same random number sequence each time - this is useful if you want to allow users to replay/reload procedurally-generated content, for example.

    2) Permutation

    A permutation is the number of ways in which members of a set can be arranged, e.g. the letters ABC have 6 permutations: ABC ACB BAC BCA CAB CBA. In Advance Random you can create a random permutation table:

    Create permutation table

    Generate a randomly ordered sequence of numbers. Length is how many numbers to generate, and Offset is the first number in the sequence. For example a length of 3 with an offset of 1 will generate the numbers 1, 2 and 3, and then randomly shuffle them.

    3) Threshold

    A threshold is usually a value that if exceeded will trigger an action. From Black Hornet's description of the BHTsmartrandom plugin:

    A Threshold value lets you configure how the cycle repeats when all of the numbers are used, and the sequence needs to continue/cycle. A Threshold=0 will completely ignore the previous sequence, so the numbers will be random within the same range again, but it is possible that the last number of the sequence may be the same as the first of the next. For example; 2,5,4,1,3 could be followed by 3,1,4,2,5. The value 3 will repeat because the sequence must be regenerated and no logic is applied to test the last value of the last sequence. A Threshold=1, would guarantee that the first number of the next sequence would not be a 3, so there would not be a repeat immediately when the sequence restarts. Care is still required not to abuse the Threshold, as if it is too large (that is, greater than half the range), it is impossible to guarantee not repeating the same values.

    Hope that helps! :-)

  • I can see a few things that are likely to be causing problems:

    1. Adding the 0.9999 when picking a random no. for RandYPlacement means you may pick a number outside of the Y index of the array - remember that the Height is one more than the max Y value as the Y index starts at 0.

    2. RandYPlacement can keep picking the same number in each loop so some values won't be selected and others could be duplicated.

    3. When setting the size of Working_Answer_Array your Z axis needs to be at least 1.

    It's always good to try and work things out in a way you can understand but to be honest it would be worth getting your head around Mikal's code - it's quite elegant and really simplifies the process.

    Here's a similar version that's even simpler! ;-P

    It essentially does the same thing, but only needs one variable; in this case "pick" is a variable added to the array, rather than a local variable.

    The "for" loop runs once for each X index in the array.

    Each time the loop runs:

    1. the first action saves to "pick" an index value between 0 and the max X index minus the current loop index, so the first loop it picks between 0 and Width-1 minus 0, the second loop 0 and Width-1 minus 1 and so on until it gets to the final loop where it picks between 0 and width-1 minus width-1, or just 0.
    2. the second action adds the value in the array at the index "pick" to the end of the array (or "pushes back").
    3. the third action deletes the index "pick".

    This final action reduces the number of values to pick from by one, which is why we reduce the scope of pick by the loopindex at the start of the next loop. Effectively what happens is each loop a random value that hasn't already been picked is grabbed and stuck on the end of the array.

    Hope that helps! :-)

    When implementing these I thought about my previous experiences with other software like, 3d Studio Max or even Unity, where you have to juggle a bunch of keyboard shortcuts along with the mouse, just to be able to do something. I like every other person got used to that very quickly, so I thought it would be the same here.

    Thanks for clarifying - still trying to get my head around how these work, slowly getting there! ;-)

    Hi DiegoM, first off, thanks so much for the work you've put into this feature - it's a fantastic addition to Construct and I'm really looking forward to implementing it in my projects.

    I've a question about the scrubbing: why is it necessary to hold Ctrl to see the current view? Are there going to be any situations where you don't want the marker to display the animation at the indicated time?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi,

    I'm wondering if there's a way to use the AJAX object to request a JSON project file by name rather than using the drop-down list? Or maybe using some other object?

    Each level in my game has its variables stored in a separate dictionary JSON file. It would be great if I could request the file by name e.g. "level_"&ampcurrentLevel.

    I guess I could stick the variables for all the levels in a single dictionary or array, but both those solutions come with their own problems.

    Thanks in advance for any help you can offer.

  • Green321

    Here's an example that contains multiple teleporters - you should be able to simplify it to suit your needs:

    https://www.dropbox.com/s/h0h7fjk5t8d3p ... e.c3p?dl=0

mekonbekon's avatar

mekonbekon

Early Adopter

Member since 9 May, 2014

Twitter
mekonbekon has 13 followers

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

18/44
How to earn trophies