Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Gamedev:Structure: Difference between revisions

From FIGHTORDER
imported>Abma
imported>Eronoobos
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Mod structure =
= Game Structure =
The mod file is just a plain zipped file in the .7z format.<br />
== .sd7 or .sdz ==
In this zip file there are actually very few folders and files that are de facto in every mod. For more about the de facto folders/files that are used in every mod you can read further on http://springrts.com/wiki/Mod_specification.
The structure widely used for mods is as follows:
<br />
;<b>units/</b>
:This folder is the main folder for the units in the mod. Every unit in the mod must have its appropriate file in this folder. All files in this folder have the extension .fbi. For convention, the names given to the files are descriptive for the units. For example the arm commander's .fbi file is called "armcom.fbi".
:<b>*.fbi</b>
::files inside the ”units” folder have the extension .fbi. These files are simple text files with information about each unit used in the mod. No .fbi file, no unit! Keep in mind that this file just keeps information about each unit. It doesn't contain the actual 3d model of the unit that you see in game. Instead this file among other things tells the spring engine which 3d model to use for each unit.


;<b>Objects3d/</b>
A mod is presented as an [[sd7]] or sdz file. This is just a zip file of the individual files comprising the game.
:This folder contains the 3d models for each 3d object in the mod. That can be a model of a unit, a wreckage, a map object or something else. For each .fbi file in the ”units” folder there must be a corresponding 3d model in the ”Objects3d” folder.


;<b>Scripts/</b>
You can unzip the sd7 or sdz file by renaming it to .zip, and using a zip tool to unzip it.
:This folder contains animations(which are script files) for the 3d models. Animations are not a must but they are necessary in case we make a non-static 3d model. With non-static we mean 3d models that can animate(walk, taget, shoot etc). In the other hand we might have static 3d objects. Examples of that could be decoration objects for a map like stones, trees, etc. Files in this folder can either be of the .cob or .lua format. Lua files are simple text files while .cob files are binary files/executables. Bos and cob are file formats used in the original Total Annihilation. The relation between them is that the .cob files are compiled .bos files. Bos files are not really executed at any point but are rather in the folder so you can see what each compiled file does.
 
:<b>*.bos</b>
sd7 / sdz files are created using 7zip.
:: Animation script files. These are source files for .cos and are never executed. They are present in the folder just to give an intuition to developers of what the coresponding .cob file does.
 
:<b>*.cob</b>
== .sdd directories ==
:: Compiled .bos files. These are the files that are being executed ingame.
You can avoid using the archives altogether by storing the whole mod directory structure in an .sdd directory. This is useful for game development because the changes you make are visible without any additional step.
:<b>*.lua</b>
 
:: Animation script files. These are executed(interprented) directly ingame.
On Linux one can also symlink the development directories from the Spring's mod directory:
  ln -s ~/projects/caspring/games/zk ~/.spring/games/zk.sdd
 
== Directory Structure ==
==='''<code>root of game folder</code>'''===
 
[[Modinfo.lua]] and can also contain [[Modoptions.lua]], [[AI:Development:Lang:Lua|LuaAI.lua]], and [[springignore.txt]]
 
==='''<code>anims\</code>'''<br>===
image files for [[MouseCursors|mouse cursors]]
 
==='''<code>bitmaps\</code>'''<br>===
 
===='''<code>bitmaps\loadpictures</code>'''<br>====
pictures that will be displayed when the game loads.
 
