Contributing
Contract Extensions
Get started as a Primodium developer by cloning the example ReadDemo world extension.
# Clone the Primodium Developer repository:
git clone https://github.com/primodiumxyz/developer.git
# Change your active directory:
cd developer/examples/ReadDemo/packages/contracts
# Install the necessary packages and build the project:
pnpm i && pnpm build
# Test the project:
forge test
# Do a dry-run of deployment:
forge script script/RegisterReadDemoSystem.s.sol --fork-url https://primodium-sepolia.rpc.caldera.xyz/http
World extensions refer to player smart contracts that extend the functionality of Primodium's core contracts, which are documented in the world extensions guide.
Game Design
You can contribute to Primodium's design and balancing by submitting pull
requests to
@primodiumxyz/contracts/config/prototypeConfig.ts
(opens in a new tab),
which contains the main configuration for game prototypes in Primodium.
For example, the following code block from the above file defines the prototype
data for IronPlateFactory
, a building that produces IronPlates
from iron
mines. There are four fields that you can immediately modify to your own needs:
P_RequiredBaseLevel
denotes the base level required to construct or upgrade the building.P_RequiredResources
denotes the resources required to construct or upgrade the building.P_RequiredDependency
denotes the existing production rate required for the building to produce.P_Production
specifies the production resources and denotes its production rate.
{
// ...
IronPlateFactory: {
tables: {
P_Blueprint: { value: getBlueprint(2, 2) },
P_MaxLevel: { value: 7n },
},
levels: {
1: {
// Requires Main Base Level 1 to construct.
P_RequiredBaseLevel: { value: 1n },
// `Copper` is required to construct or upgrade.
P_RequiredResources: getResourceValues({ Copper: 200 }),
// `IronPlateFactory` requires a minimum `Iron` production rate of `0.2` per second to produce `IronPlates`.
P_RequiredDependency: getResourceValue({ Iron: 0.2 }),
// `IronPlates` are produced at a rate of `0.08` per second.
P_Production: getResourceValues({ IronPlate: 0.08 }),
},
// ...
},
}
// ...
}
See
@primodiumxyz/contracts/config/enums.ts
(opens in a new tab)
for the resource types available in Primodium. The following
prototype config in TypeScript is
generated into Solidity on compilation.
export enum EResource {
Iron = 1,
Copper,
Lithium,
Titanium,
Iridium,
Kimberlite,
Platinum,
IronPlate,
Alloy,
PVCell,
RocketFuel,
// ...
}
Source
See the Primodium source guide for details on how to reference Primodium's source in your world extensions.