Can I use the Peer-Object for bots?

Get help using Construct 2

Post » Mon Apr 03, 2017 10:40 am

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.
Soulmachine @Soundcloud
B
14
S
2
G
1
Posts: 63
Reputation: 928

Post » Mon Apr 03, 2017 4:53 pm

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.
Mistakes were made.
B
52
S
26
G
109
Posts: 1,611
Reputation: 61,643

Post » Mon Apr 03, 2017 9:27 pm

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 ) ?
Soulmachine @Soundcloud
B
14
S
2
G
1
Posts: 63
Reputation: 928

Post » Mon Apr 03, 2017 10:29 pm

It should be fine. I'll see if I can throw together a quick test later.
Mistakes were made.
B
52
S
26
G
109
Posts: 1,611
Reputation: 61,643


Return to How do I....?

Who is online

Users browsing this forum: beohs, brunopalermo and 14 guests