Can I use the Peer-Object for bots?

0 favourites
  • 4 posts
From the Asset Store
Best for runner games, sidescroller, arcade and more!
  • Hello

    I was wondering if it's possible to use the Peer-Object when creating bots in your multi-player game?

    Or is it better to create a stand alone object dedicated for bots?

    I've been experimenting a little with this, and everything looks fine for the host but not for the other connected peers.

    I think that the peers cannot see another peer if it has not been properly associated with a Multiplayer.PeerID

    ...It must be another connected multiplayer, I think??

    It would have been great if there was a way to use the Peer-Object for bots because of the programming is already finished for the peers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bot logic and control should be handled by the host, and relevant objects synced - then each peer will get a copy automatically.

    Basically, the host should currently be creating and assigning synced objects for peers as they join. If you're adding a bot, instead assing your own "botID" in place of the peer ID on creation of the synced object, and reference that ID when creating events for your bot. You probably also want a instance variable boolean "Bot" is true or false, this will let you easily sort your bot specific events to affect only bot instances.

  • Thanks for the reply oosyrag

    I've done similar to what you explain and the Host is controlling all that the bots do. And I also thought similar to you with the boolean "Bot" active on my bots. It worked very nice for only the Host, but not the clients.

    ...I did not manage to use the Peer-object for the bots, cause the clients could only see them if the Peer-object got a real Multiplayer.MyID ( even though all Peer.Objects are synced )

    The reason I wanted to use the Peer-objects is that then I did not have to recreate a new object and insert all instance variables (again) and so on. If I have the Peer-object and a separate Bot-Object I have to make multiple events in a lot of places, first checking something with the Peer and then checking something with the Bot.

    I decided to make a dedicated Bot-object and have been moving forward quite a bit. I got it to work pretty ok and managed to keep things relatively comprehensible.

    I'm not sure if it is possible to use the Peer-object if it's not associated with a real Multiplayer.MyID ( a connected client ) ?

  • It should be fine. I'll see if I can throw together a quick test later.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)