Skip to content

For developers

The Modding Tree Tutorial: Build a Tree Incremental in 9 Steps, With 4 Games to Learn From

The Modding Tree tutorial in plain steps: fork, modInfo, layers, upgrades, milestones, buyables, a second layer and publishing, plus real TMT games to study.

The Modding Tree (TMT) is a free JavaScript engine for tree-style incremental games, described in its README as 'an incremental game engine based on The Prestige Tree.' You fork it on GitHub, edit two files, mod.js and layers.js, and refresh index.html in your browser to test. No build step, no install beyond a code editor.

This tutorial follows the engine's own getting started and making a mod guides, condensed into nine steps with the exact code, then shows four real TMT games that show how far it goes, plus Profectus for when you outgrow it. TMT's changelog last lists v2.6.6.2 from September 2021, so treat it as a stable, finished engine rather than a moving one.

01

Step 1: Fork it and run it locally: best for getting a playable copy in ten minutes

Platform: GitHub, GitHub Desktop and Visual Studio Code. All free

Make a GitHub account, open the TMT repository and click Fork. In GitHub Desktop choose 'clone a repository,' pick your fork and clone it. Then click 'show in explorer/finder' and open index.html. That is the game, running locally.

The official guide recommends GitHub Desktop over the command line on purpose: it makes updating TMT easier, lets you undo changes, and gives you free hosting later. Open the project in VS Code from GitHub Desktop and keep the browser tab next to it.

Your loop for the rest of this tutorial is edit, save, reload the page.

Watch out for: Opening index.html from disk works for TMT, but some browsers restrict local files. If something fails to load, run a tiny local server instead.

02

Step 2: Set modInfo once, carefully: best for naming your game without wiping saves later

Platform: js/mod.js

In mod.js, the modInfo object starts as name 'The ??? Tree', author 'nobody', pointsName 'points', initialStartPoints of 10 and an offlineLimit of 1 hour. Change the name, author and pointsName, and above all set a unique id: the docs say it determines where the save file lives, so changing it later 'will effectively wipe existing saves.'

Set VERSION's num and name, and the winText shown at the end. getPointGen() in the same file is where point income is calculated; every boost you add later ends up there.

One tip from the official tutorial worth repeating: turn off offline progress in the game's settings while testing, so stray time away does not trick you into balancing around timewalls.

Watch out for: Pick the id now and never change it. Our save system guide explains how TMT keys saves by that id.

03

Step 3: Understand the first layer: best for knowing what each line of the template does

Platform: js/layers.js

layers.js opens with addLayer('p', {...}). The 'p' is the layer id used everywhere. The template sets requires to 10 points, resource 'prestige points', baseResource 'points', type 'normal', exponent 0.5, row 0 and a hotkey so pressing P resets. Change name, color, symbol and resource to make it yours.

A 'normal' layer pays prestige currency based on your points raised to the exponent; a 'static' layer instead gets more expensive the more you own. Our cost formula guide explains both curves and when to pick each.

Reload, earn ten points, and press the node's reset button. You have a prestige game.

Watch out for: Everything in TMT is a Decimal, a big-number type. Write x.add(y), x.times(y) and x.pow(y) instead of plus and times signs, or values silently break.

04

Step 4: Add upgrades: best for your first boosts and effect formulas

Platform: upgrades object inside a layer

Add an upgrades object to the layer. Ids are positions: 11 is row one, column one; 12 is the next one along. Give upgrade 11 a title, the description 'Double your point gain.' and cost new Decimal(1), then in getPointGen add: if (hasUpgrade('p', 11)) gain = gain.times(2).

Upgrade 12 scales: an effect() returning player[this.layer].points.add(1).pow(0.5) and an effectDisplay() that formats it with an 'x'. Apply it with gain.times(upgradeEffect('p', 12)). Upgrade 13 can boost the layer's own currency through gainMult().

Those three upgrades, flat, scaling and feedback, are the pattern for almost every upgrade you will write.

Watch out for: Effects are not applied automatically. If an upgrade does nothing, check that its effect is used in getPointGen, gainMult or wherever it belongs.

05

Step 5: Add milestones: best for automation and quality-of-life rewards

Platform: milestones object inside a layer

Milestones unlock when a condition is met and stay unlocked. Each has a requirementDescription (the docs suggest using a 'total'), an effectDescription and a done() function that returns true when earned. Optional toggles add on and off switches, which is how most TMT games offer auto-buyers.

Like upgrades, a milestone's reward must be implemented elsewhere: check hasMilestone in the relevant function.

Use milestones for things players should never lose, such as keeping upgrades on reset or unlocking automation.

