What You’ll Build
In this guide, we’ll create a Water Well object that:- Has two visual states (full and empty)
- Players can interact with to collect water
- Refills automatically after a timer
- Gives players a water bucket item
Prerequisites
Before starting, ensure you have:- Texture files prepared (PNG format)
- The
data-packerCLI tool built - Basic understanding of GCFG manifest format
Step 1: Create Object Textures
Prepare Texture Files
Create two PNG texture files for your object states:
water_well_full.png- Shows a well with waterwater_well_empty.png- Shows an empty well
assets/textures/).Create Texture Manifest
Create or update your texture manifest file (
textures.gcfg):textures.gcfg
Texture IDs must be unique across your entire game. ID 0 is reserved.
Step 2: Define the Object
Create Object Manifest
Create or update your object manifest file (Field explanations:
objects.gcfg):objects.gcfg
| Field | Description |
|---|---|
name | Internal identifier for the object |
id | Unique numeric ID (must match your script constants) |
flags | Object capabilities - STATE for multiple states, INTERACT for player interaction |
textures | Array of texture names - index corresponds to state number |
interact_text | Text shown to player when near the object |
Understanding Flags
Available object flags:
STATE- Object has multiple visual states (requires multiple textures)INTERACT- Players can interact with the object (requiresinteract_text)
Step 3: Implement Behavior
Add Object Constant
Edit
server-go/scripts/constants.go to add your object:server-go/scripts/constants.go
Step 4: Place on Map
Now that your object is defined and has behavior, place it on the map:Load in Map Editor
- Open the GRPG Map Editor
- Click Load Objs and select
objects.grpgobj - Click Load Textures and select
textures.grpgtex
Advanced Example: Multi-State Mining Rock
Here’s a more complex example with three states:objects.gcfg
server-go/content/iron_rock.go
Object Flags Reference
Fromdata-go/grpgobj/grpgobj.go:17:
Manifest Format Details
GRPG uses the GCFG format for manifests. Key features:- Section-based structure with
[SectionName] - Array support with
[] - String, integer, and boolean types
- Comments with
#
Troubleshooting
Object doesn't appear in map editor
Object doesn't appear in map editor
- Ensure you clicked Load Objs and selected the correct
.grpgobjfile - Verify the manifest packed successfully without errors
- Check that texture references in the manifest exist in your texture file
Object has wrong texture
Object has wrong texture
- Verify texture names in manifest match exactly (case-sensitive)
- Ensure textures were packed before objects (objects reference texture IDs)
- Check state numbers match texture array indices
Interaction doesn't work
Interaction doesn't work
- Confirm object has
INTERACTflag in manifest - Verify object constant ID matches manifest ID
- Check that content file is in
server-go/content/directory (automatically imported) - Ensure server was rebuilt after adding the script
Error: 'interact_text without interact flag not allowed'
Error: 'interact_text without interact flag not allowed'
Add the The packer validates that
INTERACT flag to your object:interact_text is only set when INTERACT flag is present.Next Steps
Map Creation
Learn how to place objects using the map editor
Asset Pipeline
Understand the complete asset workflow