Sign In Register

How can we help you today?

Start a new topic

RT Bot

var player = Spark.getPlayer();
var data = Spark.getData();
// // find match as dummy //
var matchReq1 = new SparkRequests.MatchmakingRequest()
matchReq1.matchShortCode = data.matchShortCode;
matchReq1.skill = 150;
var respons = matchReq1.SendAs("58efde139a8e0504bf19e6b1");
Hey Guys,


first of all, as you can see, my english is terrible.

however, i hope you understand me. If not. dont hesitate to ask me :)


I'm creating a two player strategy game. 

Matching two real Player isnt really hard at all, but how to connect a bot who has its own PlayerAccount into a RTSession and start the match?


At the momant, the player send's a MatchmakingRequest with skill 0.

If a match was found the client starts new RTSession and connect.


In CloudCode i hook into the MatchMakingRequest and create another Request with skill 150 (as marker for bot matach)


var player = Spark.getPlayer();
var data = Spark.getData();


// // find match as dummy //
var matchReq1 = new SparkRequests.MatchmakingRequest()
matchReq1.matchShortCode = data.matchShortCode;
matchReq1.skill = 150;
var respons = matchReq1.SendAs("58efde139a8e0504bf19e6b1");

 (https://support.gamesparks.net/support/discussions/topics/1000082288)


If there is no other real player, after 10 seconds bot and player will matched.

After this. the realplayer gets an MatchFroundMessage, because the bots request matched the player ones.


...and than? How can i start this found match?


I hope you guys can help me.

if you have questions, feel free to ask me.


Thanks :)


Best regards

Steven



1 Comment

Hey,

Not sure it's the same issue, but I am having problem after receiving  MatchFroundMessage. On the match realtime script I have RTSession.onPlayerConnect. I catch only the real player, the bot doesn't reach the  onPlayerConnect method. Is this the right behaviour?

Login to post a comment