Programming Game

  • Game
  • Resources
  • Docs

Getting Started

While the demo is playable in the browser, the full game is played via the the npm package programming-game and code running on your machine.

If you're you're trying to get up and running quickly, you can clone the starter-template.

Your first actions

A simplified version of the starter code might look like this:

In order to act in the world of Programming Game, you need to return a player action from the

onTick
function.

The code snippet above will tell your player to move from their current position to

{ x: 1, y: 0 }

Adapting to the state of the world

onTick
is called with every update from the server. If you want your character to move in a particular direction, you'll need to return an action relative to its current position.

The example below will move the player to the right indefinitely.

Defending Yourself

When you stray far enough from the safety of town, you'll begin to encounter hostile creatures. It's important to defend yourself against those that would do you harm.

In the simplest form, you can look for nearby monsters, and attempt to attack them.

Maintaining your health

Any damage you take will be healed over time by converting your calories to hp, but the further you venture from town, the more dangerous the world becomes.

When you're low on health, you can return to town to be healed by the merchant there.

Quests

Some NPCs offer quests that you can complete for rewards. Some items can only be obtained through quests, but some quests may offer rewards that are not worth the effort. Completing quests might also unlock new quests.

The following snippet will use

acceptQuest
to take on any quests that are available.

Completing Quests

The client will keep track of your active quests, as well as their progress. But it's up to you to determine whether they're ready to turn in.

You can check on a quest's progress by checking each of its steps. When you're ready to turn in a quest, you can return the

turnInQuest
action.

Handling Death

Dying is inevitable, and painful. While you can always

respawn
back at town, you lose everything you were carrying.

What's Next?

This covers the absolute basics of the world, you'll need to learn to manage your inventory, acquire and eat food, craft items, use spells, and party with others.