Changes

Jump to navigation Jump to search

Documentation/Engine/Units

1,077 bytes added, 01:40, 19 December 2018
What is unit?
=What is unit?=
Units are objects in inside SCS game engine that have ability to . One of their core abilities is so they can be serialized or deserializedmaking it a perfect tool to give content creators a way to define various parts of the games.
Unit has:
== SII files ==
Units are stored in SII files. There are two versions of this file supported by the game engine textual : plain-text and binary however . However, only textual form the plain-text format is used for definitions.
=== Struture Structure ===
The magic mark - – used to check if the file is a real SII file or not.
<pre>SiiNUnitSiiNunit</pre>
The opening bracket used to explicitly show the global file scope start
attribute_number: 40
attribute_string: &quot;TEST STRING&quot;
attribute_tokenattribute_unit: TESTtest.unit
attribute_float3: (1.0, 1.0, 1.0)
attribute_float_number_ieee754: &amp;40490f5a
}</pre>
The closing bracked bracket for the SiiNUnitSiiNunit
<pre>}</pre>
'''Example:'''<br />
''some_file_using_include.sii''
<pre>SiiNUnitSiiNunit
{
example: doing.includes
<pre> ninjas: true</pre>
''How the game &ldquo;sees&rdquo; some_file_using_include.sii:''
<pre>SiiNUnitSiiNunit
{
example: doing.includes
}
</pre>
You may notice usage of the new extension - '''.sui'''. It's used for unit serialized files without magic mark <code>SiiNUnitSiiNunit</code> that are included somewhere in different files. We recommend you also use this extension.
{{Note|The <code>@include</code> directive must appear at the beginning of a new line with no whitespace (space, tab, etc) before it. The following examples will '''not''' work:
<pre>SiiNUnitSiiNunit
{
bad_examples: just.the.worst {
== Attribute types ==
{| class="wikitable" width="100%"
!width="19%"| Type!width="25%"| Value!width="55%"| Example! Notes
|-
| string
| &quot;x&quot;
| attribute: &quot;String value&quot;
|
|-
| float
| x
| attribute: 1.0 // Using normal float-notation<br>attribute: &amp;3f800000 // using ieee754 hexa notation
|
|-
| float2
| (x, y)
| attribute: (1.0, 2.0)
|
|-
| float3
| (x, y, z)
| attribute: (1.0, 5.0, 3.0)
|
|-
| float4
| (x, y, z, w)
| attribute: (1.0, 5.0, 3.0, 9.0)
|
|-
| placement
| (x, y, z) (w; x, y, z)
| attribute: (0, 0, 0) (1; 0, 0, 0)
|
|-
| fixed
| x
| attribute: 10|
|-
| fixed2
| (x, y)
| attribute: (10, 22)|
|-
| fixed3
| (x, y, z)
| attribute: (10, 22, 33)|
|-
| fixed4
| (x, y, z, w)
| attribute: (10, 22, 33, 44)|
|-
| int2
| (x, y)
| attribute: (20, 69)
|
|-
| quaternion
| (w, x, y, z)
| attribute: (1.0, 0.0, 0.0, 0.0)
|-| token| x| attribute: value
|-
| s16
| x
| attribute: -15
|
|-
| s32
| x
| attribute: -15
|
|-
| s64
| x
| attribute: -15
|
|-
| u16
| x
| attribute: 15
|
|-
| u32
| x
| attribute: 15
|
|-
| u64
| x
| attribute: 15
|
|-
| bool(boolean)
| x
| attribute: true
attribute: false
|
|-
| <span id="attribute_type_token">token</span>
| x
| attribute: value
| Token is a string of maximum length of 12 characters, only lowercase alphanumeric characters and underscore can be used [<code>a-z0-9_</code>]
|-
| unitowner pointer (owner_ptr)
| x
| attribute: my.some.nameless.unit| '''owner_ptr''' refers to unit defined within the same SiiNunit (eg. <code>.trailer.tchassis</code>)|-| link pointer (link_ptr)| x| attribute: some.named.unit| '''link_ptr''' refers to a named unit that is defined elsewhere (eg. <code>cabin_a.brand.model.cabin</code>)|-| resource_tie| "x"| attribute: "path/to/some/resource.pma"| '''resource_tie''' is typically used to bind animations to animated models. The syntax is the same as for 'string' type attributes.
|}
<pre>
attribute_name[]: value
attribute_name[]: value2
attribute_name[]: value3
</pre>
attribute_name[2]: 9 <-- 3rd element
</pre>
 
=Documented Unit Types=
{{Special:PrefixIndex/Documentation/Engine/Units/|hideredirects=1|stripprefix=1}}
developer
1,626
edits

Navigation menu