Skip to content

Repository files navigation

poh.core

This is the kernel for the P2PMMO game: Proof of Honor.

The core is transaction-based and headless meaning that you can send your action-blocks to a buddy and a perfect copy of your character appears in their world.

  • it's written ontop of pico
  • can use hyperswarm for multiplay
  • is totally missing an UI - Please PR/or Issue if you build one!

asciicast

Objectives / How to play

Once every 24 hours a Hero may
append 1 block of actions - each block
must end with either going to sleep at a tavern or death.

boot

Initialize kernel and create a new character:

import{boot}from'poh'constkernel=awaitboot()constname='Duncan the peerless'constmemo='<Last words on death>'awaitkernel.createHero(name,memo)// character sheet is exposed as a reactive-storeconstunsub=kernel.$player(hero=>{console.log('current stats and inventory',hero)})unsub()

begin

Now that you have a kernel and a hero, you can begin exploring,
maybe visit the town for some shopping:

import{I,// ItemsA// Areas}from'poh/db'constsession=awaitkernel.beginPVE()// walk to townawaitsession.travelTo(A.crossroads)awaitsession.travelTo(A.town)// Buy a daggerawaitsession.interact(0,'buy',I.dagger,1)// Check inventorykernel.$player(h=>console.log('Inventory',h.inventory))()// Equip the weaponawaitsession.use(I.dagger)

Good, now we're ready for adventure!

// walk back to crossroadsawaitsession.travelTo(A.crossroads)// look for troubleconstencounter=awaitsession.explore(0)console.log('You encountered',encounter)

battle

If a the encounter is hostile, you'll be locked in session.state == 'battle'\ at which point you are forced to choose one of the following:

// Hit the critterresult=session.doBattle('attack')// Use a skill/spellresult=session.doBattle('cast','firebolt')// Attempt escaperesult=session.doBattle('run')

Note: Each round you're allowed to use 1 item session.use(I.herb)before you commit your combat action via session.doBattle()

sleep

Once you're happy with your achievements it's time to save state and call it a day:

// goto area with tavern/bedawaitsession.travelTo(A.town)// sleepconst[diff]=awaitkernel.commitPVE()console.log('gold, xp and stats gained',diff)

note: k.commitPVE() broadcasts your character to the network
if kernel was booted with swarm K = await boot(Hyperswarm)

Ok that's pretty much the gist of it;
But always keep an eye on:

kernel.$player(hero=>console.log('current exhaustion',hero.exhaustion))()

because:

Important

All actions that require random/rolls increase exhaustion

exhaustion>1024=DEATH

reference

Checkout test.js:89'Express gameplay as functions' for a complete implementation of gameplay.

Checkout testnet.js for multiplayer/w bots.

Prior attempt / version 0: PoH-2020

LICENSE

AGPL-version-3

Clarification:

  • do whatever you wish with your UI / assets
  • please PR patches and changes to kernel, so everyone can play the same game.
  • no sublicensing. the license is the license.

All wrongs reversed 🄯 2024 Tony Ivanov - decentlabs

About

P2PMMO game: Proof of Honor

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages