A question for JackBQuick or anyone else who can figure this out.

LordTarantorLordTarantor Member, PRO Posts: 890
edited November -1 in Working with GS (Mac)
Hi everybody:
I ask for Jack because every time I have a question he comes up with a demo for it. He is like a demo librarian...
But for everybody else please feel free to help.
I have some victims actors that are supposed to run away from the predator and they do. At the beginning there is only one predator. Then I add more predators but the victims stop running away from the original predator and every time I put a new predator the run away from that one but not from the rest.
I have some predator with a real inferiority complex.
What I would like to create is victims to run away from all predators.
How can I do this?

Comments

  • JackBQuickJackBQuick Member Posts: 524
    I can't pinpoint the exact demo that could help you -- I'm on a PC right now and I'm working off memory -- but two by firemaplegames come to mind:

    Magnitude DEMO

    and

    Repel Mouse DEMO

    Okay, not so much the second one but it looks real cool :)

    Maybe you can have a rule (using the first demo) that if a victim actor is close to a predator actor, it triggers behaviors that makes it move away.
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Thanks Jack.
    I tried the demo but it is what I was thinking and What I am trying to avoid. In the demo the 2 targets have different constraining. One is target 1X, 1Y and the other is target 2X, 2Y. In my case if I have 10 predators I would have to make a different constraining for each one. Is there an easier way? because then I will have to put a reaction for avery single predator on each one of the victims.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    LordTarantor said:
    Thanks Jack.
    I tried the demo but it is what I was thinking and What I am trying to avoid. In the demo the 2 targets have different constraining. One is target 1X, 1Y and the other is target 2X, 2Y. In my case if I have 10 predators I would have to make a different constraining for each one. Is there an easier way? because then I will have to put a reaction for avery single predator on each one of the victims.

    This is probably your best bet. I guess you could unlock all the instances so that you have access to each actor. Then you could avoid using so many constrains. But once you unlock an instance all the changes you make to a prototype will not be added to the unlocked instances so use this very carefully!
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Thanks scitunes. How can I do this if the new predators are spawned. I did what you say to the victims and now they always run away from the original predator that is the one I am controlling but the new predators don't make the run away.
  • JackBQuickJackBQuick Member Posts: 524
    I don't have time to think this through so this might not work:

    Look at the Collision angle demo I made.

    Make both your victim and predator actors with circular collision shapes.

    The predator actors will be a large circle (transparent PNG with image in the centre), larger than what is required -- this will set up a perimeter. When the victim collides with this perimeter you want it to start running away.

    The demo above shows you how to calculate collision angles. The only difference I would make is: in the main actor (blue), it saves its position upon collision to game attributes. I would have it saved to actor attributes within itself.

    When the victim actor collides with a predator actor, calculate the angle immediately and then you can have the victim actor move in the opposite direction.

    Again, I don't know if this will work but good luck.
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Thanks Jack. I am going to study this one and as soon as I understand it I will give it a try. Thanks a lot.
  • JackBQuickJackBQuick Member Posts: 524
    Having the victims actors move away shouldn't be difficult but here are some problems you might encounter:

    - What would happen if multiple victim actors collide with multiple predator actors at EXACTLY THE SAME INSTANT?
    - What would happen if a victim actor was cornered by predator actor(s) and didn't have anywhere to go?
    - If a predator actor were to "capture" a victim actor what should happen? How can you tell if a predator actor was directly above a victim actor?

    Just some things to consider...
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Jack, What I am trying to do or recreate is one of those kids game were one person count and the others run away and then he is supposed to catch them and every time he touches one that person is supposed to help him catch the others. I don't know how do you call this game but in puerto rico is called-Tocaito or Rescate.
    So we start with one predator but every time that predator touches a victim, that victim becomes a predator too.
    So to answer the question, I don't know what exactly happens if multiple predators collide with victims but I don't think there will be a problem there.
    The same thing with the second Q and the 3rd one you know, he will become a predator too.
  • JackBQuickJackBQuick Member Posts: 524
    Wow, this seems complicated. How do you get the predator actors to chase the victim actors?
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    if i were you I'd have a fixed number of people on screen at once, say 10. I'd have 3 attributes for each player
    player1Predator (Boolean)
    player1X (Real)
    player1Y (Real)

    player2Predator
    player2X
    player2Y
    ...
    etc

    Then at the start of the game, I'd have the predator chase a random character (assign another attributed called 'chase' random(1,10) and then have rules that say, if chase = 1 AND player1predator is false, moveto player1X, player1Y, if chase = 2 ... etc)

    have a rule that says when predator collides with player1, change player1Predator to false and have them both generate a new chase number.

    you'll have to add rules to make sure they only go after people who have not been 'tagged', so that's why you need to put a playerXPredator=false check.

    it should work in theory, it's gonna be a lot of work on your end to fiddle with the rules to get it to work right, but this should set you down the right path.
  • LordTarantorLordTarantor Member, PRO Posts: 890
    @ Jack- I just put the constrain victim x,y and in the predators I put an accelerate towards victim. The seen to run to the closest victim.

    @ Jon- Thanks a lot. That is exactly what I was trying to avoid. I did it in my Chupacabras game, I don't know if you remember, you were the one who taught me this method. Since it took a lot of time I was trying to see if there was a faster way because in the Chupacabras there were not even half the amount of victims actors I have in this one. I guess there is no other way.

    Thanks a lot every one, lets start to work.
Sign In or Register to comment.