This extension gathers some tools I use to develop more easily bots for CodinGame. The priorities of this extension are to satisfy my current needs while being simple. As a result, the extension is not very flexible or customizable.
You can read more about this extension and how to use it in this article on my blog.
Keep in mind that this extension is the first I write. Also, I never programmed in TypeScript before. Thus, there might be silly things I do here that make you want to pull your hair.
If you have any feature or improvement suggestions or want to participate in the development, let me know!
Create a new C++ bot project from a starter folder. The starter folder is expected to respect these rules:
- have a
CMakeLists.txt
at its root to build the project. This CMakeLists.txt must honor the following variables- REPOSITORY_ROOT, path of the root CodinGame folder, containing all bots and tools,
- INCLUDE_DIR, path to the main C++ include folder where you can place common headers and external library headers,
- LIB_DIR, path to the main C++ libraries folder where you can place external libraries.
- the build places the source code of the different bot versions in a
package
folder. Remember that the CodinGame platform requires the bots to fit in a single file. The current bot version is inpackage/bot.cpp
, - the
CMakeLists.txt
must ensure the filePreviousBotVersions.cmake
exists and include it.
I provide a working example of starter C++ CodinGame project in another repository.
Configure the build a bot, choosing its build type among Dev, Release, and Debug. Once the configuration is done, you can press CTRL+SHIFT+B
to build the project, if you used my starter C++ CodinGame project. You will also have symbol indexing, allowing you to navigate to symbols definitions or declarations, open headers, rename variables, find references, and so on.
Open a bot project store in a folder inside the root directory of your CodinGame projects. The command is case insensitive, so if you have a bot project named MyBot
, you can simply request the project for mybot
.
Save the current version of the bot, i.e. the file package/bot.cpp
, in a new file in the package
folder. The new file is added the PreviousBotVersions.cmake
in order to be compiled.
For this extension to behave as expected, you need to have the following tools installed:
- C/C++ VS Code extension,
cmake
to generate a build configuration for your projects,ninja
to build your projects; this generator is fast and providescompile_commands.json
which is used by IntelliSense,compdb
to extend thecompile_commands.json
file with headers, in order to improve the indexing done by IntelliSenseclang
to perform the indexing done by IntelliSense.
The starter C++ project I provide also requires python
to execute a script that merge multiple source files into one file. It also contains a .editorconfig
that could be recognized by the EditorConfig for VS Code extension.
This extension contributes the following settings:
codinGame.rootPath
: set it to the root directory of your CodinGame projects.codinGame.includePath
: set it to the folder path containing common headers you use in your bots and tools. If not defined, it will becodinGame.rootPath/tools/include
.codinGame.libPath
: set it to the folder path containing common libraries you use in your tools. If not defined, it will becodinGame.rootPath/tools/lib
.codinGame.starterPath
: set it to the folder path containing an initial configuration for a bot. If not defined, it will becodingGame.rootPath/tools/starter
codinGame.cmakeExtra
: extra arguments that are passed toCMake
when configuring the buildcodinGame.cCompilerPath
: path to the C compiler to use to compile bots. If not defined,CMake
will decide itself.codinGame.cppCompilerPath
: path to the C++ compiler to use to compile bots. If not defined,CMake
will decide itself.
- Updated extension to vscode 1.88 version
- Send bot code and get CodinGame Id commands were removed, as the CodinGame API changes too often to rely on it
- Removed settings associated with such commands
- Detect when we are trying to create a bot with an already used bot name.
- Global setting for
CPPCompilerPath
- Global setting for
CCompilerPath
- Global setting for
cmakeExtra
- Wait for the new project folder to be fully copied before opening it
- Path manipulation on Windows
- Images in the extension README
- Command to open bot project
- save current bot command now uses
PreviousBotVersions.cmake
file
- Command to create a bot project from a starter project
- Command to configure a bot build system
- Command to save current bot code as a named version
- Command to get CodinGamer Id from an account email + password
- Command to send a bot to CodinGame
- Global settings for
rootPath
,includePath
,libPath
, andstarterPath
that are used to create and configure a bot - Global settings for
gamerPassword
andgamerEmail
to connect to a CodinGame account - Project settings for
gameId
andisMulti
that are used to send a bot to CodinGame