#

bsc

(2 articles)

Dark Forest: Fully On-Chain 3D MMO SLG — Every Rule Is in the Contract

# Dark Forest: Fully On-Chain 3D MMO SLG — Every Rule Is in the Contract ![](https://public.bnbstatic.com/image/pgc/20260716/48bf0d8c0d5441ba9c760cd623490b48.png) Most "blockchain games" are Web2 frontends with a token contract on top. Real game logic runs on centralized servers — no different from traditional games. Dark Forest is different. 10 Solidity contracts (all <24KB, EVM L1 compatible) carry the complete game logic: 3D coordinate space, fog of war enforced by distance and energy, five tech trees with no level cap and N² quadratic growth, a player-driven energy order book market, alliance totem system, daily token distribution (unclaimed = burned), and an AI Agent automation framework. All state is on-chain. All rules are in the contract. Nobody can change them. ✅ LIVE on BSC Mainnet — 10 contracts verified on BscScan, source code publicly available. Distance Is the Only Fog of War All civilization coordinates are public on-chain. Anyone can call getCivilization(address) to read any player's exact 3D position. Three contract-enforced constraints make the dark forest law work: Distance gate — You can only attack what your radar can see. The contract rejects attacks beyond scan range. Token bucket rate limiter — Attack frequency is hard-capped. Lv.1 weapon: ~3s between attacks. Lv.100: ~1s. You cannot stand and spam attacks. Energy cost — Each attack costs 50,000 + 50,000 × weaponLv energy. Lv.1 costs 100k. Lv.10 costs 550k. You fire a few shots and must retreat to resupply. Public coordinates do not mean you can do anything about them. Five Tech Trees — N² Growth, No Level Cap All systems have no level cap, using N² quadratic growth. Upgrade costs use the Anchor Formula — simulating locking DFT for N days equivalent. Energy Collector: 3 + 10√(L-1) energy/sec, 1× cost. Your economic lifeline. Weapon System: 900 + 10L² attack power, 4× cost. Exponential destructive power. Shield System: HP 3,600 + 15L², Defense 540 + 6L², Regen 50 + L²/sec, 4× cost. Survival core. Radar System: 1,000 + 150L + 5L² light-seconds, 8× cost. See farther, fight farther. Engine System: 10 + 5(L-1) light-seconds/hour, 16× cost. Most expensive, fastest. Key levels: Lv.1 → Lv.10 → Lv.50 → Lv.100 Weapon: 910 → 1,900 → 25,900 → 100,900 attack Shield: 3,615 → 5,100 → 41,100 → 153,600 HP Radar: 1,155 → 3,000 → 56,500 → 66,000 ls range Engine: 10 → 55 → 255 → 505 ls/h speed A single Lv.100 weapon shot deals 40,560 shield damage + 80,720 health damage = 121,280 total. Enough to one-shot anyone below Lv.100 shields. Combat System — Real On-Chain Math Attack Power = 900 + 10 × weaponLv² Defense Power = 540 + 6 × shieldLv² + alliance bonus Shield Damage = max(0, atk + 200 - def) Health Damage = atk > def ? (atk - def) × 2 : 0 Overflow = shield breach overflow × 3 (deadly!) Plunder = defender.energy × (5% + 0.5% × weaponLv) When health hits zero: lose one random system level. If all already Lv.1 — civilization becomes ruins. Attacker takes all remaining energy. System downgrade compensates defender with 5% of upgrade cost. This creates a dynamic food chain: top players periodically plunder lower-level civs like sheep farming. Rebirth System — Death Makes You Stronger Being destroyed is not the end. Rebuild from ruins — every death makes your next life stronger. Energy: 500,000 × (1 + 0.12 × rebirthCount), capped at 20× DFT: 100 + 10 × rebirthCount, capped at 2,000 DFT Retained on rebirth: coordinate location, permanent +12% attack AND defense per rebirth, stackable 3× (max +36%). Systems reset to Lv.1. Health restored to 50%. Veterans with 3 deaths become +36% monsters. True roguelite progression on-chain. Energy Economy Energy is the ultimate resource. Not purchased — generated by time. Collection rate = (3 + 10√(L-1)) × (1 + 0.002 × referrals) energy/sec. Generates even while offline. Maintenance cost: every action deducts totalLevel × 2,000 × timePassed / 1 day. The bigger you are, the faster you burn. Don't fight and you starve. Fight and you may die. DFT Token — Claim or Burn Total supply: 420,690,000,000,000 (hard cap). Emission: 3,650 days (~10 years). Daily: ~1,152,575,342 DFT. Trading tax: 2.5% (1% dev + 1.5% marketing). Every day at UTC 0: previous unclaimed DFT is burned, active civilizations counted, each player can claim dailyEmission / playerCount. If you forget to claim, your DFT is gone forever. Energy Market — Real Order Book Fully on-chain limit order book via EnergyMarket.sol. Sellers lock energy, buyers pay DFT. 1% protocol fee. 3-second anti-sniping delay. War drives energy prices up. Peace brings them down. Pure player-driven price discovery. Alliance & Totem Max 100 members. Leave penalty: 100 + 10 × memberCount DFT. 24-hour cooldown. Totem provides defense bonus: (members - 1) × 8 × (1 + 0.005 × totemLevel). Build cost: 20,000,000 × N × (N+5) / 10 energy. Members donate every 48h or lose bonus. AI Agent System — Program Your Civilization Native AI Agent automation via DarkForestAgentRegistry. Permission bitmasks: collect(1), repair(2), claim(4), attack(32), upgrade(64), jump(128), rebuild(256), donate(512). Contract-level limits: max attacks/hour, max upgrades/day, max upgrade cost, attack whitelist/blacklist. Deploy automated warriors with safety fences. Python SDK with 4 strategy templates: aggressive (45 attacks/h), balanced (15), defensive (5), farmer (0). Space Jump — DFT Burn Jump to random coordinates. Costs DFT — directly burned from circulation. Tracking jump (Radar Lv.20+) lets you jump directly to any player. An Autonomous World, Not Just a Game No admin: owner renounced. No downtime: as long as BSC runs, the game runs. No hidden rules: every formula verifiable. No pay-to-win: time is the only currency. How long can your civilization survive in the dark forest? Website: https://darkforest.uk GitHub: https://github.com/RabbitChaindevs/Dark-Forest

