There are 3 ways you can join a game with yolkbot:
All 3 of these are very easy to do, so let's get started!
This is very easy. You've already done it!
bot.join('my bot name', 'game-code-here');
That's it.
To create a game and join it, you can use the createPrivateGame method.
import { GameMode } from 'yolkbot/constants';
const game = await bot.createPrivateGame('useast', GameMode.FFA, 'Eggcrates');
A list of game modes is available in the GameMode constant. The map name is case insensitive.
This will create a private game with the specified region, mode, and map. The game variable will contain the game object, which you can use to interact with the game.
You can then join the game using the join method:
await bot.join('my bot name', game.id);
The createPrivateGame method ONLY CREATES A GAME. It does not JOIN the game. You must call join after creating the game to actually join it, or it will be an empty game.
To find a public game and join it, you can use the findPublicGame method. This will return a list of public games that you can join.
import { GameMode } from 'yolkbot/constants';
const game = await bot.findGame('useast', GameMode.FFA);
await bot.join('my bot name', game.id);
Similar to the createPrivateGame method, this does not join the game automatically. You must call join after finding the game to actually join it. A list of game modes is still available in the GameMode constant.
Once you've joined a game, you can do TONS of different things. Check back to the game introduction for information on what you can do in a game.
You can always use bot.leave() to leave a game and then join another one with any of the above methods.
There are 3 ways you can join a game with yolkbot:
All 3 of these are very easy to do, so let's get started!
This is very easy. You've already done it!
bot.join('my bot name', 'game-code-here');
That's it.
To create a game and join it, you can use the createPrivateGame method.
import { GameMode } from 'yolkbot/constants';
const game = await bot.createPrivateGame('useast', GameMode.FFA, 'Eggcrates');
A list of game modes is available in the GameMode constant. The map name is case insensitive.
This will create a private game with the specified region, mode, and map. The game variable will contain the game object, which you can use to interact with the game.
You can then join the game using the join method:
await bot.join('my bot name', game.id);
The createPrivateGame method ONLY CREATES A GAME. It does not JOIN the game. You must call join after creating the game to actually join it, or it will be an empty game.
To find a public game and join it, you can use the findPublicGame method. This will return a list of public games that you can join.
import { GameMode } from 'yolkbot/constants';
const game = await bot.findGame('useast', GameMode.FFA);
await bot.join('my bot name', game.id);
Similar to the createPrivateGame method, this does not join the game automatically. You must call join after finding the game to actually join it. A list of game modes is still available in the GameMode constant.
Once you've joined a game, you can do TONS of different things. Check back to the game introduction for information on what you can do in a game.
You can always use bot.leave() to leave a game and then join another one with any of the above methods.