Multiple Platformer AI - Advanced Parent/Child (Help is very much appreciated!)

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I am attempting to construct my game engine as flexible as possible. I have programmed object physics (Gravity and horizontal movement) into a single group (Group.0), as I intend to make both the player and multiple enemy units feed of the same lines of code. This has worked flawless up until I started involving child objects, specifically censors/detectors...

    I have no issues whatsoever creating parent/child conditions for a single object, but as soon as duplicates are involved (such as multiple enemies) I hit the brick wall...
    No matter how much I try, I never find a solution for this...

    As of now, neither the player or the enemies responds correctly to the semi-platforms(The line you can jump through, but not fall through), the player and just one of the enemies seems to pair with the censors correctly, and jumping is not possible.

    I have included the source code for download. Please feel free to have a look! I hope you find the code understandable. :pacman:

    My primary objective now is to make all four detectors (top, ground, left, right) pair with each individual(The player and enemies) respectively. I want the player to respond to jumping, regardless if there are enemy ground censors overlapping the floor or not, and I want all of the objects to land on the semi-platforms correctly.


    In further development, both the enemy and player will have additional child objects linked to them, including individual weapons, and sets of sprites, which just digs further down the complexity of this.... Dear, my head starts to spin just thinking about it..
    I will not be able to continue development until I grasp a better understanding of this....


    Help is very much appreciated and recieved with overwhelming gratitude! :)Please login to see this attachment.

    Please login to see this link.

    Please login to see this link. | Please login to see this link.

  • The detectors will have a lot of purpose in later development. First of all, I use the "ground censor" to detect if the player is on ground, and render him able to jump. The "left/right censors" are used for wall jump (Not implemented in attached build). And the "top censor" is mostly used for checking if there is an obstruction in the way when the player is crouching, so he might not get back up (Also not implemented in this build).

    Same goes for the enemy. He will have similiar functions as the player, and when I arrive at the point of developing a behavior for the enemy, the detectors will also determine what moves he does, such as moving away from a wall.

    I have no knowledge of any other methods besides the use of detectors. I only use them as a shell to the player/enemy to tell if he/she is touching anything.

    Thank you for response, by the way! :)

    Please login to see this link.

    Please login to see this link. | Please login to see this link.

  • First youll need to create a fast loop for assigning every object its own id(spreading value). Then you would need to pass on all information through parent/child. Its a bit hard to explain through text but i should be able to make an example tomorrow or so.

    Fusion Veteran Since 2005. Example Projects: Please login to see this link.

  • Actually, im quite sure you dont need ANY Dectector Objects, or any Fastloops for any of this.

    I KNOW a player movement can be done without any detectors, including parameters displaying if Player is next to a wall/ ceiling/ standing on ground ( for wall climbing, ceiling hanging etc ).

    Im almost 100% sure the enemy AI can be done just the same ( without Fastloops or Detetctors ), and quite flexibly so.

    How can i change username and display name?
    Please login to see this link.

  • The "Embedded Collision Detectors" method is really recommended here. Which is:
    Instead of creating individual detectors for an enemy, you use the enemy sprite itself to detect the nearby environment.
    A tutorial on this can be found here: Please login to see this link.

    This will also work especially well in a Group Qualifier as you've described, if done correctly.

    Also, a good way of creating Child Objects:
    When creating the child object, set an alterable value to the fixed value of the parent
    Then, you always make a for each loop of these objects, and add the condition "Parent's Fixed Value == Child Object's Alterable Value", then you do actions such as position and such.

    - BartekB

    Join the Click Converse Discord! - Please login to see this link.

  • First youll need to create a fast loop for assigning every object its own id(spreading value). Then you would need to pass on all information through parent/child. Its a bit hard to explain through text but i should be able to make an example tomorrow or so.

    I don't think that is necessary as Fusion 2.5 eliminates the need for that with the ForEach looping! But maybe it is more convenient when several objects are to be connected?

    Please login to see this link.

    Please login to see this link. | Please login to see this link.

  • The "Embedded Collision Detectors" method is really recommended here. Which is:
    Instead of creating individual detectors for an enemy, you use the enemy sprite itself to detect the nearby environment.
    A tutorial on this can be found here: Please login to see this link.

    This will also work especially well in a Group Qualifier as you've described, if done correctly.

    Also, a good way of creating Child Objects:
    When creating the child object, set an alterable value to the fixed value of the parent
    Then, you always make a for each loop of these objects, and add the condition "Parent's Fixed Value == Child Object's Alterable Value", then you do actions such as position and such.

    Thank you for pointing that out! I've actually studied that method earlier on, but completely forgot about it! That should make a very good solution for this, not only by making it less complicated, but also removing the total amount of objects! I will get started on it now, but still....

    I still need to know how to do this child/parent method correctly! The player and the enemies will later have individual arms! To move in 360 degrees, and shoot in their own directions respectively! That cannot be done embedded.. I know how to program 360 degree shooting, but I've only done it for a singular object...

    I also intend to make the sprites seperate from the objects, but that is just for my own convenience in regards of hotspot positioning..

    Please login to see this link.

    Please login to see this link. | Please login to see this link.

  • In my oppinion, one shouldnt use the Sprite as a collision detector, because the Sprite changes in size when running animations and this affects collision checks.
    Allways create 1 Collision Mask object ( preferably a square Active with no animation ) ating as the movable Player, and just overlay/ 'pair up' a Sprite Objects to follow the Collision Mask.

    You dont even need loops or AltValues ( IDs/ FixedValues ) to pair up Objects in this way.

    How can i change username and display name?
    Please login to see this link.

  • King_Cool You can switch animation and frame to a green box acting as a collision detector. Check collisions, then switch it back. The player will never notice the switch of animations because it is between the game frame.

    I'd also appreciate if you could explain or show an example of how to pair objects without loops or alterable values (You're just saying it's possible without explaining how to do it), as because I've made this one that uses a for each loop and an alterable value:
    Please login to see this attachment.

    - BartekB

    Join the Click Converse Discord! - Please login to see this link.

  • So here is an update:

    I've removed the seperate detectors totally, and switched to embedded detectors, which work flawlessly for the multiple group objects. That makes this thread solved!

    I mentioned I still need the multiple instance parent/child formula for the further progress, but I think I will move that topic into a new thread if it is okay for you guys.
    Then this thread can stand as a solution to others who struggle with separate detectors for multiple objects! :)

    Thank you for your contribution!

    Please login to see this link.

    Please login to see this link. | Please login to see this link.

  • In my oppinion, one shouldnt use the Sprite as a collision detector, because the Sprite changes in size when running animations and this affects collision checks.
    Allways create 1 Collision Mask object ( preferably a square Active with no animation ) ating as the movable Player, and just overlay/ 'pair up' a Sprite Objects to follow the Collision Mask.

    You dont even need loops or AltValues ( IDs/ FixedValues ) to pair up Objects in this way.

    I completely agree! I embedded the detectors into the object, and the sprite will be the only separate object to be centered at the parent object! :)

    Please login to see this link.

    Please login to see this link. | Please login to see this link.

  • (To BartekB)

    About that example you made....

    Start of frame;
    - Start loop for each one of "Enemy", loop name "equip"
    On each one of "Enemy", loop name "equip";
    - Create "part_1" at (0,0) from "Enemy"
    - Set Alterable Value P to Fixed("Enemy")

    This works nice for a level with pre-placed enemies, but what am I to do when I want enemies to spawn throughout the game? The "equip" loop is already initiated in start of frame, and by doing it again, it will spawn another set of "part_1" objects to the enemies already in-game.

    How do I prevent this? There must be a way to pair up objects accordingly in a more flexible way.

    Please login to see this link.

    Please login to see this link. | Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!