Learn to Code via Tutorials on Repl.it!

← Back to all posts
Idle Mining Template Mod WITH MODDING INSTRUCTIONS
ReallyBasic (14)

Idle Mining Debug Mod

The idle mining template mod. You can find the game on replit.com or github.
Explains how to create your own resources, production buildings, harvesters, and auto-production buildings using JSON.

Good luck with your mod!


How To Import a Mod

The purpose of this game is to be extremely moddable, so I will walk through exactly how to import one.
To import a mod:
1. Download the source for the mod from GitHub (should be a zip file).
2. Extract the zip file
3. Loading the main game, and while in the modding room select 'load mod'
4. Select the 'mod.json' file from your computer.

Your mod should be loaded at this point! If it isn't, contact the owner of the mod (it has to do with an issue with their mod, not this game).


Instructions

These instructions teach you how to make your mod from scratch.


Setup

  1. Fork this on replit or Github.
  2. If using replit to edit your mod, connect this project to GitHub using version control on replit.
  3. Make sure your mod has the 'idle-mining-mod' tag on Github! Otherwise, it will not be visible when people search for it.

Making Your Mod

You are now ready to make your own mod!

Note: modding will be easier if you have prior knowledge of JSON files.
Warning: if you spot a warning below, make sure you read it! It contains important information that could throw errors when uploading your mod!


Setup the mod.json file by typing opening and closing curly brackets.

You will also need several items, which I will explain later in this tutorial in detail.
This is what your mod.json file should look like after setup:

For each section, marked by a

A Header That Looks Like This

the JSON will be placed under the appropriate key.

Example:


Mod Details

The modDetails component has 5 variables:

The modName is a string variable that stores the name of your mod.

Warning: Make sure it doesn't match any existing mods, or you won't be able to load it.

The modDiscription variable is a string to describe your mod. This can be anything you want, and as long as you want (but try to keep it under about 100 characters!).

The modAuthor variable is a string that says who made the mod.

The enabled variable is a boolean that will be used in a future version. For now, just set this to true.

Warning: don't put quotes around this. It is not a string and will throw an error if you do.

The dependencies variable is an array, either filled with strings or by null.
Use this if your mod depends on anything else, such as the default mod.

Here is an example:

You are using the default mod's resources, as well as some debugging buildings, but don't want to copy everything from those mods.
Simply do:

Alternatively, if you are not dependent on any mods, type:

Warning: don't put quotes around null. It is not a string and will throw an error if you do.


Resources

This section will teach you how to make your own resource.
Here is an example of a resource:

The Variables:

xp-giver from the example is the programmer name for your resource.
You can call it whatever you want, but it must be unique and it must be in double-quotes.

displayName is a string variable. This is what gets displayed when you research this material.

Note: while xp-giver from the example must be unique, displayName does not. However, it does make things confusing if there are two types of resources with the same name!

amount is the number of this resource the player currently has. If you don't want the player to start with this resource, set this to 0.

baseResource is a boolean. If you want to be able to mine this resource, set this to true. If you want to make this as an output for a production building, set this to false.

strength is a number. This is the amount of pickaxe strength it takes to mine this resource.

Warning: never set this to zero. If it is zero when you play your mod, the game will freeze and your mod will not work.

xp is a number. This is how much xp you get for mining/producing this resource. Auto-harvesting or auto-producing this resource gives you about 1/3 of this amount per resource harvested/produced.

unlock is a set of variables that control how this resource is researched.

Note: unlock is really important to learn, because it is used for resources, production buildings, auto harvesters, and auto production buildings.

researchPoints is the number of research points required to research this item.

researched is a boolean that describes whether this item has been researched yet.

requiredLevel is what level the player must be at for this to show up as researchable. It will not appear until the player reaches this level.


Production buildings

These are manual production buildings. They require being clicked to work.

Note: If you want to make a production building that produces resources automatically, see autoProduction below.

Here is an example of a production building producing the resource mentioned above:

producer-3000 from the example is the programmer name for your production building.
You can call it whatever you want, but it must be unique and it must be in double-quotes.

displayName is a string variable. This is what gets displayed when you research this production building.

Note: while producer-3000 from the example must be unique, displayName does not. However, it does make things confusing if there are two types of production buildings with the same name!

discription describes how this building works. It doesn't need exact numbers, just a basic idea of what goes in and what comes out.

total is the current number of buildings the player currently owns.

This isn't used for production buildings yet, but may in a future update. Adding it anyway is considered good practice.

unlock is a set of variables that control how this resource is researched.

Note: unlock is really important to learn, because it is used for resources, production buildings, auto harvesters, and auto production buildings.

researchPoints is the number of research points required to research this building.

researched is a boolean that describes whether this building has been researched yet.

requiredLevel is what level the player must be at for this to show up as researchable. It will not appear until the player reaches this level.

Next is the cost variable. This is a set of resource keys set to a number.

Note: cost is currently not used for production buildings, but may be used in future versions of the game,
so it is good practice to add it anyway. Just make the building cost 0 wood or some other resource.

Then there is the productionCost. This is formatted the same way as cost and production.

In this example, this is a building that takes an input of 3 iron_ore and 1 fire per click:

Lastly, there is production. This is formatted the same way as cost and productionCost.

In this example, this is a building that produces 5 wood and 1 stone per click:


Harvesters

Harvesters are used to harvest base resources automatically. They require no input and trigger every 1 second.

Note: this follows nearly the same pattern of production buildings. I will refer to the notes above when needed.

Here is an example of a harvester:

The building programmer name, displayName, discription, unlock, and production:

  • if you are not sure what any of these are, reference the production building.

The only two real differences between harvesters and production buildings are the cost and productionCost.
Harvesters produce base resources at zero cost to the player, so there should be no productionCost.
However, you do have to purchase this building for it to work.

The cost key represents all of the resources required to build this building.
In this example, this is a building that costs 5 wood and 1 stone to build:

The total key is a number that represents how many of this building the player currently has.
If they have 5 of this building, they will produce 5 times the amount of resources in production.


Auto Production

Auto production buildings are essentially 'factories' that manufacture higher-level resources for you.
You are not required to click on the production buildings for them to produce, and they will automatically convert
resources into other resources, as long as you meet the requirements to do so.

Here is an example of an auto production building that creates iron ingots from fire and iron ore:

Auto production buildings are virtually the same as harvesters except for two things:

  1. Auto production buildings cost something to produce. The productionCost variable automatically subtracts this amount from the player's resources every second. If the player doesn't meet the input requirements, they will not get the resources mentioned in production.
  2. They have an enabled key. In a later update, auto production buildings will be able to be switched off in-game. For now, this is a required key.

Warning: if the enabled key is set to false, your auto production building will not produce no matter how many of these you have. Make sure this is set to true!


Summary

I hope everything made sense in this tutorial! If you had an issue, something didn't make sense, or I misspelled something, feel free to post it in the comments and I will get back to you as soon as I can!

Comments
hotnewtop