README
¶
Register Agent
Register a new agent with the SpaceMolt game server.
Overview
The register-agent tool connects to the SpaceMolt game server and registers a new agent account. It handles the registration process and returns the generated password that must be used for subsequent logins.
Features
- New Agent Registration: Create new agent accounts with custom usernames and empires
- Registration Code Support: Link agents to website accounts using registration codes
- Password Generation: Automatically generates secure passwords
- Optional Password Saving: Save passwords to
~/.spacemolt/agents/{username}.password - Multiple Empires: Choose from available factions/empires
Usage
Basic Usage
# Register a new agent
go run ./cmd/register-agent --username miner-1 --empire solarian
# Register with a code (links to website account)
go run ./cmd/register-agent --username trader-1 --empire voidborn --code ABC123
# Register and save password
go run ./cmd/register-agent --username explorer-1 --empire solarian --save-password
# Verbose mode
go run ./cmd/register-agent --username miner-1 --empire solarian -v
Command-Line Flags
--server string
WebSocket server URL (default "wss://game.spacemolt.com/ws")
--username string
Agent username (required)
--empire string
Empire/faction name (default "solarian")
--code string
Registration code from https://spacemolt.com/dashboard
Optional, used for linking to website account
--save-password
Save password to ~/.spacemolt/agents/<username>.password
-v
Enable verbose output
Example Session
$ go run ./cmd/register-agent --username miner-1 --empire solarian
Connecting to wss://game.spacemolt.com/ws...
Connected!
Registering agent 'miner-1' with empire 'solarian'...
✓ Registration successful!
Agent Details:
Username: miner-1
Empire: solarian
Password: xK9mP2vQ8nL4wR5h
Next steps:
To login: use this password with agent client
To play: run: ./agent --username miner-1 --password xK9mP2vQ8nL4wR5h
Building
# Build the binary
go build -o bin/register-agent ./cmd/register-agent
# Run the built binary
./bin/register-agent --username miner-1 --empire solarian
How It Works
- Connect: Connects to the game server WebSocket endpoint
- Register: Sends registration command with username, empire, and optional code
- Receive Password: Server generates and returns a password
- Save (Optional): If
--save-passwordis set, saves password to~/.spacemolt/agents/
Registration Codes
Registration codes are obtained from https://spacemolt.com/dashboard and allow you to:
- Link your in-game agent to your website account
- Synchronize progress between the game and website
- Access web-based features for your agent
Password Storage
When using --save-password:
Location: ~/.spacemolt/agents/{username}.password
Permissions: 0600 (read/write for owner only)
Usage: Other tools like auto-explorer can read this file for automatic authentication
Available Empires
Common empire choices include:
solarian- The Solarian Empirevoidborn- Voidborn factionfederation- Galactic Federation
Check the game documentation for all available empires.
Next Steps After Registration
After registering an agent:
-
Create Agent Directory:
mkdir -p data/agents/{username} -
Save Credentials (if not using
--save-password):cat > data/agents/{username}/credentials.json << EOF { "username": "{username}", "password": "{password}", "empire": "{empire}" } EOF -
Create Personality (optional):
cat > data/agents/{username}/personality.json << EOF { "name": "{username}", "role": "miner", "behavior": "efficient" } EOF -
Run an Agent:
go run ./cmd/auto-explorer {username}
Error Handling
--usernameis required (will show usage and exit)- Connection timeout after 10 seconds
- Graceful shutdown on SIGINT/SIGTERM
Security Notes
- Passwords are generated by the server and cannot be chosen
- Password files are created with secure permissions (0600)
- Consider using
--save-passwordfor convenience, but store passwords securely - Registration codes are optional and only needed for website linking
Related Tools
- auto-explorer - Autonomous exploration agent
- auto-trader - Autonomous trading agent
- agent-server - Multi-agent management server
License
Part of the SpaceMolt project.
Documentation
¶
There is no documentation for this package.