Watch out for: Milestones based on current amounts can flicker after a reset. Base them on totals or best values, as the docs recommend.

06

Step 6: Add buyables: best for repeatable purchases with rising costs

Platform: buyables object inside a layer

Buyables are repeatable upgrades. You write cost(x), which takes the amount owned and returns the next price, effect(x), display(), canAfford() and buy(), plus an optional buyMax() and purchaseLimit. Helpers such as getBuyableAmount and buyableEffect read them elsewhere.

A typical cost is a Decimal version of base × rate^x, for example new Decimal(10).times(new Decimal(1.5).pow(x)). Display the amount, cost and current effect, because players buy what they can understand.

Write buyMax if a buyable will be bought thousands of times; clicking one at a time stops being fun quickly.

Watch out for: buy() must spend the currency itself. Forget that line and the buyable is free.

07

Step 7: Add a second layer and grow the tree: best for turning one prestige into a tree

Platform: addLayer, row, branches, layerShown

Copy your layer, give it a new id, set row: 1 and a baseResource of the first layer's currency. Add branches: ['p'] to draw a line from it to the first node, and a layerShown() that returns true only once the player has reached it, so the tree reveals itself.

Rows matter: per the layer docs, a layer's row 'affects where the node appears on the standard tree, and which resets affect the layer.' Resetting row 1 resets row 0 unless you keep things in doReset. Try type 'static' here; it suits layers where each point is a big decision.

This is the moment your game becomes a tree incremental rather than a prestige demo.

Watch out for: Static layers need canBuyMax, or players can only take one point per reset.

08

Step 8: Balance and test: best for catching timewalls before players do

Platform: Your browser, a spreadsheet and two friends

Play your game from a fresh save with offline progress off, and note the time at each unlock. If any gap is much longer than the ones around it, that is a timewall; fix it with a cheaper upgrade, a milestone or a gentler exponent rather than by telling players to wait.

Set isEndgame() in mod.js so the 'you win' screen appears at the end of your current content, and keep the changelog in mod.js current; TMT shows it in its own tab.

Then hand it to two people who have played a TMT game and two who have not. Watch, do not explain.

Watch out for: Developers always test faster than players. Whatever pace feels right to you is probably too fast for a first-time player.

09

Step 9: Publish it: best for getting a shareable link the same day

Platform: raw.githack.com, GitHub Pages or galaxy.click. Free

Commit and push in GitHub Desktop. The fastest share link, per the official guide, is raw.githack.com/[your-username]/The-Modding-Tree/master/index.html. For a cleaner address, enable GitHub Pages on your repository.

Then put it where TMT players are. Most popular TMT games live on galaxy.click, which hosts browser incrementals with ratings and comments, and the TMT community forum has a Mods category for sharing. Our communities guide lists the rest.

Add discordName and discordLink to modInfo if you open a server, so players can find you from inside the game.

Watch out for: githack links are convenient but long and tied to your branch name. Use GitHub Pages or a host for anything you post publicly.

10

The Prestige Tree: best for seeing the original TMT is based on

Platform: Browser · free

Jacorb's The Prestige Tree is the game TMT was built from: 'Climb the tree!' On galaxy.click it has 4.6 stars from 413 ratings and 59,401 plays, and its source is on GitHub.

Read its layers.js before writing your own. It shows normal and static layers side by side, layers that unlock from earlier ones, and how a few dozen upgrades interlock across rows.

Play it to the end once; most TMT players have, and they will compare your game with it.

Watch out for: Copying its layer structure too closely makes a game feel like a reskin. Borrow the techniques, not the tree.

11

The Communitree: best for a community-flavoured TMT mod

Platform: Browser · free

ducdat0507's The Communitree describes itself on galaxy.click as 'A TMT mod about TMT mods.' It has 4.5 stars from 433 ratings and over 165,000 hours of total play there.

It shows how much a TMT game can lean on the community's shared references, and that a mod with a playful premise can outlast more serious ones.

Study it for tone and theming once your mechanics work.

Watch out for: In-jokes need an audience. If your players have not played many TMT games, keep the references light.

12

The Game Dev Tree: best for a full overhaul with new content

Platform: Browser · free

The Paper Pilot's The Game Dev Tree is a mod of The Prestige Tree built with TMT, described on galaxy.click as 'a complete overhaul mod, however, replacing all vanilla content with new layers,' aimed at keeping mechanics relevant longer. It has 4.4 stars from 139 ratings.

It shows the step after a first mod: same engine, entirely new design. If your second game replaces the template's content rather than extending it, this is the reference.

