Coder Social home page Coder Social logo

crafting's People

Contributors

begla avatar cervator avatar overdhose avatar small-jeeper avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crafting's Issues

Update documentation

If ever restored to functional - @small-jeeper heeeelp :-)

I'm moving documentation out of the engine wiki that better belongs in modules / module wikis / somewhere like that. Below is copy paste from the engine wiki of pages I'm deleting.

Old wiki page 1 (normal usage)

Note: This article is based on the legacy game from the old stable/master branch (stable build #22). Back then the 3D cube crafting system described below was under heavy development, but has since gone into hibernation, and is no longer available in the newer builds. It still exists in a module but doesn't work with the newer engine. It may return again one day. You can get it from the legacy line in the launcher or from Jenkins

General Information

We made the decision not to stick with a conventional solution via GUI for the crafting system but introduced an intuitive and innovative in-game approach.
The crafting "place" is made up of 27 smaller blocks, placed in a 3x3x3 cube. By doing this, we achieve the possibility of three dimensional crafting. The crafting process itself is similar to known systems -- one places blocks/items in the crafting grid and - based on some recipe - can receive some craft result.

Activation

The Crafting-Module is integrated in the stable builds starting from build #22. You can find the module listed in the Mods windows when you create a new world. In order to active the craft system in the game, select the module's name in the list and click the Activate button. You can now use the craft system in your fresh created worlds.

Active the "Craft System" in the mod list.

Usage

This sections explains the main usage of the crafting system, including information on how to start the crafting process, how to effectively use the available features and how to actually craft new items.

Start crafting process

To start a crafting process, you have to hold the Q key while holding a block or item in hand so that you see the charge indicator.
Press and hold "Q".
When right clicking during charging on an existing block in the world, the craft blocks appears in front of you, with one instance of the item hold in hand already placed in the grid.
The crafting grid with the initial placed block.

The craft block (Add and remove items)

The craft block is divided into 3 layers -- bottom, middle and top -- to make the placement of blocks/item practicable to the user. The navigation through the different layers works as follows: To go a layer up, press and hold shift and click right, that will move the interactable grid one layer up. To go one layer down respectively, press and hold shift and left click on your mouse.

To place the selected block/item in the grid, point with the crosshair on a specified cell and right click. If the cell is empty, the selected item will be inserted into the grid. If the cell does already contain an element of the selected type, the counter in the matrix is incremented by one. In the last case, if there is already an element in the cell which is different from the selected one, you will get the full amount of the placed block back to your inventory and a single instance of the selected block/item in hand is placed in the grid.
If the block/item could successfully be placed, the amount of the selected block/item in the player's toolbar is decreased by one unit.

You can get placed blocks/items back by selecting them via the crosshair and left clicking on your mouse.

Add and remove multiple items

Furthermore, you can hold the right or left mouse button pressed to add or delete items continuously. Another way of adding a higher number of items to the grid at the same time is to hold Q to charge the number of items that will be added. The graduation is divided into 6 parts, each stands for 1/6 of the amount of items. Thus, charging to the half circle around the crosshair will place the half of the items in the grid.

Mini-Inventory

You may have noticed that you only have the items in your toolbar available for crafting. This difficulty was solved by the so called mini-inventory, which allows to scroll easily through your inventory. To access the mini-inventroy, press and hold shift and use the mouse wheel to scroll through the rows of your inventory.
The mini-inventory.

Crafting

Now you know how to handle the crafting system, so we can start with the actual crafting. If you have arranged the blocks and items in the craft grid in a way such that the current configuration matches with some recipe, a thought cloud appears over the craft block, containing an icon hint to the craft result.
In order to receive the item, press E and you will get one (or another number, specified by the recipe) of the result item to your inventory. The amount of the used items in the craft block is decreased simultaneously.
The thought-cloud at the top indicates that the placed blocks match with the pickaxe recipe.

Refinement

Finally, we have refinement left. Refinement is a simple form of changing an item's properties. In order to start the refinement process, selecet an item from you toolbar, press and hold Q and right click to bring up the craft block interface. The craft grid already contains an instance of the selected item. The item in the grid is called the target of the refinement process. To perform the refinement, you need to have an instigator, which will "trigger" the refinement. Selecet the instigator item or block in your toolbar, point with the crosshair to the item in the crafting grid and you will see the thought cloud with the refined item in it. Now press E to receive to add the refined item to your inventory.
Refinement of stone.

Related Links

Old wiki page 2 (developer):

This article is intended for (mod) developers that want to specify own (refinement) recipes in their mods.
For the general usage of the crafting system in-game go to [[Crafting System]].

Note: This article is based on the stable/master branch (stable build #22). Since the crafting system is under heavy development, the given information must not be valid for the development branch versions.

Recipes

The whole craft system is based on recipes. All crafting (and refinement) results are based on these recipes. New recipes are defined via a "CraftRecipe" section in the *.prefab files.

You can change the behaviour of the recipes by specifying different options. These options will be explained in detail right after the section on basic recipe definitions.

Recipe definitions

This section will explain the general structure of recipes. Therefore, the example of a pickaxe will be used. As already said, the pickaxe.prefab must contain the following section:

"CraftRecipe" : {}

The next step is to add the "recipe" subsection to the prefab file. Within this sections we will define the main recipse, i.e. specify the 3x3x3 matrix for the recipe. For convenience, you do not have to write down layers that are completely empty. Thus, our example for the pickaxe may end up like this:

"CraftRecipe" : {
  "recipe" : {
    "bottom" :
      [
        "stone", "stone", "stone",
        " "    , "stick", " ",
        " "    , "stick", " "
      ]
  }
}

In general you will specify recipes with more than just one layer like in the following:

"CraftRecipe" : {
  "recipe" : {
    "bottom" : [ ],
    "middle" : [ ],
    "top"    : [ ]
  }
}

where bottom, middle and top denote the respective layers. For the content matrices, you can think of the bottom row to be closest to the player.

Recipe Options

In addition to the simple recipe definition, you can specify several options to change the behaviour of the recipes.
In the following list the options are explained in detail.

  • fullMatch : If the value is true (by default) then the positions of elements in the craft block will be checked for exact positions in the recipe matrix.
    This means given a recipe matrix A

    0 0 0
    1 0 0
    1 0 0
    

    and a craft block matrix B

    0 1 0
    0 1 0
    0 0 0
    

    that these two matrices are different, and thus the placed blocks in the crafting block do not match with the recipe A.
    If the value of fullMatch is false both matrices, A and B are reduced to the more simple matrix

    1
    1
    

    and thus the given block configuration will match the recipe. The reduced matrices will be checked for equality by taking rotations into consideration. E.g. the following to matrices will match if *fullMatch is set to false.

    1 1 1       1 0 0
    0 1 0       1 1 1
    0 1 0       1 0 0
    

    The option fullMatch still has some nuances. If you assing false to it, empty rows and columns may get deleted when matrices are compared. But this removal does only happen if the "space" in all cells of the row respectively column are not important to recipe. Think of some kind of recipe similar to the shoes recipe in good old Minecraft.

    0 0 0 
    1 0 1
    1 0 1
    

    You do not want to end up comparing the recipe matrix like this:

    1 1
    1 1
    

    Thus, the space inbetween is preserved during the tranformation process, ending up in the simplified version

    1 0 1
    1 0 1
    

    If the recipe contains more than one layer the empty columns and rows will be removed when they are empty for all the matrices and contain no "important space". For example, in the following recipe where we use all three layers with option fullMatch set to false the two rightmost colums are removed.

    bottom  center  top             bottom  center  top
    1 0 0   1 0 0   1 0 0           1       1       1
    1 0 0   1 0 0   0 0 0   ==>     1       1       0
    1 0 0   0 0 0   0 0 0           1       0       0
    
  • recipe : The recipe option is used as described above. You may use up to three layers, each specified by its name. If a cell in the grid is empty, it is denoted by a space " ", if it should contain a specific item
    or block you denote by the block/item name: "stone", or "engine:sand" for a more specific notation.

  • resultCount : Via the resultCount option you can specify the output for the crafted result. The default value is 1, but you can decide on any other integer value.

To sum up the recipe definition and its options so far I want to give you the recipe for torches. Torches can be crafted out of a stick and one piece of coal, you will get four torches at once by crafting and the exact positions of blocks in the grid do not matter.

"CraftRecipe" : {
  "fullMatch"   : false,
  "resultCount" : 4,
  "recipe" : {
    "bottom" :
      [
        " ", " ",     " ",
        " ", "coal",  " ",
        " ", "stick", " "
      ]
  }
}

Refinements

You can specify a refinement by replacing the recipe subsection through a refinement subsection.
Currently, the structure for this section is like the following:

"refinement" : {
    "<instigator>:<target>:<resultCount>" : {
        "instigator"  : "<instigator>",
        "target"      : "<target>",
        "resultCount" : "<resultCount>"
    }
}

Where the types mentioned are defined as follows:

  • : The block or item that is used to refine another element. The instigator is the block/item that the player must select in the toolbar.
  • : A block or item in the craft block the player is pointing at. The target is the block that will be refined in the refinement process.
  • : everything should be clear with that ;)

Note: The way how refinements are specified will change within the next versions!

Moreover, it is possible to define more than one refinement recipe. To do so, just add another "<instigator>:<target>:<resultCount>" : {} block, seperated from the first one by a comma.

Example

An example for a refinement definition is given in the following code block:

"refinement" : {
  "coalore:coalore:4" : {
    "instigator"  : "coalore",
    "target"      : "coalore",
    "resultCount" : "2"
  },
  "stone:coalore:2" : {
    "instigator"  : "stone",
    "target"      : "coalore",
    "resultCount" : "2"
  }
}

Related Links

  • [[Crafting System]]

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30148205-update-documentation?utm_campaign=plugin&utm_content=tracker%2F2794680&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F2794680&utm_medium=issues&utm_source=github).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.