Preview Malfunction Question / Enemy Ai Problem

EricTippettEricTippett Member Posts: 45
edited July 2012 in Working with GS (Mac)
Hey Everyone,

So right now when I click the play button, which is by the Stop button, the game plays fine.
But when I click preview, some things don't work as they should.

Why is this?

What I am doing right now it trying to create some enemy ship Ai for this game similar to Geometry Wars.
I wanted them to come close to the player but not get too close. So I made a radius actor and constrained its x/y positions to the players. In the play mode it stays right on top of the player.
However, in Preview it doesn't. Instead it seems like it is on another graph. It will join up with the player the closer I move to the 0,0 value but if I move away, the radius will move further away. My field is 2000 by 2000.

Any ideas on whats going on here? and any better ideas on how to create some better enemy movement ai?

Best Answers

  • PhoticsPhotics Posts: 4,172
    Accepted Answer
    In BOT, I used rules to control actor movement. The trigger was magnitude... the distance between the actor and the enemy.

    I don't remember the exact numbers, but one of the actors was something like this...

    If magnitude is greater than 500 pixels, don't chase enemy. Just wander around.
    If magnitude is greater than 250 pixels, but less than 500 pixels, chase enemy.
    If magnitude is less than 250 pixels... SHOOT!
  • PhoticsPhotics Posts: 4,172
    Accepted Answer
    So for your ai, how did you set those up? Like how did you make them just wander around for example?
    I used an "Aggro" actor attribute. If aggressive, the actor would pursue the enemy. Otherwise, the enemy wanders around randomly.

    Also, where could I play your BOT game, I tried looking it up but couldnt find it?
    http://photics.com/buy-bot
  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,922
    edited July 2012 Accepted Answer
    What is you're timer interval and what are you randomizing rotation or x & y.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,922
    edited July 2012 Accepted Answer
    Yeah building a good AI isn't easy. You're timer seems way to fast. Without seeing your game I would recommend a static time like 5 seconds before it looks for another random velocity it stutters because every one second or so you could be asking it to go in the exact opposite direction and back again as the random function isn't as random as you might expect.. If it was me a would design a default pattern it flies in like a loop when it is out of range and I would base the loop of it's self position at the moment it is out of range. The thing is real AI is never really random only made to appear that way.

Answers

  • EricTippettEricTippett Member Posts: 45
    edited July 2012
    Thanks! I used the magnitude and deleted my old range method.

    So for your ai, how did you set those up? Like how did you make them just wander around for example?

    I am trying to figure out what I would have to do to make the enemies run away from the player as well. Have any ideas on how to do that?


    Also, where could I play your BOT game, I tried looking it up but couldnt find it?

  • EricTippettEricTippett Member Posts: 45
    Do you know if there is any way to track the velocity of the player and also enemies?
    I wanted them to deal damage based on the velocity when they crash into the player.
  • EricTippettEricTippett Member Posts: 45
    Hey Photics, currently I am trying to make the enemy move around randomly when in range 200 - 400
    So I have a rule that says the range and that is working.
    But the enemies aren't randomly moving in 1 direction, instead they are shaking because they are moving in a random direction constantly.
    I made a timer for random(0,360) and then a move (i tried accelerate too) for random (0,360). Can you tell me what I am doing wrong and what I should type in?
  • EricTippettEricTippett Member Posts: 45
    Hey Bacon,
    My timer is For: random(1,3) run to completion (i wasnt sure what run to completion really does)
    Then I did Accelerate Random (0,360) actor
  • EricTippettEricTippett Member Posts: 45
    Oh that's a good idea. I was actually trying to make some enemies go in patterns but I had no idea how to do that. So how would you make the enemy fly in a loop like you were saying?
    And also, is there a way to specify points for them to move to one after another or create some complex patterns?
    Thanks for helping me out by the way!
Sign In or Register to comment.