User Tools

Site Tools


cw4:custom_units

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
cw4:custom_units [2021/01/09 17:38] – [How to] Kaidencw4:custom_units [2022/09/05 06:05] – Fix typo Up-Level
Line 1: Line 1:
 {{page>cw4:header&nofooter}} {{page>cw4:header&nofooter}}
  
-===== Custom Units =====+====== Custom Units ======
 [[cw4:cpack:start | Documented custom CPACKs]] [[cw4:cpack:start | Documented custom CPACKs]]
  
-==== How to ====+===== Overview ===== 
 + The basic steps in creating a custom unit needs two things 
 +  - A Model (the thing you see on the map) 
 +  - A Script (You don't see this, but it makes the model do certain things) 
 + 
 +These two things are packaged in a CPACK. Each CPACK can have one or more units and scripts. Note that each model can also have multiple sub-units. A model also needs a "mesh", a texture or some color. 
 + 
 +===== Documenting Custom Units ===== 
 +:!: <color #00ff00ff>Players enjoy playing more if they understand the capabilities of custom units on the map, regardless of whether they are friendly or enemy units. It is easier for other map makers to implement your units if there is some documentation or guidance on capabilities, limitations and customization options. </color> 
 + 
 +An [[wiki help|extensive Help system]] has been built into the game so that custom units (CMOD) and their container (CPACK) can be documented in the wiki that is accessible from inside the game. This allows for an explanation of how to use the unit both for the map maker and for the players.  
 + 
 + 
 + 
 +===== Getting Started =====
  
  * [[http://www.voxelmade.com/magicavoxel/| MagicaVoxel]] is easy to start with.  * [[http://www.voxelmade.com/magicavoxel/| MagicaVoxel]] is easy to start with.
Line 22: Line 36:
  * A (paid) tool that is fully supported in the game (some units have been made with this tool) is [[http://assetforge.io/|AssetForge]], a 3D modeling studio with pre-built "blocks" that can be assembled and exported.  * A (paid) tool that is fully supported in the game (some units have been made with this tool) is [[http://assetforge.io/|AssetForge]], a 3D modeling studio with pre-built "blocks" that can be assembled and exported.
  
 +==== Importing Units/Converting Units Formats ====
 +
 +Models exported from many external tools (Magica Voxel, Blender, etc.) can usually be imported into the game editor. **The guiding principle here is that units should be simple**((After import, the game will report on the number of vertices that the model contains.)) - Animation and many of the more advanced features are not suported. Since the game utilizes a 3rd-party package ([[https://ricardoreis.net/trilib-accepted-file-formats/|TriLib]])((see the site for a complete list of supported formats)), for format import/conversions, if one format doesn't work, then attempt either a different format or simplify the model. 
 +
 +The following website may be useful in converting one type of exported model into a different format. 
 +
 +[[http://www.assimp.org/| The Open-Asset-Importer-Lib]]
  
 ==== What ==== ==== What ====
Line 28: Line 49:
  
 The CPACK editor can also directly import the .vox files created by MagicaVoxel and this usually results in a more efficient model. If you import the .vox file, the model and texture will both be imported into the CPACK editor. The CPACK editor can also directly import the .vox files created by MagicaVoxel and this usually results in a more efficient model. If you import the .vox file, the model and texture will both be imported into the CPACK editor.
 +
 +==== Considerations ====
 +From a Discord conversation where @knucracker provided some insight into the import process (for a model exported from Blender)
 +
 +//Things like submeshes aren't supported.  So depending on how the original model is structured, some meshes might not get loaded.  The game basically expects 1 or more top level meshes in a model.  It will load them and give them names and create mesh objects in the cpack when imported.  It will also attempt to load or extract any textures.  For obj files the textures  sit along side the model and there may be an a .mtl file that defines the materials.  If those are present the game will load them up and import the texture automatically.  If not, you can still create a texture in the cpack manually by loading the texture yourself.  In either case once you create a cmod and add a mesh to an object, you still need to associate the texture with the mesh in the cmod editor.   If you don't then the model will have either just a 'white' untextured look, or it will use vertex colors (if the model was exported with vertex colors).  There is also a "vertex color from materials" checkbox in the cpack editor when importing a mesh.  That will attempt to create vertex colors based on any materials defined in the model (or in a separate .mtl file).  Unfortunately, there are about a million combinations of things.  Many dozens of different model formats and many options within any given format, and then options at import time. //
 +
 +
 +//For your green vs black edges, I would guess that the texture associated with the mesh is 'wrong' (different), or if vertex coloring is being used that is somehow off (depending on if you had that checkbox selected at import time or not).//
 +
 +
 +//The game uses a 3rd party model import package that attempts to create an object hierarchy from what is in the model file.  The game then tries to extract meshes from that object hierarchy.  There are a million different combinations for how modeling software will organize the meshes.  It depends on the modeling software, the export options, and the format being exported to.  I don't understand it all either   Most of the time I try to stick to single meshes that are relatively simple in nature.  I then export and uncheck any fancy stuff in the export (animations, lights, etc. don't need to be exported).//
  
 ==== Links to Image Repositories ==== ==== Links to Image Repositories ====
Line 45: Line 77:
     * Google image search -> Tools -> Usage Rights -> Labeled for reuse     * Google image search -> Tools -> Usage Rights -> Labeled for reuse
  
-==== Converting units/importing unit formats ==== 
  
-[[http://www.assimp.org/| The Open-Asset-Importer-Lib]] 
  
 ==== Ownership rights ==== ==== Ownership rights ====
cw4/custom_units.txt · Last modified: 2023/03/18 13:02 by Karsten75