Solana Civ

A fully on-chain game built on Solana. SolanaCiv is inspired by Civilization games. In SolanaCiv, players manage their civilization by building cities, farming resources, recruiting units, researching new technologies, trading with each other, and fighting off barbarians. The game is turn-based. Players can perform many actions (transactions) per turn: move units, build, fight, upgrade, research and more.

Demo: https://solciv.com

Audit

Program is audited by sec3 X-ray scanner. Report is available here: sec3-report.pdf

The reported issue is false positive, as the unchecked account is needed for withdrawals from burner to any Solana address.

Run locally

anchor build && anchor test

Game design

Initialization

  • When a player joins, frontend generates a burner wallet and funds it with devnet SOL. Session keys will be used in mainnet for a smooth gaming experience.
  • Program initializes the civilization with a starting amount resources, and 3 units: Settler, Builder and Warrior. Resources and units are soulbound to a game session and cannot be transferred to a different game session.

Turn mechanics

  • At the start of each turn, players receive (or lose) resources based on their current buildings and units to maintain.
  • Players can then choose actions for their workers, soldiers and cities. Every action is an on-chain transaction. Players can research new technologies, construct buildings, recruit units, move units on the global map, send soldiers to fight barbarians.

Construction

  • Building a structure costs production points that are generated by every city. Some structures can be built only by workers on the global map, other directly in the city.
  • Construction time depends on the production params of the specific city.

Resource gathering

  • Resource generation occurs at the beginning of each turn, affected by the number and type of buildings and units.

Resources

  • 🪙 GOLD - currency for trading, building and maintenance.
  • 🌽 FOOD - needed for recruiting and healing of units.
  • 🪵 LUMBER, STONE - required for constructing buildings and to repair damaged citites.
  • IRON - required to recruit advanced military units (e.g. swordsmen)
  • Science points and Production points generated by cities and corresponding buildings.

Technology tree | Science

Military Tree

Technology Research Points Unlocks
Archery 15 🧪 Archer
Iron Working 21 🧪 Swordsman, Forge
Medieval Warfare 30 🧪 Crossbowman, WallMedieval
Gunpowder 42 🧪 Musketman, WallRenaissance
Ballistics 60 🧪 Rifleman
Tanks and Armor 80 🧪 Tank, WallIndustrial

Science & Economy Tree

Technology Research Points Unlocks
Writing 5 🧪 Library
Education 7 🧪 School
Economics 10 🧪 Bank, Market
Academia 14 🧪 University
Astronomy 18 🧪 Observatory
Capitalism 22 🧪 StockExchange

Production & Agriculture Tree

Technology Research Points Unlocks
Agriculture 6 🧪 Granary, Mill
Construction 8 🧪 Wall, Bakery
Industrialization 12 🧪 Factory
Electrical Power 16 🧪 EnergyPlant
Modern Farming 20 🧪 Supermarket

Units

Image Unit Movement Melee HP Cost Maintenance
Worker 2 0 ❤️ 1 🌽 50 0
Scout 3 ⚔️ 10 ❤️ 100 🌽 30 0
Warrior 2 ⚔️ 20 ❤️ 100 🌽 40 🪙 1
Swordsman 2 ⚔️ 35 ❤️ 100 🌽 90 🪙 2

Buildings

Image Building Production Cost Maintenance Construction time
Barracks Allows the recruitment of soldiers 🪵 30 🪙 2 5 turns
Wall Adds ❤️ 50 to the city 🪵 150 🪙 1 9 turns
Market 🪙 3 per turn 🪵 120 0 7 turns
Farm 🌽 3 per turn 1 worker 0 0
Lumber Mill 🪵 3 per turn 1 worker 0 0

Fights with barbarians

  • The likelihood of encountering barbarians increases with each turn.
  • Players can send soldiers to fight barbarians.
  • If successful, players earn GEMS that can be withdrawn to a personal wallet
  • If unsuccessful, soldiers can die.

End of the game

  • Player wins when all enemies are defeated.
  • Player can restart the game with a new generated map at any time.

Roadmap & future expansions

  • Multiplayer mechanics, match-making
  • Enhanced in-game reward system, DEX
  • Assets store for third-party content creators and developers
  • Mobile app (the game is already playable on mobile via web browser)
  • New game mechanics:
    • Alliances and diplomacy
    • A greater variety of land tiles, resources, units, buildings, and technologies
    • Distinct nations
    • Culture and tourism mechanics
    • Story mode
    • And much more, this is only the beginning ;)