Alyra Games's Recent Forum Activity

  • Do you use the right aspect ratio?

  • I think the first thing you want to try is highly complex and system demanding. But I'm not sure, maybe there is an easy solution.

    Regarding the second thing... do you mean like the cursors move on consoles?

  • I'm stuck in the complicated percentage calculation.

    It's actually not "per cent" (/100) it's "per total amount of all values of the X array row)

    I am trying to figure out how I have to set up the equation.

    Rolls is the total number of rolls and X0 is the total amount of the occurring X0 cases. I want to figure out at how many % X0 occurs:

    Set Text:

    round(rolls/x0*(array.At(0,0)+array.At(1,0)+array.At(2,0)+array.At(3,0)+array.At(4,0)+array.At(5,0)+array.At(6,0)+array.At(7,0)+array.At(8,0)+array.At(9,0))) & "% dynamic chance"

    Edit:

    Awesome! I figured it out. I had to swap "rolls/x0" to "x0/rolls". I will soon upload the .capx so everyone who will need this can look at it.^^

    Edit 2:

    Here is the .capx. On the top left you can see all rolls. On the left the static % chances given in the array. On the right side the dynamic case occurences.

    Edit 3:

    I updated the .capx so everyone, who needs this solution, can easily comprehend how it works.

  • Yes it needs to be possible for each case to occur. Because in my example the AI whould never destroy the window if he wants to destroy something.. even though he has a 100% chance to want to destroy a window.

    I'm currently setting up the 10,000 loop and I then will post the .capx.

  • But if 2 or more values are the same than the first ones whould never occur:

    100%(returning 1, but will never occur)

    100%(will always overwrite 1 to 2)

    80%(returning 3)

    70%(returning 4, but will never occur)

    70%(will always overwrite 4 to 5)

    I will try out if I can use my solution and if the % chances keep correct. I will loop through the code 10,000 times like you did in the other thread.

  • Use parallax. Copy this "Parallax In Construct 2 | Awesomeness!" into YouTube. It's the video with the trees.

  • Thank you Joannak for your afford. But I described my problem badly in the first post.

    And RamPackWobble whank you, too. But what if the first probability is 100%? Than the others whould never occur.

    I have to find another way around this. :/

    Edit:

    And what if I instead go from low to high? So it will pass all 0% chances (they whould anyways never occur). But if the last 2 are 100% there is the same problem.

    I think I now have a solution:

    roll=round(random(X1+X2+X3+X4+X5+X6...))

    if roll <=X1 - case 1

    if roll >X1 & roll <= X1+X2 - case 2 occurs

    if roll >X1+X2 & roll <= X1+X2+X3 - case 3 occurs

    if roll >X1+X2+X3 & roll <= X1+X2+X3+X4 - case 4 occurs

    if roll X1+X2+X3+X4 & roll <= X1+X2+X3+X4+X5 - case 5 occurs

    if roll X1+X2+X3+X4+X5 & roll <= X1+X2+X3+X4+X5+X6 - case 6 occurs

    So this whould ensure, that the AI does check all probabilities, even if there are more at 0% or 100%. The other good thing about this whould be that there is always an X case choosen (except all cases have 0% chance).

    The values itself are dynamic but the number of X cases are static. So I think I could use this. Whould this be correct on the maths side?

  • Use the "set position" command. Set it to the coordinates of the start position (if they are always the same) or use X and Y variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For grid the best option is always to use arrays.

    The sample picture really looks like what you describe: /tutorials/307/arrays-for-beginners/page-4

  • Glad I could help. You can change the 45 values to anything you want to increase the spread. If you change them to 90° the player should spreed the bullets at a 180° angle.

  • Yes it is possible. You have to set the bullets angle on creation to random(player.angle-45, player.angle+45). This whould spread the bullets in a 90° range infront of the player.

  • Okay I will read through it. I have not had the time for it yet.

    Edit:

    Okay I read through the topic. I already had this solution in mind but my case is a little bit different so it whould not work for me (I think).

    I safe my probabilities in an array and each of this probabilities can be ranging from 0%-100%. So if there are for example 5 different probabilities their sum can be greater or smaller than 100%.

    I will show you an example. I attached a picture of the array. Each of this values can range from 0-100, representing % chances. 50% is the base value at the start of the game. The values are dynamic. Each Y row is an action the AI can make and each X row is the % chance of the object he is using for this action.

    Let's say the first action (Y 0) is "destroy". And let's say the AI has 6 things he is able to destroy. X1=window, X2=door, X3=car, X4=house, X5=smartphone, X6=TV.

    First i randomly choose an Y value to determine which action the AI is doing. After that I have to randomly let the AI pick an X value to determine with which object it is interacting. And this should be dependent on the % chances. If X1 is 0% the AI whould never destroy a window if he wants to destroy something. If X3 and X5 are both 100% than it whould always destroy either a car or a smartphone if the AI decides to destroy something.

    So i have to set those values in relation to each other, but have to keep their own % chances. My had is about to explode.

    I hope my problem is now clearer. There might be an easier solution than my approach but It gives me hadache.^^

    Thanks for reading

Alyra Games's avatar

Alyra Games

Member since 13 Feb, 2014

None one is following Alyra Games yet!

Trophy Case

  • 10-Year Club
  • Email Verified

Progress

11/44
How to earn trophies