How to set up a new expansion
I've set up four game expansions, and it's really a lot of work. This list will probably change over time, but at least having some of this written down will help for the next time. For the sake of discussion, let's call the new module "Aliens". At times the docs suggest changing in several places in one file. You can look at one of the existing expansions. I recommend using one of the less intrusive expansions.
-
Add entry to
GameModule.ts
with this line:Aliens = 'aliens',
-
Create the directory
src/cards/aliens
-
Create a manifest
src/cards/aliens/AliensManifest.ts
-
Add the manifest to
AllCards.ts
. -
If you're creating Global Events, update
GlobalEventDealer.ts
-
Define the option.
-
In
src/Game.ts
, updateGameOptions
,DEFAULT_GAME_OPTIONS
-
Add line in Game.deserialize, below
const gameOptions = d.gameOptions
`gameOptions.aliensExpansion = d.gameOptions.aliensExpansion ?? false;`
This will maintain backward compatibility for old games. You can remove that some time long after you no longer have games on your server that didn't have that variable defined.
-
Add the option to
src/models/ServerModel.ts
-
Define the option in
src/models/GameOptionModel.ts
-
Add a default value to
src/tools/analyze_ma.ts
-
Update
ApiGame.spec.ts
-
Register the manifest in
src/CardLoader.ts
, in bothmanifests
and possiblyexpansions
. -
Update the UI components.
-
In
src/styles/cards.less
, add.aliens-icon:after
andexpansion-icon-aliens
- Consider adding any assets to
assets/aliens
rather thanassets
.
- Consider adding any assets to
-
Create an entry for the icon in
src/client/components/card/CardExpansion.vue
-
Update
src/client/components/DebugUI.vue
. There are many places to change within that file. -
Update
GameSetupDetail.ts
There are a few places you need to make changes, including- The check box
CreateGameModel
NewPlayerModel
data()
serializeSettings
- dataToSend
-
The server-end of this change has to be changed in
src/routes/Game.ts
-
It is possible you will need to hook up into
GameEnd.vue
,SpectatorHome.vue
andPlayerHome.vue
- If you want to create additional data to be stored as part of the game, that's something else, but here's two steps you'll need to take:
-
In
src/SerializedGame.ts
add the matching field inGameOptions
. -
In
src/Game.ts
, update methodsserialize
anddeserialize
.- If you are concerned about existing games' backward compatibility, add tests that ensure old games can load even without the serialized data.
- Update
CreateGameForm.vue
andCustomCorporationsFilter
to make the new expansion selectable.
The game
Fan Expansions
Development
- Databases
- Development tips
- Docker Setup
- dot env
- Heroku Setup
- Local Setup
- Changing-game-data-for-local-testing
- Adding New Cards
- Working with VSCode
- Postgres Notes
- Translations
Other