logo hyperPad Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Login

    How to spawn a buddy?

    Scheduled Pinned Locked Moved
    Help and Support
    5
    39
    1.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Aidan_FireA
      Aidan_Fire @Deeeds
      last edited by

      @Deeeds I used collisions in my 3D project, where points would collide with triangle faces once, and then run a timer on a get position behaviour that ran under the collided behaviour. It was pretty annoying and messy to get this to work, also I didn’t have dynamic broadcasts when I made that. But I think for your case it might be better to use broadcasts messages. Here’s how I’d do it:

      I don’t know how many buddies you’re gonna have, but for simplicity I’m gonna say just 1.
      Instead of the buddies spawner changing the properties, the buddy will change its own properties. Each property will be given its own broadcast/receive key.
      When the main object wants to change a buddy’s property, it simply broadcasts a certain message and includes in it the data of the new property you want (e.g, I want to change its mass to 5, broadcast key is say MASS, value is 5). The buddy then receives the message with key MASS, and changes it’s own mass to the value given, 5.

      This can work too if there are more than 1 buddy. How easy it is to make depends on how many buddies there are.

      D iTap DevelopmentI 2 Replies Last reply Reply Quote 0
      • D
        Deeeds @Aidan_Fire
        last edited by

        @Aidan-Oxley Here's my "fix", that's not working.

        Each buddy has a Channel_ID that he listens on. These are the numbers, 1 through 9.

        Each "mate" of a buddy stores a variable with the Channel_ID of his buddy.

        When "mate" wants to send a message to his buddy, he's using that variable... which holds his number for his buddy.

        But, for some reason, this isn't working.

        Is there a rule against broadcasting with an Event key that's the contents of a variable and as simple as the number 1, 2, 3, etc..

        iTap DevelopmentI 1 Reply Last reply Reply Quote 0
        • iTap DevelopmentI
          iTap Development @Aidan_Fire
          last edited by

          @Aidan-Oxley for buddy one just have it be ‘mass1” for buddy two “mass2” etc. just increase a number by 1 each time you spawn a new buddy and combine it to the “mass” key. then You can have unlimited buddies. Then @Deeeds won’t be so lonely!

          1 Reply Last reply Reply Quote 0
          • iTap DevelopmentI
            iTap Development @Deeeds
            last edited by

            This post is deleted!
            D 1 Reply Last reply Reply Quote 0
            • D
              Deeeds @iTap Development
              last edited by

              @iTap-Development Each buddy has a receive message, and looks to his variable (which should be unique) to see what "channel" he should be listening on.

              This variable is set when he's spawned.

              That part works

              Him listening on the variable channel doesn't work.

              iTap DevelopmentI 1 Reply Last reply Reply Quote 0
              • iTap DevelopmentI
                iTap Development @Deeeds
                last edited by

                @Deeeds are you willing to give a project to look at?

                D 1 Reply Last reply Reply Quote 0
                • D
                  Deeeds @iTap Development
                  last edited by

                  @iTap-Development No, I'm deep into something, and simply need to know... can a receiver use a variable as the Event Key?

                  That is the part that's not working.

                  iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                  • iTap DevelopmentI
                    iTap Development @Deeeds
                    last edited by

                    @Deeeds as far as I know, yes. That’s why I suggested a project.

                    D 1 Reply Last reply Reply Quote 0
                    • D
                      Deeeds @iTap Development
                      last edited by

                      @iTap-Development Are you SURE it works? Have you ever done this?

                      Spawn and object. Let's call him Mate

                      Spawn an object to be Mate's Buddy

                      Mate sends a channelID to Buddy

                      Buddy sets that variable in his local storage.

                      Buddy's got a Receiver with an Event Key that's set to that locally stored variable.

                      Everything works except Buddy's receiver.

                      D 1 Reply Last reply Reply Quote 0
                      • D
                        Deeeds @Deeeds
                        last edited by Deeeds

                        @iTap-Development @Aidan-Oxley I found the problem.

                        Buddy's Receiver is set by creating a copy of what's in the variable for itself, it's not a reference to the variable's contents (nor is looking contents via a pointer etc). So once it gets a value from the variable, it's got its own copy and isn't actually looking at the variable's contents to know what it's listening to.

                        In the initial Spawning, he's getting a null as the receiving channel because the variable hasn't yet been initialised.

                        And that never changes, even when the variable's value changes.

                        A very slight delay before activating the receiver forces it to set itself with that variable after the variable has been initialised with the value of the previously received ChannelID from his Mate.

                        This goes back to my other point, somewhere else, that I think broadcasting might be quite efficient, and that @hamed is setting up fast lookup tables for messaging and been a clever fella about how he's done messaging, even if nobody has bothered to describe how/why it works the way it does.

                        iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                        • iTap DevelopmentI
                          iTap Development @Deeeds
                          last edited by iTap Development

                          @Deeeds that’s why I suggested sharing a project! Glad you figured it out!

                          D 1 Reply Last reply Reply Quote 0
                          • D
                            Deeeds @iTap Development
                            last edited by

                            @iTap-Development How would that help to share a project for that?

                            This is why I asked you about conceptual thinking.

                            The question contains the problem.

                            iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                            • iTap DevelopmentI
                              iTap Development @Deeeds
                              last edited by

                              @Deeeds because I could have looked at it and potentially found the problem, especially since I’ve built similar before.

                              D 1 Reply Last reply Reply Quote 0
                              • D
                                Deeeds @iTap Development
                                last edited by

                                @iTap-Development I'll say this once again:

                                The problem is CONCEPTUAL!

                                How does one do this kind of thing in this engine with its limited sense of relationships?

                                That is the question and the problem.

                                This is not about one specific effort, this is about understanding the limitations of this engine and its approaches to relationships.

                                Is it making sense what I'm asking, now?

                                iTap DevelopmentI 1 Reply Last reply Reply Quote 0
                                • iTap DevelopmentI
                                  iTap Development @Deeeds
                                  last edited by

                                  @Deeeds you asked a specific question about a specific problem you were having with a specific behavior. Sure, you are wondering about the concept, but also specifically asked, “can a receiver use a variable as the Event Key?”. So stop with the concept nonsense.

                                  D 2 Replies Last reply Reply Quote 0
                                  • D
                                    Deeeds @iTap Development
                                    last edited by

                                    @iTap-Development It's in the very first word of the original post:

                                    "imagine"

                                    1 Reply Last reply Reply Quote 0
                                    • D
                                      Deeeds @iTap Development
                                      last edited by

                                      @iTap-Development Think outside the bun.

                                      The question, the Original post, is the problem trying to be solved. That is a CONCEPTUAL problem.

                                      Along the way to solving that might be some examples, and I posited one, a buddy relationship. You're welcome to use other examples. But the problem remains conceptual. How does one reference a buddy of a spawned mate?

                                      Whilst I thought I'd solved this problem, I have not.

                                      Can you demonstrate that it's possible?

                                      That might be a better way to use your literalist thinking.

                                      Here's the example that demonstrates the problem.

                                      Spawning 3 mates.

                                      Each mate then spawns a buddy.

                                      Each mate wants to be able to communicate with his buddy.

                                      Is this possible in this engine?

                                      At this point, I'm saying no. It seems broadcasting gets hung up around the first instance for the spawned buddy.

                                      iTap DevelopmentI 3 Replies Last reply Reply Quote 0
                                      • iTap DevelopmentI
                                        iTap Development @Deeeds
                                        last edited by iTap Development

                                        @Deeeds I’ll see about building that....I might not have time tonight, but I’ll try.

                                        D 1 Reply Last reply Reply Quote 0
                                        • iTap DevelopmentI
                                          iTap Development @Deeeds
                                          last edited by iTap Development

                                          @Deeeds what would you like them to communicate?

                                          1 Reply Last reply Reply Quote 0
                                          • iTap DevelopmentI
                                            iTap Development @Deeeds
                                            last edited by

                                            @Deeeds is having the mate and buddy see each other’s position and move based on the position(or something like that) good enough?

                                            D 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post