Dark Forest:全链上 3D 宇宙 MMO SLG — 每一行规则都在合约里

# Dark Forest:全链上 3D 宇宙 MMO SLG — 每一行规则都在合约里 ![](https://public.bnbstatic.com/image/pgc/20260716/48bf0d8c0d5441ba9c760cd623490b48.png) 大多数所谓的"区块链游戏"只是一套 Web2 前端加一个用来提取流动性的代币合约。真正的游戏逻辑运行在中心化服务器上——跟传统游戏没有本质区别。 Dark Forest 不是这样。 10 个 Solidity 合约(全部 < 24KB,EVM L1 兼容)承载了完整的游戏逻辑:3D 坐标空间、战争迷雾(由距离和能量双重约束实现)、五条科技树(无等级上限,N² 抛物线增长)、玩家驱动的能源订单簿市场、联盟图腾系统、每日代币分发(未领取即销毁)、乃至 AI Agent 自动化权限框架。 所有状态都在链上。所有规则都在合约里。没有人可以更改它们。 ✅ 已上线 BSC 主网——10 个合约全部通过 BscScan 验证,源码公开可查。 核心世界观:距离是唯一的战争迷雾 传统 SLG 用中心化服务器隐藏玩家位置来制造战争迷雾。Dark Forest 不做这件事——所有文明坐标在链上完全公开,任何人都可以通过 getCivilization(address) 读到任意玩家的精确 3D 坐标。 那黑暗森林法则如何成立?合约强制执行三个约束: 距离锁 —— 你看得再远,也只能打到雷达范围以内的敌人。合约直接拒绝超距攻击。 攻击令牌桶 —— 你不能站桩连打。Lv.1 武器约每 3 秒一次,Lv.100 武器约每 1 秒一次。 能量锁 —— 每次攻击消耗 50,000 + 50,000 × weaponLv 能量。Lv.1 消耗 10 万能量,Lv.10 消耗 55 万。你在战场上打不了几发就必须撤退补给。 三条约束叠加——坐标公开不等于你能为所欲为。 五条科技树:没有尽头的力量 所有系统没有等级上限,使用 N² 抛物线增长。升级成本使用 Anchor 公式——模拟玩家锁定 DFT 的天数等价来决定真实成本。 能量采集器:3 + 10√(L-1) 能量/秒,成本乘数 1×。你的经济命脉。 武器系统:900 + 10L² 攻击力,成本乘数 4×。破坏力指数增长。 护盾系统:HP: 3600 + 15L²,防御: 540 + 6L²,回复: 50 + L²/秒,成本乘数 4×。生存之本。 雷达系统:1000 + 150L + 5L² 光秒,成本乘数 8×。看得越远,打得越远。 引擎系统:10 + 5(L-1) 光秒/小时,成本乘数 16×。最贵也最快。 关键等级数据: Lv.1 → Lv.10 → Lv.50 → Lv.100 武器攻击力:910 → 1,900 → 25,900 → 100,900 护盾 HP:3,615 → 5,100 → 41,100 → 153,600 护盾防御:546 → 1,140 → 15,540 → 60,540 雷达范围:1,155 → 3,000 → 56,500 → 66,000 光秒 引擎速度:10 → 55 → 255 → 505 光秒/时 能量速率:3 → 33 → 76 → 103/秒 Lv.100 武器一发伤害 = 40,560 护盾伤害 + 80,720 生命伤害 = 12 万+。一炮秒杀一切 Lv.100 以下的护盾。 战斗系统:真实的链上博弈 攻击力 = 900 + 10 × weaponLv² 防御力 = 540 + 6 × shieldLv² + 联盟加成 护盾伤害 = max(0, 攻击力 + 200 - 防御力) 生命伤害 = 攻击力 > 防御力 ? (攻击力 - 防御力) × 2 : 0 溢出伤害 = 护盾被击穿后的剩余伤害 × 3(致命惩罚!) 掠夺能量 = defender.energy × (5% + 0.5% × weaponLv) 生命归零时,你的文明不是直接被删除——而是随机降级一个系统。如果所有系统都已 Lv.1——文明被摧毁变为废墟。攻击者获得你剩余的全部能量。系统降级会补偿你 5% 之前升级消耗的能量。 这创造了一个动态的食物链:顶级玩家像养羊一样周期性掠夺低级文明的能量,而低级玩家必须抱团或保持低调才能生存。 转生系统:死亡让你更强 被摧毁不是终点。你可以从废墟中重建——每次重建让你在下一世变得更强。 能量 = 500,000 × (1 + 0.12 × 转生次数),上限 20 倍 DFT = 100 + 10 × 转生次数,上限 2,000 DFT 保留:坐标位置不变、永久战斗加成:每次转生 +12% 攻击和防御、可叠加 3 次(最高 +36%)。系统重置为 Lv.1,生命恢复至 50% 上限,装备耐久度重置。 这意味着被摧毁次数最多的玩家最终会成为赛博坦级别的怪物——重生三次的老兵带着 36% 的永久加成重回战场,即使系统等级不高也能以弱胜强。真正的 Roguelite 链上体验。 能量经济:一切都是能量 能量不靠充值获得——只靠时间产生。 采集速率 = (3 + 10√(L-1)) × (1 + 0.002 × 推荐人数) 能量/秒。你的采集器每秒钟都在产生能量——离线也在产。 日常维护费(核心机制):每次任何操作都按比例扣除维护费:总等级 × 2,000 × 时间差 / 1 天。你在合约里存活的每一天都在烧能量。等级越高,烧得越快。不出击就会饿死,出击也可能战死。 DFT 代币:每日分发,不领就销毁 总供应量 420,690,000,000,000(420.69 万亿)硬顶。释放周期 3,650 天(约 10 年)。每日释放约 1,152,575,342 DFT。交易税 2.5%(1% 开发 + 1.5% 市场)。 每天 UTC 零点,合约执行 distribute():上一轮未领取的 DFT 全部销毁、统计当前活跃文明数量、每个玩家可领取每日释放量/活跃玩家数。如果你忘记领取,你的 DFT 就永远消失了。 能源市场:真正的链上订单簿 EnergyMarket.sol 实现了完全链上的限价订单簿。卖方创建订单锁定能量,买方支付 DFT 获得全部能量。每笔成交收取 1% 协议费,3 秒订单延迟防止同一区块抢跑。 战争期间能源价格飙升,和平时期价格下跌。完全是玩家驱动的真实价格发现。 联盟与图腾 最多 100 名成员。退出罚款:100 DFT + 10 DFT × 成员数(分给剩余成员)。退盟后 24 小时冷却期。 联盟可以建造和升级图腾——共享能量池提供战斗加成。联盟防御加成 = (成员数 - 1) × 8 × (1 + 0.005 × 图腾等级)。成员每 48 小时必须捐献能量才能保持加成。没人捐献?加成消失。联盟的凝聚力直接体现在战场上。 AI Agent 系统:编程你的文明 原生支持 AI Agent 自动化。玩家向 AgentRegistry 注册代理合约,通过位掩码赋予精细权限:采集能量(1)、修复系统(2)、领取 DFT(4)、攻击(32)、升级(64)、跳跃(128)、重建(256)、图腾捐献(512)。 安全围栏:合约级别的硬约束——每小时最大攻击次数、每日最大升级次数、单次升级成本上限、攻击白名单/黑名单。任何人都可以部署带有安全阀门的自动化战士。 项目自带的 Python SDK 提供了四种预设策略模板:aggressive(45次/时)、balanced(15次/时)、defensive(5次/时)、farmer(0次)。 空间跳跃:真正的 DFT 燃烧机制 玩家可以 spaceJump() 随机跳跃到宇宙中的新坐标。每次跳跃消耗 DFT——直接从流通中销毁。追踪跳跃(雷达 Lv.20+)可以直接跳到一个玩家身边。 一个自主世界,不是游戏 没有管理员:owner 已 renounce。没有停机:只要 BSC 在跑,游戏就在跑。没有暗箱操作:所有公式都在合约里,任何人可验证。没有氪金必胜:时间才是唯一真正的货币。 你的文明能在黑暗森林中存活多久? 官网:https://darkforest.uk GitHub:https://github.com/RabbitChaindevs/Dark-Forest