Author Topic: [VB6] AI Help  (Read 3415 times)

0 Members and 1 Guest are viewing this topic.

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
[VB6] AI Help
« on: November 18, 2007, 02:20:45 pm »
With coming up with an artificial intelligent function, how would I have one shape follow another? I've gotten a decent distance formula that works, but How would I make the other shape follow? I'm in desperate need of help tonight.

Thanks.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [VB6] AI Help
« Reply #1 on: November 18, 2007, 03:29:02 pm »
I don't think you made the problem clear enough.  What do you mean one shape follow another?

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: [VB6] AI Help
« Reply #2 on: November 18, 2007, 03:38:11 pm »
Well, basically. I created a modulated distance formula which I will use to control one shape, with the mouse, once that shape that I control gets to a certain distance, I want that shape (the AI shape) to chase the one that is controlled by the mouse.

Basically, it's a simple cat and mouse game.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [VB6] AI Help
« Reply #3 on: November 18, 2007, 03:57:51 pm »
Well, basically. I created a modulated distance formula which I will use to control one shape, with the mouse, once that shape that I control gets to a certain distance, I want that shape (the AI shape) to chase the one that is controlled by the mouse.

Basically, it's a simple cat and mouse game.

You're still leaving the problem way to vague for anyone to be of much help.  Plus, I don't have much experience with artificial intelligence, so I doubt I could help much.  I'm sure you'd have some luck searching Google?  If there's a Linux game like this, maybe there's some source you could look at?

It seems to me that you're saying "I have no idea where to start... help!".  If this is for a class, why not ask the teacher or a peer?  If not, what's the rush?

Offline abc

  • Hero Member
  • *****
  • Posts: 576
    • View Profile
Re: [VB6] AI Help
« Reply #4 on: November 18, 2007, 04:13:35 pm »
Well, it's due tomorrow.
Here, I'll try to explain this again..

Shape A - "Shape A" is a circle and is controlled by the users mouse, when the user moves the mouse across the form, the circle follows it, everywhere it goes. (Prey)
Shape B - "Shape B" is the predator, it sits there quietly, and when the Shape A (the prey) comes within a certain (preset) distance, the "Shape B" automatically follows Shape A.

Basically the point of the game is very loosely based on the myth Theseus and the Minotaur. You're objective is to get close to the Minotaur (Shape B), then try to escape to an exit before the Minotaur (Shape B) touches Shape A (You, The prey).

My problem:
How do I get the Minotaur to chase after you? (Theseus)

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: [VB6] AI Help
« Reply #5 on: November 18, 2007, 04:19:46 pm »
Well, it sounds to me like this is more of an implementation block than a conceptual block.  There aren't many intelligent decisions being made.

So, do you have a routine that's called each time the mouse moves?  If that's the case, check if the distance is less than some threshold and if it is, set some flag.  If the flag is set, then move the cat one unit (or something comparable) directly toward the mouse. 

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: [VB6] AI Help
« Reply #6 on: November 18, 2007, 07:55:12 pm »
So, do you have a routine that's called each time the mouse moves?  If that's the case, check if the distance is less than some threshold and if it is, set some flag.  If the flag is set, then move the cat one unit (or something comparable) directly toward the mouse. 
That's exactly the solution that I was envisioning, but I don't see any AI involved (unless the "cat" can only see a certain distance and has to guess where the mouse is, that'd be an interesting problem)