Basic bot template? (solved)

Hi there - would anyone be interested in sharing a bot implementation?

I'm looking for a way to add bots as clients server side, some way to differentiate bots from regular clients, and a way to have the bot perform some action based on a state change in my main room.

Any help would be greatly appreciated and thanks Endel.

@wickedst Up. I have a same problem

The problem with bots is those are too game logic specific, so anyone will hardly make a bot that will be easy to move from one game into another.
The only way I can think of it, is by creating a "base schema" for the bot movement state (I mean using specific properties calle "x", "y", "z"), and then run a small method that will make changes on those properties (this will be move the bot).
For example, using intervals you can increase/decrese the x, y, z values for some specific time, then do a random to pick another property and do it again.
Now: my point is, that will get totally invalid if you have a physics engine implemented where you need to change the bot speed, or deal with gravity, friction, etc.
The easy part will be you can treat bots as any other players, so you shouldn't need to change anything on the client to make these work, just add the entities on the server and make them move randomly.

Hope this helps!

For bots in our game, we simply use the colyseus.js client libraries and have the matchmaker add them to the game room if they are needed. Each bot is an object of the Bot class.

We then setup listeners for the bot similar to how the actual client listens, like when a card is played then do something.

Generally we try to avoid treating the bot differently from an actual client which makes our workflow and loadtesting much easier as the game does not care what kind of client has joined + we can offload bots to a different process or server if needed.

We leave it up to the matchmaker if the game needs a bot then simply create one and join them to the room, to the player they look exactly the same as a real player. We also have special Bot rooms where the client might want to intentionally play against a bot, like in a campaign.

Here, we simply extend the base game and have the bot join as part of the joining logic, i.e, we create and join the bot once the player has joined the room.

If there is anything specific you would like me to expand on then I will try to get back to you.