From 6fb38fbb26e189934595518f5a029f94e6d6491f Mon Sep 17 00:00:00 2001 From: poikilos <7557867+poikilos@users.noreply.github.com> Date: Sat, 30 Mar 2019 21:30:07 -0400 Subject: [PATCH] improve Modding in Getting Started --- webapp/views/pages/getting-started.ejs | 71 ++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 3 deletions(-) diff --git a/webapp/views/pages/getting-started.ejs b/webapp/views/pages/getting-started.ejs index c619493..ddab9e4 100644 --- a/webapp/views/pages/getting-started.ejs +++ b/webapp/views/pages/getting-started.ejs @@ -229,13 +229,20 @@ modpacks) each time you connect to a server, so you don't have to install anything yourself. Automatic "game" downloading also means that each server can be very different, but load quickly, offering you many experiences to try easily.

+

Anyone can make a "game" using Minetest by +writing mods or combining existing mods. Most "games" are based on +games that are included in the Minetest/games directory--however, some +games that differ drastically in gameplay can be made if one heavily +edits or replaces mods that provide core functionality. Must of +Minetest's core functionality is written in Lua. +

Examples are the best way to get started. Since mods are scripted in Lua, every mod is open source. Almost every one is released under some sort of public license as well, which usually allows you to modify, reuse, and redistribute the code (usually under the condition that you credit the original author). The license file sometimes has no file extension, so you may have to pick a program to open it in Windows. -You can open it (or any other text file) in Notepad. However, Notepad++ +You can open it (or any other text file) in Notepad. However, Geany is recommended since there is more than one undo step. For Lua programming, you can install ZeroBrane Studio (which is free) then install @@ -243,6 +250,25 @@ install which patches ZeroBrane Studio to provide code completion (a form of autocomplete with API usage tips for coding).

+

Every mod, at minimum, must have a file called init.lua. You +should also add a description.txt describing it, a README.md or other +readme file explaining more, and a LICENSE.md or other license file +MIT License is used for Minetest itself, that is recommended. Some +people consider using GPL v3 to prevent the program from being used +on popular mobile devices, since the GPL v3 specifies that a user must +be able to not only reprogram but also replace the program with their +recompiled version--this may not be possible if your version shares a +namespace and key with the application you are changing, and you may not +have the same connectivity or functionality without using the same key. +Therefore, components or mods using GPL v3 may prevent their inclusion +into future version of Minetest "games", as several versions of +Minetest (often by other names) are on Google Play and the iOS App +Store. +You can find the MIT License online and paste it into Notepad or Geany. +Be sure to fill +in your name and the year you created the mod. Having a license will +make sure others feel safe using your mod and redistributing it if +that's what you want.

API means application programming interface. It is just the set of classes and/or functions you use to change the behavior of an existing @@ -253,7 +279,8 @@ conventions and placed public features there. In addition, many mods have a api.txt or similarly named files. You can start by opening up your minetest directory on your computer (after installing or otherwise installing Minetest) and doing a search for api, or just open the -following files depending on what you want to do:
+following files depending on what you want to do: +

+

Remember, you can always look at examples as well. You can find a mod that does something similar to what you want, looking at all of the .lua files in a mod like that may help. @@ -300,7 +328,44 @@ putting the mod in depends.txt, clearing crafting recipes, and other similar steps--see github.com/poikilos/homedecor_ua for an example.

- +

Craftitems and Nodes

+A node is drawn as a block, 3d mesh, or other drawtype and +is placeable. A craftitem can't be placed, so the only way to get rid +of it is to drop it, and like other things dropped it will become a +floating sprite waiting to be picked up by clicking. There are also +other types of entities in Minetest such as mobs and particles. +All items that aren't nodes are called craftitems even if they aren't +used in recipes. You can use the name of a node or craftitem when +defining a crafting recipe. However, you must depend on the mod being +used to ensure that it is loaded before your mod, if the item comes +from a different mod. You can depend on another mod by adding its name +to the depends.txt file in your mod. +

Mobs

+Creating passive or hostile Non-Player Characters or Enemy Characters +requires a mob api such as Simple Mobs, Mobs Redo, or codermobs +which share anestry in that order. Codermobs is included in Bucket_Game +and hence new versions of ENLIVEN. Some other mob frameworks include: +mobf, Jordan4Ibanez' OpenAI, and others. +

Creating New Ores

+Creating new ores or other blocks may be confusing after you learn the +API. If you want about 48 blocks before you find another cluster of +your ore, then the clust_scarcity should be 48*48*48 since the game is +3D. The chance of finding a cluster is 1 out of the clust_scarcity +number. The cluster size (clust_size) only affects the size of the +"vein" (though technically there are multiple shapes of clusters allowed +and vein is not recommended since it is hundreds of times slower). +Minetest uses the generic term cluster to refer to all patterns of ore +deposits. The number of ores in the cluster is determined by +clust_num_ores. If your clust_size is 3, then that would be a 3*3*3 +cube (but you just specify 3, not 27 there) and the maximum number of +ores you could set for clust_num_ores is 27, though that is not +recommended because then the person would find a 3*3*3 area that is +completely ore (that would give the person 27 ore each time they found +a cluster). Generally, the ore is a node (drawn as a block) and the gem +or metal is a craftitem (drawn as a sprite). You normally should set the +drop of the ore to a separate craftitem (however, if it is something +you have to smelt such as a metal, you could drop the ore node, then +provide a "cooking" crafting recipe to get the metal).