Difference between revisions of "Modding"

From wiki
Jump to: navigation, search
Line 53: Line 53:
 
# Head to '''<tt>Mod → New → Create new Package</tt>'''. Once you have done that follow the instruction set that fit your situation;
 
# Head to '''<tt>Mod → New → Create new Package</tt>'''. Once you have done that follow the instruction set that fit your situation;
 
# Fill in all the details you want.
 
# Fill in all the details you want.
# After that is done, drag your mod files, that are underneath the main mod folder (For Example, if your mod is say WoodStuff drag all the stuff in the WoodStuff folder), into the shaded "Drag and Drop" area, to move them into the mod's folder.
+
# After that is done, drag your mod files, that are underneath the main mod folder (For Example, if your mod is say '''<tt>WoodStuff</tt>''' drag all the stuff inside the '''<tt>WoodStuff</tt>''' folder), into the shaded "Drag and Drop" area, to move them into the mod's folder.
 
# Select OK and the mod is now complete.
 
# Select OK and the mod is now complete.
  

Revision as of 07:49, 2 August 2016

This page is meant to give an overview into Staxel's modding systems and give you insight into how to install, modify and create your own mods in the game.

Please note this page, and the game itself, is a Work In Progress. Many things are likely to change with the modding systems and any of these methods can be made obselete at any time.

Installing Mods

Only install mods that come from trusted sources. Staxel, and related parties, are not liable for any damage done to your computer by installing mods.

There are a couple things you should note when installing mods;

  • You do not need to install content mods when wanting to join a content modded server.
  • Modded Installations will fail validation attempts.
  • Mods need to be reinstalled after every update.

Installing a .sxlmod file

A *.sxlmod is basically a .zip file with a little extra information pertaining to the mod. To install it follow these instructions;

  1. Move the *.sxlmod to the following folder: C:\Users\[Your username here]\%localappdata%\Staxel.Launcher\gamedata\LocalContent\packages\
  2. Start the staxel launcher and press the mod manager button in the top left. Alternatively if that does not work, head to C:\Users\[Your username here]\%localappdata%\Staxel.Launcher\gamedata\bin\ and start Staxel.ModManager.exe
  3. Once the mod manager is started, you will see the mod that you just moved into the folder. To install it, click on it to highlight it then go to Mod → Install Package
  4. Once the progress bar is finished, you are now free to play with your mods. Enjoy!

As this is a *.sxlmod file, the mod file will not be deleted upon update. However you will need to repeat steps 2-4 for every update.

[An example .sxlmod will be added here in the future.]


Installing a normal mod folder or .zip file

Note: These files will get destroyed every update. If you want to update the mod in order to keep the files in a singular spot, head to #Creating a .sxlmod file and follow those instructions.

To install these files;

  1. Move and/or extract these files to this directory: C:\Users\[Your username here]\%localappdata%\Staxel.Launcher\gamedata\Content\mods (Avoid copying two mods into the same folder. And do not place individual items in the /mods/ directory.)
  2. After that is done, head on over to C:\Users\[Your username here]\%localappdata%\Staxel.Launcher\gamedata\bin\ and start Staxel.ContentBuilder.exe
  3. Once the content builder is started. Click the Validate Resources button in the top left.
  4. Once the progress bar stops, you are ready to play. Enjoy!

Example mod: launcher.playstaxel.com/examples/grassSnow.zip (thanks to scornedbythenine)


Creating Mods

Staxel Modding Cheat Sheet

This cheat sheet contains useful links and resources for modding in Staxel.

These may be outdated. If you want more help join the Staxel discord server and people there will be able to help you.


Creating/Updating a .sxlmod file

.sxlmod mods are the preferred method for providing mod files to other players. They provide a way to easily create mods which also does not get deleted upon a Staxel update. To create a *.sxlmod you will need to follow this procedure;

  1. Head to C:\Users\[Your username here]\%localappdata%\Staxel.Launcher\gamedata\bin\ and start Staxel.ModManager.exe
  2. Head to Mod → New → Create new Package. Once you have done that follow the instruction set that fit your situation;
  3. Fill in all the details you want.
  4. After that is done, drag your mod files, that are underneath the main mod folder (For Example, if your mod is say WoodStuff drag all the stuff inside the WoodStuff folder), into the shaded "Drag and Drop" area, to move them into the mod's folder.
  5. Select OK and the mod is now complete.

Once the previous instructions have been done, you can then navigate to View → Open Package directory or head to C:\Users\[Your username here]\%localappdata%\Staxel.Launcher\gamedata\LocalContent\packages\ to find your mod file which you can upload to whatever site you choose.


To update an already existing .sxlmod file;

  1. Head to C:\Users\[Your username here]\%localappdata%\Staxel.Launcher\gamedata\bin\ and start Staxel.ModManager.exe
  2. Highlight the mod you want to update
  3. Head to Mod → Update Package → From Installation. if you want to update the files based on the already installed mod or From Contents If you want to redo it via the installation route. (More info above.)

