GEMP is a platform for running a rules-enforced CCG in a web-hosted fashion, so players can play in their browser. This instance of GEMP is for the Star Trek CCG.
The engine is adaptable to other games, but essentially requires forking and ripping out all the Star Trek-based stuff and replacing it with context specific to the game of your choice. The Star Wars CCG Players Committee has done so with their SWCCG GEMP, which is hosted publicly here. If forking for a new game, we recommend using this one as the base, as it contains several advancements not in the SW GEMP, including JSON-based card definitions and an updated Java version.
If the below instructions do not tell you what you need, please contact ketura in the #gemp-dev channel of the PC Discord and ask whatever questions you may have there.
GEMP is a server written for Java 18, using MariaDB for a MySQL database instance, and serving raw Javascript and barebones HTML/CSS for the client front-end (although a client rewrite is in progress to modernize the JS to something more palatable to modern developers).
GEMP is divided into several modules which each handle a different aspect of the game, albeit for now they cannot be hosted separately (tho this is a future improvement we would like to make)
This module manages the interface for the Javascript clients. Each JS operation that contacts the server will eventually terminate in a call to communication.js, which is ultimately just a wrapper for calls to RootUriRequestHandler, which routes each endpoint to the appropriate handler within gemp-stccg-server. From there the action could go anywhere depending on context.
gemp-stccg-client is also the home for the web portion of the project; everything in /src/main/web/ is served as-is to the browser client, and the bulk of the Javascript can be found in /js/gemp-022. /images contains icons, booster pack images, and other such resources.
This module contains the card definitions in HJSON format.
In 2022, all JSON definition files were converted to HJSON, which is a mutually-convertable dialect of JSON that includes support for comments and does not require redundant quotes in strings or commas in field definitions. Consult this list of editor extensions to get syntax highlighting support for your editor of choice.
When developing JSON cards, refer to the JSON Card Specification documentation.
Other data definitions besides cards are also stored in this module, including booster pack definitions, formats, sets, and sealed definitions.
This module contains definitions used throughout the project, including enums for card types, affiliations, zones, and the like. It also contains certain low-level classes for HTTP responses.
The home for classes used in executing game rules and also in generating card objects from JSON card definitions.
The entry point for the server and the home for all database interaction, hall management, game running, chat, tournaments, and other services.
This is also the home for the unit tests for the server, which will fail compilation if they do not pass: /src/test/java/com/gempukku/stccg. Besides various service tests, there is a cards subfolder which contains a place to put unit tests for new cards (including errata). All PC V-cards and errata have a class for holding tests for that card, which are initially generated from the same spreadsheet that is used for generating the images and manually expanded as needed (see ketura for help on that).
Old card unit tests were scattershot and stored in the /at subfolder as needed. Do not add to this subfolder; instead use the cards subfolder mentioned above.
GEMP includes tools for hosting within Docker, which makes setting up a local host a breeze (assuming the maintainers have kept the database scripts up-to-date). See the readme in the /docker subfolder for more advanced details and instructions on the organization, but the following are basic instructions on how to start a local copy of GEMP. Make sure to follow the advanced instructions if hosting a production instance, as it will give steps for updating the default ports and credentials for db accounts and such.
Install Docker (Docker Desktop if on Windows). If you are on Windows, make sure that when you install it you check all boxes that have Docker behave like it's on Linux.
Install your container manager of choice. portainer.io is highly recommended.
Pull the git repository down to your host machine
git clone https://github.com/PlayersCouncil/gemp-lotr.git
Open a command line and navigate to gemp-stccg/gemp-module/docker.
docker-compose up -d
Starting gemp_app....done
and Starting gemp_db....done
at the end. The database should have automatically created the gemp databases that are needed.
gempuser
/gemppassword
(unless you changed this). gemp_db
database with league_participation
and other tables, you're golden. Now we need to compile the gemp code.
Open a terminal inside the gemp_app
container
>_
icon next to gemp_app and click the Connect buttongemp_1
containerOpen in Terminal
Navigate to the gemp codebase: cd etc/gemp-module
Now tell Maven to compile the project: mvn install
Open gemp-stccg/gemp-module/docker/docker-compose.yml in your editor of choice, and uncomment this line. This will ensure that the container runs the GEMP server every time it is started automatically.
On your host machine cycle your docker container
gemp-module/docker
docker-compose down
docker-compose up -d
If all has gone as planned, you should now be able to navigate to your own personal instance of Gemp. Open your browser of choice and navigate to http://localhost:17001/gemp-module/ .
If you're presented with the home page, register a new user and log in. It's possible for the login page to present but login itself to fail if configured incorrectly, so don't celebrate until you see the (empty) lobby. If you get that far, then congrats, you now have a working local version of Gemp.
By default, the above instructions will create 3 admin accounts: asdf
, qwer
, and Librarian
, all with a password of asdf
. Decks on the Librarian user will be automatically included in the Deck Library for all users, and the other accounts can be used for personal testing. Be sure to delete and/or change the credentials of these accounts if deploying to a production environment.
We recommend editing GEMP server code in IntelliJ IDEA, but theoretically you can use your Java IDE of choice.
Follow the instructions in this document to enable "remote" debugging into a local active instance of GEMP for debugging tricky issues. Because of the way Maven is configured, you cannot have the remote debugging flag active and be able to compile GEMP within the Docker container, so this flag is mostly only useful for local debugging (where you can recompile through your IDE). If you are in a production environment, be sure to undo the changes mentioned before you need to recompile remotely.
(If anyone has insight into how this could be changed, please let us know.)