Its author went on to build Profectus, which is the next entry.

Watch out for: Overhauls take far longer than additions. Ship a small original mod first so you know the engine before rewriting everything.

13

Celestial Incremental: best for seeing how far TMT can be pushed

Platform: Browser · free

Celestial Incremental by Icecreamdude, with credited help from several others, is one of galaxy.click's most-played TMT games: 4.2 stars from 735 ratings, 262,586 plays and about 766,000 hours on its page, updated to v1.15 on 31 October 2026. The developer writes that it 'is still made with The Modding Tree, but I've pushed the boundaries.'

It proves TMT is not just for short mods. With custom layouts, music and lore, a TMT game can hold a large audience for years.

Look at it when you wonder whether to switch engines. The answer may be no.

Watch out for: Pushing TMT this far means a lot of custom code on top of the engine. Keep your additions in separate files listed in modFiles, so updates stay manageable.

14

Profectus: best for TMT veterans who want a modern toolchain

Platform: TypeScript engine. Free. Template repository, npm run dev

Profectus, 'a game engine that grows with you,' is documented at moddingtree.com and hosted at code.incremental.social. Setup per its guide: use the template repository, run npm install and npm run dev for a live-reloading local server, and push to deploy through an automated build.

It is written in TypeScript and suits developers who want types, a build step and a structure that scales. The Paper Pilot has also run Profectus Creation Jams; see our jams guide.

Start in TMT if you are new to code; consider Profectus for your second or third game.

Watch out for: Profectus needs Node.js and a build step, which TMT does not. That is a real barrier for first-time programmers.

15 · Ours

IncrementalGames.org: best for getting your TMT game into a tagged list

Platform: Free listing. Optional paid Get featured placement from $30 a week

This is our site, so weigh it accordingly. When your mod is public, list it free and it can appear alongside the others on our Modding Tree games list, with its play link, length and tags.

Players looking specifically for tree incrementals use that list, so it complements galaxy.click and the forum. The optional Get featured placement adds a labelled Featured card on the home page, game pages and best-of lists if you want more eyes at launch.

Claim the listing later to update it as your mod grows.

Watch out for: Unfinished mods get judged as games. List when there is at least an hour of content and a clear end screen.

How to choose your path with The Modding Tree

01

Match it to your coding experience

If you have never programmed, TMT is one of the gentlest ways in: no build tools, copy-and-paste patterns, and a reload to test. If you write TypeScript for a living, Profectus will feel more familiar. If you want a desktop or Steam game with art, look at our engine comparison instead.

02

Match it to your idea

TMT shines when your idea is a chain of resets and upgrades: a tree where each node is a prestige layer, like The Prestige Tree. If your idea is mostly about a world, characters or animation, the tree layout will fight you, as even Celestial Incremental's custom additions show.

03

Match it to your scope

A first mod should be three to five layers and an hour or two of play. Ship that, collect feedback on galaxy.click and the forum, then decide whether to extend it, overhaul it like The Game Dev Tree, or move to Profectus. Small finished mods teach more than big abandoned ones.

Fork it tonight and add one upgrade

Fork the repository, set your modInfo id, and add upgrade 11 that doubles point gain. That takes under an hour and teaches the whole loop: edit, reload, test. Add one layer per evening after that and you will have a playable tree by the end of the week.

When it has an ending, list it on IncrementalGames.org for free so tree fans can find it. If you want a push at launch, the optional Get featured placement puts a labelled Featured card in front of more players.

List your game free →

Common questions

What is The Modding Tree?

A free JavaScript engine for tree-style incremental games, based on Jacorb's The Prestige Tree. You fork it on GitHub, edit mod.js and layers.js, and open index.html in a browser to play.

Do I need to know how to code to use The Modding Tree?

A little. The README says it requires programming knowledge, but 'mostly pretty easy things and copy/pasting.' The official tutorials walk you through upgrades, layers and effects with code you can paste and edit.

How do I publish a Modding Tree game?

Push your fork to GitHub and share the raw.githack.com link the official guide describes, or enable GitHub Pages. Most players find TMT games on galaxy.click and the TMT community forum.

Is The Modding Tree still updated?

Its changelog's latest entry is v2.6.6.2 from September 2021, so it is stable rather than actively developed. Many popular games still use it, and Profectus is a newer TypeScript engine for developers who want a modern toolchain.

What are the best Modding Tree games to learn from?

Start with The Prestige Tree, the original. Then The Communitree, The Game Dev Tree and Celestial Incremental show community theming, a full overhaul and how far the engine can be pushed. Our Modding Tree games list has more.

Sources