Your mod is now updated.

Voxel Modelling Software

Qubicle : Best Voxel software, has a lot of tools and options, but you will need to buy it to be able to export .qb and use other features.

MagicaVoxel : Free software, its very easy to use, it doesn't have layers, see #Modding for Staxel with Magica Voxel.

VoxelShop : Free software, with basic tools, but has layers (for making .accessory mods), has a big range of tools.


Modding for Staxel with Magica Voxel

MagicaVoxel can be downloaded at this location: [1] Please use the most current version. Tutorial written for Ver.97

Having your working file *.vox and your object file *.qb saved separately in a backup folder is rule #1 for modding in Staxel. Copy finished files from this location into Staxel after it has updated.


- How objects behave in Staxel

Staxel uses world co-ordinates broken up into 16 Voxel square regions. Created Objects will conform to this grid. Within MagicaVoxel, created objects lay upon the ground plane and exist within a working space bounding box of white lines and a grid. Objects created in MagicaVoxel export to Staxel within this bounding box. The X,Y,Z coordinates of the bounding box are locked to the 16 X 16 grid, even if your model is mostly built to one corner. So far, the 'front' of your model is side with the green line, the Y Axis.

Example of the work area:[2]

- Exporting to Staxel

When your model is ready, assuming it has a primary side to face a specific direction, make sure this side of the model is looking over the green line. MagicaVoxel exports to several file types. Export your model to a .qb file by expanding the Export button at the bottom right of the window and clicking on 'QB.' This opens a dialogue box that asks where to save the file. Save your object to a folder outside of Staxel with a proper name.

After making sure Staxel has updated through the launcher, go to C:\User\yourusername\AppData\Local\Staxel.Launcher\gamedata\content\mods. If you need help finding the AppData folder, search for Windows AppData Folder and you'll see how to un-hide it. Now that you're in mods, create a new folder and name it either for the object you are making or the object set it is a part of. Copy and paste your *.qb file here.

In order for your model to show up in Staxel, it needs a *.tile file to accompany it. For simplicity, copy and past the *.tile file from another object in the Staxel Folder. Open the file in Windows Notepad and you should see something like this:

{
  "__inherits" : "staxel/tileObject/base.config",
  "code" : "staxel.tileObject.serverVillage.exterior.SignPost",
  "voxels" : "staxel/tileObject/serverVillage/exterior/SignPost.qb",
  "attachToBelow" : true,
  "stepSoundGroup" : "staxel.sounds.WoodFootSteps",
  "collision" : true,
  "randomizePosition" : false,
  "compound" : {
    "size" : {
      "x" : 1,
      "y" : 3,
      "z" : 1
    },
    "specification" : "
      C
      C
      X"
  },
  "placementDirections" : [ "rn" ],
  "attachmentDirections" : [  ],
  "categories" : [ "white", "brown", "misc" ],
  "pricing" : {
    "modifiers" : {
      "labour" : 0.1,
      "rarity" : 1,
      "size" : 1,
      "materials" : 1
    }
  }
} 

For your mod to work, edit the following lines of code, then save the tile file into the same folder as your object.

"code" : "staxel.tileObject.serverVillage.exterior.SignPost", Change this line to say "mods.YourModFolderName.YourModsFileName" Do not include the file type here.

"voxels" : "staxel/tileObject/serverVillage/exterior/SignPost.qb", Change this line to say "mods/YourModFolderName/YourModsFileName.qb Make sure to include the file type here.

"attachToBelow" : true, This can be true or false. True makes your model stick to the ground plane correctly. Great for objects that have to sit on the ground. False locks the object to the 16 X 16 grid. Great for objects that have to stack regularly and correctly, like bridge pieces or building objects.

"collision" : true, This can be true or false. True makes the object physical, can be stood upon. False makes the object nonphysical, can be passed through.

"randomizePosition" : false, Object Jitter. True assigns a random amount of x and/or y value when placed. Great for multiple objects in a room to look more natural. False locks the object where you built it in the bounding box, locked to the 16 x 16 grid. Great for building objects that must stay correctly spaced.

"placementDirections" : [ "rn" ] Sets the directions in which the tile can be placed to. The valid promps are; "all" for all directions, "rn" for (all rotations?) down, Need further information

"attachmentDirections" : [ ] Sets the directions in which the tile lets others be placed to it. All valid prompts are the same as "placementDirections".

"compound" : { "size" : { "x" : 1, "y" : 3, "z" : 1 }, "specification" : " C C X" }, Information Required, Not fully understood

"categories" : [ "white", "brown", "misc" ] Causes the object to show up in specific places in the interface when the player selects a bias for the color or object type specified here.