===='''<code>bitmaps\tracks</code>'''<br>====
images that are used for the [[Gamedev:UnitDefs#Decals|unit tracks]]
 
==='''<code>features\</code>'''<br>===
.lua [[Gamedev:FeatureDefs|FeatureDef]] files
: Corpse and map-static feature definitions. The corpse files are similar to [[Gamedev:UnitDefs|UnitDefs]] but usually contain a less data, such as what model to use as the wreckage, how much metal the wreck will give if reclaimed, etc. Some games choose to subsume these into the [[Gamedev:UnitDefs|UnitDef]] instead of having separate files.Subfolders are allowed.
 
==='''<code>gamedata\</code>'''<br>===
[[:Category:Gamedata|Various files]] that control global things or setup graphic & sound resources.
 
==='''<code>icons\</code>'''<br>===
images for [[Icontypes.lua|unit symbols and radar icons]]
 
==='''<code>LuaRules\</code>'''<br>===
various files to make Lua scripts work such as gadget handler
===='''<code>LuaRules\Gadgets</code>'''<br>====
[[Lua_Scripting|Lua gadgets]]: scripts that control the gameplay
===='''<code>LuaRules\Configs</code>'''<br>====
config files read by Lua gadgets
 
==='''<code>LuaUI\</code>'''<br>===
===='''<code>LuaUI\widgets</code>'''<br>====
[[Lua_Scripting|Lua widget]]: scripts that make up the user interface or do other unsynced things
 
==='''<code>objects3d\</code>'''<br>===
.3do, [[About_s3o|.s3o]] or [[Assimp]] compatible 3D model files
: This contains the actual 3D model that units and features use in-game. Most units have a variety of different pieces that are put together in a hierarchy type form (for instance, a tank has a hull, a turret attached to that, and a barrel attached to that). The {{xtaglink|Gamedev:UnitDefs|model}} tag determines what model is used.
 
==='''<code>scripts\</code>'''<br>===
[[Animation-LuaScripting|.lua]] or [[Animation-CobOverview|.cob ]] animation script files
: This contains all of the animation scripting for the units. Scripts work by calling on pieces of the unit's model to do things, such as rotate a turret to aim at a target, or emit smoke when the unit is damaged. The pieces named in the script file must reflect actual parts of the unit's.
 
==='''<code>sidepics\</code>'''<br>===
[[Sidedata.lua|Faction icons]] read by lobby etc.
 
==='''<code>sounds\</code>'''<br>===
[[Sounds.lua|sound files]]
 
==='''<code>units\</code>'''<br>===
.lua [[Gamedev:UnitDefs|UnitDef]] files
: Contains most of the active data that a unit uses, such as its health, a list of which weapons it has, speed, metal/energy cost, whether it is a construction unit or not, so on and so forth. Subfolders are allowed.
 
==='''<code>unitpics\</code>'''<br>===
.dds or .png [[Gamedev:Buildpics|buildmenu pictures]]
:Unit pictures are those little thumbnails which show up in the build menus of units in-game. They're just a little graphical representation of the unit so people know what they're building when they click it. Assigned via the {{xtaglink|Gamedev:UnitDefs|buildpic}} tag.
 
==='''<code>unittextures\</code>'''<br>===
.dds, .tga or .png image [[3DModels:Textures|texture]] files.
: Image files which are stretched over the unit. Texture 1 contains the diffuse and team colour and texture 2 controls reflectivity, specular, glow and 1-bit transparency. Subfolders are allowed.
 
==='''<code>weapons\</code>'''<br>===
.lua [[Gamedev:WeaponDefs|WeaponDef]] files
: Most units have weapons. The characteristics of these weapons, from its behaviour to how it acts in the air, is determined in the weapon file. Some games choose to subsume these into the [[Gamedev:UnitDefs|UnitDef]] instead of having separate files. Subfolders are allowed.
 
[[Category:Game Dev]]

Latest revision as of 21:41, 7 April 2016

Game Structure

.sd7 or .sdz

A mod is presented as an sd7 or sdz file. This is just a zip file of the individual files comprising the game.

You can unzip the sd7 or sdz file by renaming it to .zip, and using a zip tool to unzip it.

sd7 / sdz files are created using 7zip.

.sdd directories

You can avoid using the archives altogether by storing the whole mod directory structure in an .sdd directory. This is useful for game development because the changes you make are visible without any additional step.

On Linux one can also symlink the development directories from the Spring's mod directory:

 ln -s ~/projects/caspring/games/zk ~/.spring/games/zk.sdd

Directory Structure

root of game folder

Modinfo.lua and can also contain Modoptions.lua, LuaAI.lua, and springignore.txt

anims\

image files for mouse cursors

bitmaps\

bitmaps\loadpictures

pictures that will be displayed when the game loads.

bitmaps\tracks

images that are used for the unit tracks

features\

.lua FeatureDef files

Corpse and map-static feature definitions. The corpse files are similar to UnitDefs but usually contain a less data, such as what model to use as the wreckage, how much metal the wreck will give if reclaimed, etc. Some games choose to subsume these into the UnitDef instead of having separate files.Subfolders are allowed.

gamedata\

Various files that control global things or setup graphic & sound resources.

icons\

images for unit symbols and radar icons

LuaRules\

various files to make Lua scripts work such as gadget handler

LuaRules\Gadgets

Lua gadgets: scripts that control the gameplay

LuaRules\Configs

config files read by Lua gadgets

LuaUI\

LuaUI\widgets

Lua widget: scripts that make up the user interface or do other unsynced things

objects3d\

.3do, .s3o or Assimp compatible 3D model files

This contains the actual 3D model that units and features use in-game. Most units have a variety of different pieces that are put together in a hierarchy type form (for instance, a tank has a hull, a turret attached to that, and a barrel attached to that). The {{#css:
  span.mono {
      font-family: courier, monospace;
  }
  span.value {
      color: #ff6600;
  }

}}model tag determines what model is used.

scripts\

.lua or .cob animation script files

This contains all of the animation scripting for the units. Scripts work by calling on pieces of the unit's model to do things, such as rotate a turret to aim at a target, or emit smoke when the unit is damaged. The pieces named in the script file must reflect actual parts of the unit's.

sidepics\

Faction icons read by lobby etc.

sounds\

sound files

units\

.lua UnitDef files

Contains most of the active data that a unit uses, such as its health, a list of which weapons it has, speed, metal/energy cost, whether it is a construction unit or not, so on and so forth. Subfolders are allowed.

unitpics\

.dds or .png buildmenu pictures

Unit pictures are those little thumbnails which show up in the build menus of units in-game. They're just a little graphical representation of the unit so people know what they're building when they click it. Assigned via the {{#css:
  span.mono {
      font-family: courier, monospace;
  }
  span.value {
      color: #ff6600;
  }

}}buildpic tag.

unittextures\

.dds, .tga or .png image texture files.

Image files which are stretched over the unit. Texture 1 contains the diffuse and team colour and texture 2 controls reflectivity, specular, glow and 1-bit transparency. Subfolders are allowed.

weapons\

.lua WeaponDef files

Most units have weapons. The characteristics of these weapons, from its behaviour to how it acts in the air, is determined in the weapon file. Some games choose to subsume these into the UnitDef instead of having separate files. Subfolders are allowed.