Got this error while running nakama js client on an expressjs api.
I use this to have matches with bot users.
So a request is made for a bot to play a match, and the endpoint creates a ticket for a specific bot user.
According to the error it is crashing when throwing an error from the socket PingPong method.
Is there a better solution for bot implementations?
The nakama-js SDK is not nodejs compatible so it expects to be loaded in a browser environment, but maybe you can get it to work by following the suggestions here.
Any suggestion on how to implement this? If any other language
Our recommended approach if using authoritative matches would be to drive the bots from the match handlers themselves, otherwise, and if the issue suggestions don’t work, you can try to use another of our available SDKs.
We want bots to interact with the game exactly like users, so we create accounts for them and so on.
Having them implemented on the match handler would mean the user matched against who?
Since i am in that area same, implementing server side bots this is my approach, it might not be your case but here it is:
- In MatchMaking “sceen” if time passes let say 2mins without a match, we would initialize a special match mode with bots
- For matching we can use any bot profile that previously we have created or we can do offline match making Offline-MatchMaking and use any player profile that is not currently online
- The bot logic depending on the need if you are going fully authorative be handled server side, of if you are going semi relayed or “offline” fully offline, but than you would need to programm either way AI…
I like your approach, I already handle most of the bot logic in the match handler, my question is how do u match users with bots? I have the same wait for 2 minutes without a match, and if that happens we create a ticket with a special flag, which matches you with a bot (but we create a ticket for the bot in our API)
You dont need the bot to create the ticket to have it getting matched with a user?
That depends on your well gameplay and needs. In our case it doesn’t need, we simply cancel match making ticket do rpc request to do “offline” matchmaking and return a profile, but in this screen when rpc finishes executing it returns result and sends request for match to be created, simulating “match making” process.
Actually, you dont use nakamas offline matchmaking I guess? Just authoritative matches?
You can use offline match making for better fetching of the profiles, instead to randomly aim at any player profile…
It gives better sense for players when they fight against real player profiles, rather than specially made bot profiles…