"pricing" : { "modifiers" : { "labour" : 0.1, "rarity" : 1, "size" : 1, "materials" : 1 } } Sets the price in which this tile can be bought and sold at.


So long as the file locations are correct and you've decided how your object is supposed to behave in world, save this file from notepad and open the Contend Builder program. Found within C:\Users\YourUserName\AppData\Local\Staxel.Launcher\gamedata\bin, this program must run without error in order for your mod to be present in the game. When done, the progress window will close and you are ready to start Staxel up and use your modded item.

Error Examples and Corrections coming soon

For now, your object ends up in a list of other staxel objects based upon alphabetical hierarchy. If you don't immediately see your object in the TAB window, type in the objects name and it should turn up. If you are still having trouble, check your work flow, make corrections and if you're still unable to get by, check with the Forums. We'll set you straight.


Hooks

These hooks allow you to access the guts of Staxel's code without the need to edit any of Staxel's files.

ModdingHooks


Layered Voxels

Some parts of staxel uses layered voxel files, like clothing. If your voxel editor doesn't support layers you can also try using a .layered file, which allows for building a layered model out of several other files.

example.layered: { "layers": { "Head" : "mods/example/HeadLayer.qb" } }


Staxel Modding Programs

AssetManager

The Asset Manager is an all-in-one asset management system for Staxel. The default path for the Asset Manager is '<user id>/appdata/local/staxel.launcher/gamedata/bin/staxel.assetmanager.exe'.

Start by loading the content system ("File->Load Asset Directory", this will be done automatically if the option is checked in your preferences ("Edit->Preferences")). Everything, except building assets or using the "Create Material Models From Tile Models" tool, requires the content system to be loaded. From there you may begin using tools (under "Tools" in the top menu) or editing assets. To edit assets, open the window for the type of asset you wish to edit (under "View" in the top menu, or press CTRL+Shift+1-9) and have at it.

The Live Content System ("View->Content System Live") shows you exactly what is in Staxel's content directory, and let's you manage (create/delete) files and folders within the content directory safely.

The Asset Manager also comes with a Mod Manager ("View->Mod Manager"). The Mod Manager allows you to create mod packages (*.sxlmod files) and (un)install them, and delete them, whenever you please. Creating a mod package (in the Mod Manager click "Mod->New->Create New Package...") is as simple as selecting files to include in the mod and choosing a name for the mod. Once that is done the mod package is ready to be shared or installed at your convenience. To install or uninstall mods select the mod packages from the list and either click "Mod->Install Packages/Uninstall Mods" or right-click the selected packages and click "Install Packages/Uninstall Mods" from the menu. Files from an installed mod that have been edited (by yourself, hopefully) will not be uninstalled, but may be overwritten by reinstalling the associated mod package (assuming the file comes from the associated mod package). Installed mods must be built (if not already, and/or validated) by clicking the "File->All Assets->Build and Validate Assets" button in the Asset Manager. This can be done for you automatically, or turned off, by changing the appropriate setting ("Automatically Build Mods After Installation") in your preferences. Importing a mod package is also simple. Click "Mod->New->Add Existing Package" to import a package (perhaps passed on from a friend) into your package directory. The Mod Manager can also attempt to convert a .zip file, while it's being import, into a mod package, but it has one rule: all files inside the .zip must be inside a single root directory (e.g. "MyMod/block.tile"). The reason for this is that the Mod Manager tries it's best not to break paths used in the assets (e.g. block.tile might reference the model "MyMod/block.qb" which would break if block.qb is not in the MyMod directory). Finally, mod packages can be edited in two ways: by updating them via their installation directories (e.g. MyMod.sxlmod might update it's files from "mods/MyMod"), or by editing their contents manually. Both methods are under "Mod->Update Package".

While editing assets, it is sometimes helpful to view the asset's source file. To do this quickly, open an asset window and click "View->Source->File". The source file will be opened in an editor of your choosing, specified in your preferences. If you like, you can provide arguments to the editor in the preferences. If the arguments are left empty the asset's source path will be provided, otherwise, you can use the macro $(fpath) which will be replaced by the asset's source path (e.g. "/f $(fpath)" may be expanded to "/f C:\dirt.tile"). You may also like to open the directory containing the asset's source file via "View->Source->File in Directory".

If you have made changes to any assets, or have added new model files, and are ready to use them in Staxel, it is a good idea to make sure that all your assets are valid and your model files are converted into the format used by Staxel. To do this, click "File->All Assets->Build and Validate Assets". Don't forget to save your assets (in each asset window, "Asset->Save->All Assets") before doing so, however.

[More comprehensive help section coming...]

ContentBuilder

Content builder ( %localappdata%Staxel.Launcher\gamedata\bin\Staxel.ContentBuilder.exe ) is a tool used to prepare assets to be used by the game, it needs to be run when adding mods to a server.