Saurygiel's Forum Posts

  • Well I tried it out, and It's really frustrating to try and understand. Do you have any other method? This creates lots of problems. 1. The destination object isn't binded to any 'prey' so multiple prey will run towards a single one is no others are nearby or something. I don't know, It all doesn't make sense to me, It's giving me a headache. How were multiple objects created to be put ontop of the prey items when there was no event stating to spawn one for each instance of prey and there was only one at the start of the layout. Also, if I were to implement wandering AI, the destination wouldn't change with it and therefore wouldn't be able to run away since It wouldn't be ontop of the destination. Any explanation or other way to do it? I hate the idea of using an object for it to pathfind to because of all these problems. >.<

    I think I'm going to have a migrane from this stupid AI that I'm trying to make.

  • >

    > > Yeah.. so you could set a point 500px away from the player at a certain angle, right?

    > >

    > > Wen it's far enough away from the player your prey could go back to idle, or not?

    > >

    >

    > It would probably get it's destination stuck inside an object though, or it would double back and run straight towards you if your in an enclosed areas such as a valley, and the destination is just outside the valley, causing it to just run straight into you to get out of the valley. I guess It could work though, not sure how I would do it?

    >

    Basic example

    Now you will have to find a way to move the destination, when it's either overlapping or outside the layout..

    Unfortunately that cap.x is in verion 219, I don't really want to use a beta version as It might mess up my game... :/

  • Yeah.. so you could set a point 500px away from the player at a certain angle, right?

    Wen it's far enough away from the player your prey could go back to idle, or not?

    It would probably get it's destination stuck inside an object though, or it would double back and run straight towards you if your in an enclosed areas such as a valley, and the destination is just outside the valley, causing it to just run straight into you to get out of the valley. I guess It could work though, not sure how I would do it?

  • Would using pathfinding work for you?

    Not really, as there is no point that I want to direct it to. It's an open world game, and I need it to run away naturally and react accordingly with it's surroundings. No way to pathfind away from an object unfortunately without setting a predetermined point.

  • I'm currently making a survival simulation game, and I need help desperately with the AI. I made a thread about this a while ago but I don't think I explained it well enough. I already have a system for the prey to detect the predator (you), but getting the prey to actually run away from the player is a problem. I've uses a method of changing it's angle once it is supposed to run away from me every tick to 180% towards the player and in this same tick -180 degrees away from the player. I also use bullet movement. The ultimate problem I'm having though is that I have no idea how to make it turn away from objects on the layout. Say there is a tree in the way, what do I use for it to detect the tree individually as a single instance, and have it turn away from said object. Walls are also a big problem, as once it turns, say, 90%, it will still be facing the wall or running along it, causing it to glitch. When the prey turns away however, using the system I use (line of sights detection 'collision boxes' and increasing angle clockwise by 90%), It is also at the same time turning away from the player which causes it to not really turn at all and just spaz through entire walls or mountains.

    So, any suggestions on how to make an object 'run away' from the player and detect walls / other objects infront of it, therefore turning it away?

  • Omg, thank you! It fixed the problem!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Did you change the version number in the editor?

    No, but i haven't been doing that for all my previous updates, so I assumed it wasn't important. I'll try that now.

  • You say you've exported using the 'Export to Scirra Arcade' option from the latest build r216?

    Do you get any errors at all when trying to update?

    If no errors, then maybe Tom will be able to help or shed some light on the reason.

    Yes, i exported to scirra arcade with the latest build r216 and no, i did not get any errors. It looks less then 5 seconds to upload it to the scirra arcade which usually isn't the case.

    https://www.scirra.com/arcade/other-games/test-project-2181 is the link to my game. It does not include the updates to the skill menu (when pressing e on your keyboard, I added it to count how many skill points you have deposited into a single skill and their names above the icons) or the new plants and wandering AI. for the gasparinisaura (green dinosaurs).

  • Despite multiple attempts, my game has not updated on the scirra arcade. My editor is on the latest stable version and it has not changed at all. When exporting to the folder on my computer, it changes accordingly. The problem must be on the arcade's end but I'm really not sure.

    Any idea why this is happening and any way to fix this? Thanks in advance.

  • My problem is that I simply use this:

    Every tick

    --- deer: set angle to (player.x, player.y)

    --- deer: rotate clockwise 180 degrees

    And use a collision box that turns the object when it collides, so it looks like it turns away from it.

    The problem I'm having though is that when the object is moving away with the bullet movement every second you will see it turn backwards towards the player for a split second due to setting the angle to the player constantly and setting it away. I make it change it's angle -180 degrees towards the player, basically turning away. It looks like it's spazzing occassionally due to this. Another big problem is that when it runs into a wall it turns, and runs along the wall. Because of it constantly turning away from the wall and the player at the same time it is very spazzy and I need a way to stop it from turning away from the player while next to a solid.

    What i'm using to alleviate this right now is a large collision box that constantly spawns around the running away object when it has detected you. When it comes in contact with a solid I set the instance variable for it's turning away from the player 'off'. The big annoyance is that there isn't else or an invert option for collision events so I can't simply make it turn the turning away from the player back on when it's away from the wall. Each object that is running away has everything tied to instance variables so they work seperately.

    Any way to fix this spazzing out? Thanks.

  • Bump!

  • Your trying to get this object to run and dodge things?

    What type of game is this? Platformer? or top down?

    Justin

    Sorry, I don't need help anymore! Thanks anyways!

    BTW, it's a top down.

  • Thanks to everyone I've got it working! But I have one problem. When a wall is in the way (For example: A mountain or border) It turns and runs along side the wall, and because it is running beside the wall it is constantly turning, and whenever it is next to a wall it spazzes out while running away because it is changing it's angle constantly to face away from the player, but turn from the wall. I've tried multiple solutions and It's come down to making another instance variable. Every tick I have an invisible line spawn infront of the animals that detect you (through line of sight, a timer, and another instance variable). If it collides with a solid (I use invisible collision boxes overlapping objects in the background to simulate this, it's top down) it turns 45 degrees clockwise (still have to add randomization to clockwise or counterclockwise). Then I have another collision box that is spawned ontop of the running away animal that is a box 3x it's size. When this box comes in contact with a solid It turns off the instance variable that allows it to turn away from the player. The big problem I'm having is that collision has no invert or way to attach else onto so when it sets the instance variable to 0 to stop the turning away from the player to stop the spazzing, it stays at 0 and I have no way to turn it back to 1 again when it is away from a solid object. I've tried making it wait a second or less until activating it again, but it just keeps spazzing. I've also tried making it spawn another colision box ontop of the running away animal that has it's collisions rap around the other and having it so if this second one comes in contact with a solid it turns the instance variable to 1, but if it is close to the wall then the both are colliding and it defeats the whole purpose.

    Sorry for the long paragraph, it's hard to explain. Can someone please help me with the spazzing?

    Also, I used R0J0hound's idea of turning away, as it was easiest to understand and perfom. The problem with that is that occassionally you will see the animal turn back around at the player for less then a second due to it turning towards and away from the player at the same time. Any fixes for this too?

    Thank you so much!

  • Im very confused and frustrated! Someone please help me!!!

  • The title is bad, but it's hard to explain. I'm trying to make runaway AI for my game and I want it to run away from the player through pathfinding to help it dodge trees and look semi-realistic. The problem is that I have nothing to make it pathfind to, and therefore require a way to move an object to a certain distance away from the player, and also always stay infront of the player. But I'm having a problem with that as well because the players can simply turn away from the object running away to draw it towards the player. So my question is, how do i properly make an object pathfind away from the player, or simply run away from the player and dodge solid objects as pathfinding would? I'm getting very frustrated because I really want this to work but I have no idea where to begin and what to even do! Please help me!