lukezero's Forum Posts

  • Hi guys!

    I'm raising this question here for several reasons:

    1. I know that many programmer friends use AIs successfully with other languages/engines;

    2. As a designer, I usually use "no code" engines to produce my games and only now have I been testing this AI for this purpose.

    3. I ask because in my first tests, I found some inconsistencies in the code suggested by ChatGPT.

  • Hi guys!

    I'm trying to implement a routine for my top-down game, in which a flying enemy activates disabled enemies near the player character, in order of proximity.

    I tried to create a routine with the help of ChatGPT, but I believe he made mistakes in some commands (but he was right when recommending the use of Array).

    Below is an image so you can better understand the mechanics I am trying to program.

    Tagged:

  • Like this:

    I also made some adjustments to the demo which include this, and made some tweaks to some values, such as the pathfinding refresh rate. It was at every 0.02 seconds, but that appears to be pretty memory heavy so I changed it to 0.05.

    It also seems to work better with 4 directional movement.

    https://drive.google.com/file/d/1nDI-BU8huVVyZSzPvkEFd0nZLw6xFY-e/view?usp=drive_link

    Thank you very much!!! :D

  • Adding this should help you achieve the effect:

    Also consider increasing the rotation speed so the characters quickly snap into the correct angle.

    As for the animations, all you need to do is check the angle of the Player/Enemy Controllers and apply the animation to the characters based on that.

    - For example, if Enemy_Controller angle is between 315 and 45, set Enemy animation to "Right".

    You can use the condition "Pick Children" to access the Graphic object belonging to the controller.

    - For example: Condition1 -> Enemy_Controller -> Pick Children -> Enemy.

    Condition2 -> Enemy_Controller angle is between 315 and 45

    Action: Enemy -> Set Animation to "Right"

    Since you used the Condition 1 to specifically pick the child of the Enemy_Controller, it will only change the animation if it's its own child.

    Same applies to the Player.

    Thanks again! You're awesome! :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you need only the graphics to turn in 4 directions, or do you want to restrict the movement to only Up, Left, Right and Down?

    Both things, but only the necessary programming to make it functional in this way.

  • I made a small improvement to fix an issue where they would still get stuck in the wall sometimes. Use this version instead:

    https://drive.google.com/file/d/1nDI-BU8huVVyZSzPvkEFd0nZLw6xFY-e/view?usp=drive_link

    Do you think it works well with the enemy moving in 4 directions?

  • I made a small improvement to fix an issue where they would still get stuck in the wall sometimes. Use this version instead:

    https://drive.google.com/file/d/1nDI-BU8huVVyZSzPvkEFd0nZLw6xFY-e/view?usp=drive_link

    Thanks again! Already downloaded! :D

  • Here's an example I made using the pathfinding behavior.

    It has some extra stuff to add a bit of polishing that you may find useful.

    The code is fully commented to great detail, so it should be easy to understand.

    https://drive.google.com/file/d/1nDI-BU8huVVyZSzPvkEFd0nZLw6xFY-e/view?usp=drive_link

    Thanks, dude!

    I'll test and study it right now! :D

  • Since the logic you are going for is enemy following the player then use the Pathfinding behaviour. The enemy won't get stuck on walls with this.

    I've tried many times and it's bugged. :(

  • I just love to think about possibilities to achieve something. Maybe the case you brought fascinate me to actualize the idea. Hopefully I can work on it in weekend.

    If I had your expertise, I would do the same too. It's amazing to see a no-code engine make independent projects viable for designers, beginners and enthusiasts.

    I sent you an email if you have time and can help (more than you already do). :)

  • The easiest way possible to make enemy chasing player while avoiding building is just mimick player movement with sort of delay. When player moves he will drop kind of trace/trail as waypoint for the enemy to follow through. Waypoint can be spawned when player make a direction turn or timed every x second.

    Hi Alex! You're are a true ray of light in the Scirra community. :)

    It's a good solution, and I haven't tried it yet.

    I'm making one last attempt using Pathfinding and Line of Sight (but I still don't understand their malfunction).

  • Still unsolved. :(

  • I often hit barrier that stop the progress and turn me down a bit. Yet I learn and try something new; alternatives way or workaround. It is an adventure for me to discover and un-puzzle mechanics under the hood.

    When things got worse I just switch to another project and eventually comeback to troubleshoot the game.

    The problem with Construct is that we have to rack our brains to manually implement its behaviors that don't work well in practice. In this case, it is Pathfinding and Line of Sight.

    Because of this, I had to program the AI ​​having to recognize the axes (X and Y) and make the enemy move reactively based on the behavior of 8 directions.

    This is why users like R0J0hound often provide solutions based on mathematical calculations, not through the engine's behaviors.

  • Well for the last example some parts derived from R0J0 example that modified with approach & feature I had in mind. Most examples I shared in forum made by me.

    Take your time to grasp how things work. It's really rare in my experience executing an idea in one take.

    Thanks, man. I'm still doing many tests with my game, but I've no progress until now.

  • It may be not easy to understand, but following example does the job avoiding obstacle for perfect grid movement: dropbox.com/scl/fi/9e9w6kcpfa024h1bsq0zy/path_touch.capx

    Are all these examples yours?

    With the little time (and energy) I have lately, I still haven't been able to implement the programming logic from your last example in my game. :(

    (I think the checkered floor creates a grid that makes the programming logic different from my 4 direction game.)