Back
Close

Extend the CodinGame SDK

Although the CodinGame SDK already includes the GraphicEntityModule, you can add modules to your game. Modules are extensions allowing you to directly interact with the viewer using PixiJS, which gives you a lot more control on its behaviour.

If you want to create your own module, see How to get started.

Usage

Importing the module

Modules on maven

You will need to include the module dependency in the pom.xml of your project.

You will also need to import your module to the src/main/resources/view/config.js file, in the modules array.

Example of a project using the Graphic Entity Module and the End Screen Module: pom.xml

<dependency>
	<groupId>com.codingame.gameengine</groupId>
	<artifactId>module-entities</artifactId>
	<version>${gamengine.version}</version>
</dependency>
<dependency>
	<groupId>com.codingame.gameengine</groupId>
	<artifactId>module-endscreen</artifactId>
	<version>${gamengine.version}</version>
</dependency>

config.js

import { GraphicEntityModule } from './entity-module/GraphicEntityModule.js';
import { EndScreenModule } from './endscreen-module/EndScreenModule.js';

export const modules = [
	GraphicEntityModule,
	EndScreenModule
];

Custom modules

Custom modules usually come up with a .java and a .js file. Place these files in src/main/java and src/main/resources/view respectively.

You will also need to import your module to the src/main/resources/view/config.js file, in the modules array.

Example of a project using the Graphic Entity Module and a custom module: config.js

import { GraphicEntityModule } from './entity-module/GraphicEntityModule.js';
import { CustomModule } from './modules/custom/CustomModule.js';

export const modules = [
	GraphicEntityModule,
	CustomModule
];
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io