CMA:DevelopmentSetup: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\[ *((ftp|http)s?:\/\/[^ ]+)([^{])=([^}])([^ ]+)" to "[$1$3{{=}}$4$5")
 
(31 intermediate revisions by 8 users not shown)
Line 1: Line 1:
=Development setup=
{{TOC|side}}


This site focuses on getting your work ingame, as well as all aspects of addon,
= Development setup =
<br>
This site focuses on getting your work ingame, as well as all aspects of addon, pbos as a subset, development.
pbos as a subset, development.
 
=Motivation=


= Motivation =
* Correct setup to use binarize to track down errors and improve the quality.
* Correct setup to use binarize to track down errors and improve the quality.
* Best addon design for easy recognition, updating and quality.
* Best addon design for easy recognition, updating and quality.
* Dev setup to work with least time and resource effort.
* Dev setup to work with least time and resource effort.


=Related topics=
= Related topics =
 
* [[CMB:SimplifyTesting#Minimal_Addons_Setup|Minimal Addons Setup]]
* [[CMB:SimplifyTesting#Minimal_Addons_Setup|Minimal Addons Setup]]
* [http://dev-heaven.net/boards/17/topics/show/137 PBO naming thoughts]
* [http://dev-heaven.net/boards/17/topics/show/383 Good design - separate an addon in multiple PBOs]
* [http://dev-heaven.net/repositories/browse/cmb/configs/A2/formatted Formatted A2 configs and all-in-one config] as part of the [http://dev-heaven.net/wiki/cmb CMB git repository].
=Unpacking A1/A2=
==Motivation==
For non simple addons you have references to BI configs, textures or proxies.<br>
More specially the BI namespace '''CA'''.<br>
Binarze is trying to locate these references during the optimization process.<br>
In other words without these files available binarize is unable to do its job properly.<br>


The models referenced by other models or wrp files can be both MLOD or ODOL format.<br>
= Unpacking {{arma1}} / {{arma2}} =


==Process==
== Motivation ==
For non simple addons you have references to BI configs, textures or proxies. More specially the BI namespace '''CA'''. Binarze is trying to locate these references during the optimization process.
In other words without these files available binarize is unable to do its job properly.


===Virtual partition P===
The models referenced by other models or wrp files can be both MLOD or ODOL format.


== Process ==
=== Virtual partition P ===
We will create a '''virtual partition P:''' to map your arma folder.<br>
We will create a '''virtual partition P:''' to map your arma folder.<br>
This is required by the BI toolset and allows easy access to the arma folder.<br>
This is required by the BI toolset and allows easy access to the arma folder.<br>
Line 40: Line 29:
all your arma related tools in it. Map this one to T.
all your arma related tools in it. Map this one to T.


===Are two arma installations necessary===
=== Are two {{arma}} installations necessary ===
 
The BI tools create by default a separate folder/location called ''ArmAWork''. This may or may not be needed.
The BI tools create by default a separate folder/location called ''ArmAWork''.<br>
This may or may not be needed.


Considerations:
Considerations:
* Two separate folder/locations to keep your play-install clean.
* Two separate folder/locations to keep your play-install clean.
* Duplication of files may be needed for two separate.<br> Possible to avoid with [http://dev-heaven.net/wiki/heaven/Virtual_folders_and_files Junctions], if both are on the same HDD.
* Duplication of files may be needed for two separate.<br> Possible to avoid with {{Link|link= http://dev-heaven.net/wiki/heaven/Virtual_folders_and_files|text= Junctions}}, if both are on the same HDD.
* Both play and dev combined in one folder avoids messing around.<br> You only need to keep your folder structure well designed.<br> You can ensure that only PBOs, and NO unpacked data, are loaded via
* Both play and dev combined in one folder avoids messing around.<br> You only need to keep your folder structure well designed.<br> You can ensure that only PBOs, and NO unpacked data, are loaded via


Line 54: Line 41:
Done via [[ArmA: Startup Parameters]].
Done via [[ArmA: Startup Parameters]].


===Create P drive===
=== Create P drive ===
 
# Create a file called mapGameFolderToP.bat.<br>
1. Create a file called mapGameFolderToP.bat.<br>
Add the line and adapt the path your arma folder:<br>
2. Add the line and adapt the path your arma folder:<br>
  subst p: "D:\Games\arma"
  subst p: "D:\Games\arma"
3. Move the file to the autostart location. IE (XP32b):<br>
Move the file to the autostart location. IE (XP32b):<br>
  C:\Documents and Settings\YourUserAccount\Start Menu\Programs\Startup
  C:\Documents and Settings\YourUserAccount\Start Menu\Programs\Startup
  or  
  or  
  C:\Documents and Settings\All Users\Start Menu\Programs\Startup
  C:\Documents and Settings\All Users\Start Menu\Programs\Startup


==Extract files from the PBOs==
== Extract files from the PBOs ==
 
There are several PBO tools out there to do the job.<br>
There are several PBO tools out there to do the job.<br>
Personally I recommend you [http://dev-heaven.net/projects/list_files/mikero-pbodll ExtractPbo.exe] made by mikero<br>
Personally I recommend you {{Link|link= http://dev-heaven.net/projects/list_files/mikero-pbodll|text= ExtractPbo.exe}} made by mikero<br>
as part of the [http://dev-heaven.net/projects/show/mikero-pbodll PBOdll suite].
as part of the {{Link|link= http://dev-heaven.net/projects/show/mikero-pbodll|text= PBOdll suite}}.


  .\ExtractPbo.exe -a -d -y .\pathToArmA\arma\addons\PboFileName.pbo
  .\ExtractPbo.exe -a -d -y .\pathToArmA\arma\addons\PboFileName.pbo
Line 76: Line 61:
Move the files in the appropriate place:
Move the files in the appropriate place:


==Result==
== Result ==
 
The folders of the unpacked PBOs should be moved to .\arma to look like:
The folders of the unpacked PBOs should be moved to .\arma to look like:


Line 91: Line 75:
  ...
  ...


=Addon development=
== One Click Complete Extraction ==
mikero has built a batch to extract all {{arma}} pbos from BI in one go to the P drive:
{{Link|link= http://dev-heaven.net/projects/mikero-pbodll/wiki/InstallArmA2P|text= InstallArmA2P}}


==Use namespaces==
You find the batch in the {{Link|link= http://dev-heaven.net/projects/mikero-pbodll/files|text= files section}}, as well as the dll and extractPbo.exe.


In OFP the engine rebuild the file-folder structure in the memory from the<br>
= Addon development =
folder naming of the addons: ''.\ofp\addons\MyAddon.pbo''<br>
== Use namespaces ==
Results in the path in the memory: ''MyAddon\*.''<br>


A1/A2 support the ''namespace'' or also called (pbo)prefix.<br>
In {{ofp}} the engine rebuild the file-folder structure in the memory from the folder naming of the addons: ''.\ofp\addons\MyAddon.pbo''.
Results in the path in the memory: ''MyAddon\*.''
 
{{arma1}} / {{arma2}} support the ''namespace'' or also called (pbo)prefix.<br>
It is not required to use it, yet it is '''BAD''' practice not to use it!<br>
It is not required to use it, yet it is '''BAD''' practice not to use it!<br>
The namespace is defined in a file called '''$PBOPREFIX$'''.<br>
The namespace is defined in a file called '''$PBOPREFIX$'''.<br>
Line 110: Line 98:
$PBOPREFIX$: ''x\myMod\addons\myPboName''
$PBOPREFIX$: ''x\myMod\addons\myPboName''


===Create a PBOPREFIX file===
=== Create a PBOPREFIX file ===
{{Feature|informative|$PBOPREFIX$ has been superseded in later tools by $PBOPREFIX$.txt for hopefully obvious reasons. Both names remain compatible and achieve same result.}}


1. New file -> text file.<br>
1. New file -> text file.
2. Rename to '''$PBOPREFIX$'''. No file extension!<br>
2. Rename to '''$PBOPREFIX$'''. No file extension!
   Make sure your [http://www.google.de/search?q=windows+show+file+extensions&btnG=Google-Suche&meta=&aq=f&oq= windows OS displays all file extensions].
   Make sure your [http://www.google.de/search?q{{=}}windows+show+file+extensions&btnG{{=}}Google-Suche&meta{{=}}&aq{{=}}f&oq{{=}} windows OS displays all file extensions].
3. Open the ''$PBOPREFIX$'' with your favorite text editor.<br>
3. Open the ''$PBOPREFIX$'' with your favorite text editor.
4. Add your namespace:
4. Add your namespace:


Line 128: Line 117:
7. Move the ''$PBOPREFIX$'' file to the root of your addon: .\myAddon\$PBOPREFIX$.<br> '''NOT''' in a subfolder of your addon!
7. Move the ''$PBOPREFIX$'' file to the root of your addon: .\myAddon\$PBOPREFIX$.<br> '''NOT''' in a subfolder of your addon!


===Benefits===
=== Benefits ===
 
* Different pbo to memory naming (the later is the namespace).
* Different pbo to memory naming (the later is the namespace).
* Use version/date tag for the pbo and have same inner namespace without it for every release.
* Use version/date tag for the pbo and have same inner namespace without it for every release.
Line 137: Line 125:
In addition it allows you to utilize it for a few design and development tricks:
In addition it allows you to utilize it for a few design and development tricks:


==Develop with unpacked data==
== Develop with unpacked data ==
Note that the system also works for non development, yet it is not recommended.


Note that the system also works for non development, yet it is not recommended.<br>
Binarized files loaded faster and give better performance.
 
Binarized files loaded faster and give better performance.<br>
PBOs are needed to have the verifySignatures system work.
PBOs are needed to have the verifySignatures system work.


===Benefits===
=== Benefits ===
 
Let's start with the benefits this time:
Let's start with the benefits this time:


* No need to pack PBOs (more details to follow).
* Only re-pack PBOs if you are adding new files (more details to below).
* No need to repack the PBO for newly created files.<br> In other words also the ability to add new files during runtime (no configs though!).
* Ability to modify unpacked data during runtime. Readable; always possible<br>to modify a file's content (except configs); modifications available live<br>or via mission restart.
* Flat PBOs (small). Only $PBOPREFIX$ is needed inside.
* Work only with unpacked data. Readable, always possible to modify<br>(expect configs), modifications available live or via mission restart.
* Nicely manageable system to decide which addons are active in your dev setup:
* Nicely manageable system to decide which addons are active in your dev setup:
** Have both PBO and unpacked data to have the unpacked data loaded.
** Have both PBO and unpacked data to have the unpacked data loaded.
** Delete the PBO to have it disabled.
** Delete the PBO to have it disabled.
** Create PBO again to have the unpacked data loaded.
** Create PBO again to have the unpacked data loaded.
* If you have both your dev env combined with binarize env, you can easily<br>
* If you have both your dev env combined with binarize env, you can easily<br>binarize your addons during dev to see, if that works or check the log<br>for errors.
binarize your addons during dev to see, if that works or check the log<br>
for errors.


In short:<br>
In short:
# You work with the unpacked data.
# You work with the unpacked data.
# You create a PBO to have it active.
# You create a PBO to have it active.
# You repack a PBO if you add new files (and restart the game).
# You binarize it in the same setup to get the log and to have it available<br> optimized once (the current version/release is) complete.
# You binarize it in the same setup to get the log and to have it available<br> optimized once (the current version/release is) complete.
# You can ensure that only PBOs, and NO unpacked data, are loaded via
# You can ensure that only PBOs, and NO unpacked data, are loaded via


  -noFilePatching
  -noFilePatching in ArmA2


Done via [[ArmA: Startup Parameters]].
Done via [[ArmA: Startup Parameters]].


Mikero provides an excellent [http://dev-heaven.net/projects/show/mikero-pbodll pbo and rapify toolset] to make the handling very enjoyable.
Mikero provides an excellent {{Link|link= http://dev-heaven.net/projects/show/mikero-pbodll|text= pbo and rapify toolset}} to make the handling very enjoyable.
 
===Basics===


=== Basics ===
The key to understand that if you have $PBOPREFIX$ defined, the engine looks<br>
The key to understand that if you have $PBOPREFIX$ defined, the engine looks<br>
for the data unpacked in the same place:
for the data unpacked in the same place:


$PBOPREFIX$ contains: x\myMod\addons\myPboName
$PBOPREFIX$ contains: x\myMod\addons\myPboName<br>
The engine looks at .\arma\x\myMod\addons\myPboName for the data.
The engine looks at .\arma\x\myMod\addons\myPboName for the data.


Line 183: Line 165:
x\myMod\addons\myPboName here, with the unpacked data found at the path.
x\myMod\addons\myPboName here, with the unpacked data found at the path.


===Setup===
=== Setup ===
 
# You are recommended to use a subfolder with one char for your dev env. x is easy to type.
1. You are recommended to use a subfolder with one char for your dev env.<br>x is easy to type.
# You are very much advised to use your ofpec tag as namespace in the next level.
2. You are very much advised to use your ofpec tag as namespace in the next level.<br>
# To be able to have both PBO and unpacked data in the same folder, to have the string ''addons'' as 3rd folder level.
3. To be able to have both PBO and unpacked data in the same folder,<br>to have the string ''addons'' as 3rd folder level.
# Finally PBO name is the last folder level.
4. Finally PBO name is the last folder level.<br>Keep the [http://dev-heaven.net/boards/17/topics/show/137 PBO naming thoughts] and [http://dev-heaven.net/boards/17/topics/show/383 Good design - separate an addon in multiple PBOs] topics in mind.
 
===Considerations===
 
* You can have the PBO and unpacked data in the same directory.<br>This makes it easier to delete the PBO if needed.<br>At the same time it can become messy with lots of PBOs in one folder.
 
===A1 to A2 difference===


While this wasn't tested extensively, in A2 a PBO only needs the $PBOPREFIX$<br>
=== Considerations ===
inside the PBO, while A1 still needed all the same files in pbo as in<br>
You can have the PBO and unpacked data in the same directory. This makes it easier to re-pack or delete the PBO if needed. At the same time it can become messy with lots of PBOs in one folder.
unpacked data.


In other words in A1 you had to repack the PBO each time you have added<br>
{{GameCategory|arma1|Editing}}
a new file. A2 an empty PBO but the correct $PBOPREFIX$ is enough.
{{GameCategory|arma2|Editing}}


==Improve your addon with binarize==
{{GameCategory|arma3|Editing}}

Latest revision as of 17:31, 28 April 2023

Development setup

This site focuses on getting your work ingame, as well as all aspects of addon, pbos as a subset, development.

Motivation

  • Correct setup to use binarize to track down errors and improve the quality.
  • Best addon design for easy recognition, updating and quality.
  • Dev setup to work with least time and resource effort.

Related topics

Unpacking Armed Assault / Arma 2

Motivation

For non simple addons you have references to BI configs, textures or proxies. More specially the BI namespace CA. Binarze is trying to locate these references during the optimization process. In other words without these files available binarize is unable to do its job properly.

The models referenced by other models or wrp files can be both MLOD or ODOL format.

Process

Virtual partition P

We will create a virtual partition P: to map your arma folder.
This is required by the BI toolset and allows easy access to the arma folder.
It is recommended to create a link on your desktop or quicklaunch bar to P.

As a sidenote, at the same time you should create one central folder with
all your arma related tools in it. Map this one to T.

Are two Arma installations necessary

The BI tools create by default a separate folder/location called ArmAWork. This may or may not be needed.

Considerations:

  • Two separate folder/locations to keep your play-install clean.
  • Duplication of files may be needed for two separate.
    Possible to avoid with Junctions (dead link), if both are on the same HDD.
  • Both play and dev combined in one folder avoids messing around.
    You only need to keep your folder structure well designed.
    You can ensure that only PBOs, and NO unpacked data, are loaded via
-noFilePatching

Done via ArmA: Startup Parameters.

Create P drive

  1. Create a file called mapGameFolderToP.bat.
Add the line and adapt the path your arma folder:
subst p: "D:\Games\arma" Move the file to the autostart location. IE (XP32b):
C:\Documents and Settings\YourUserAccount\Start Menu\Programs\Startup or C:\Documents and Settings\All Users\Start Menu\Programs\Startup

Extract files from the PBOs

There are several PBO tools out there to do the job.
Personally I recommend you ExtractPbo.exe (dead link) made by mikero
as part of the PBOdll suite (dead link).

.\ExtractPbo.exe -a -d -y .\pathToArmA\arma\addons\PboFileName.pbo

Do this for each PBO in .\arma\addons and all PBOs in .\arma\dta.

Move the files in the appropriate place:

Result

The folders of the unpacked PBOs should be moved to .\arma to look like:

.\arma\ca\config.cpp
.\arma\ca\ca\*
.\arma\ca\a10\*
...

For the dta PBOs:

.\arma\bin
.\arma\core
...

One Click Complete Extraction

mikero has built a batch to extract all Arma pbos from BI in one go to the P drive: InstallArmA2P (dead link)

You find the batch in the files section (dead link), as well as the dll and extractPbo.exe.

Addon development

Use namespaces

In Operation Flashpoint the engine rebuild the file-folder structure in the memory from the folder naming of the addons: .\ofp\addons\MyAddon.pbo. Results in the path in the memory: MyAddon\*.

Armed Assault / Arma 2 support the namespace or also called (pbo)prefix.
It is not required to use it, yet it is BAD practice not to use it!
The namespace is defined in a file called $PBOPREFIX$.
The $PBOPREFIX$ site directly in your addons location: .\myAddon\$PBOPREFIX$.
The $PBOPREFIX$ is basically a text file with no file extension.

It allows you to name your pbo independent from the future in memory structure:

PBO location and name: .\arma\myMod\addons\myTag_PboName_2009_06_02.pbo
$PBOPREFIX$: x\myMod\addons\myPboName

Create a PBOPREFIX file

$PBOPREFIX$ has been superseded in later tools by $PBOPREFIX$.txt for hopefully obvious reasons. Both names remain compatible and achieve same result.

1. New file -> text file. 2. Rename to $PBOPREFIX$. No file extension!

  Make sure your windows OS displays all file extensions.

3. Open the $PBOPREFIX$ with your favorite text editor. 4. Add your namespace:

myMod\myAddon

Or better (see more info below):

x\myMod\addons\myAddon

5. No newline, no space before or after the namespace!
6. Save the file.
7. Move the $PBOPREFIX$ file to the root of your addon: .\myAddon\$PBOPREFIX$.
NOT in a subfolder of your addon!

Benefits

  • Different pbo to memory naming (the later is the namespace).
  • Use version/date tag for the pbo and have same inner namespace without it for every release.
  • Define your own home via the prefix: myMod\.. instead of just myAddon,
    or worse to use the BI CA namespace - NEVER do this!
  • Avoid addon (model/texture/sound) path conflicts with your own namespace.

In addition it allows you to utilize it for a few design and development tricks:

Develop with unpacked data

Note that the system also works for non development, yet it is not recommended.

Binarized files loaded faster and give better performance. PBOs are needed to have the verifySignatures system work.

Benefits

Let's start with the benefits this time:

  • Only re-pack PBOs if you are adding new files (more details to below).
  • Ability to modify unpacked data during runtime. Readable; always possible
    to modify a file's content (except configs); modifications available live
    or via mission restart.
  • Nicely manageable system to decide which addons are active in your dev setup:
    • Have both PBO and unpacked data to have the unpacked data loaded.
    • Delete the PBO to have it disabled.
    • Create PBO again to have the unpacked data loaded.
  • If you have both your dev env combined with binarize env, you can easily
    binarize your addons during dev to see, if that works or check the log
    for errors.

In short:

  1. You work with the unpacked data.
  2. You create a PBO to have it active.
  3. You repack a PBO if you add new files (and restart the game).
  4. You binarize it in the same setup to get the log and to have it available
    optimized once (the current version/release is) complete.
  5. You can ensure that only PBOs, and NO unpacked data, are loaded via
-noFilePatching in ArmA2

Done via ArmA: Startup Parameters.

Mikero provides an excellent pbo and rapify toolset (dead link) to make the handling very enjoyable.

Basics

The key to understand that if you have $PBOPREFIX$ defined, the engine looks
for the data unpacked in the same place:

$PBOPREFIX$ contains: x\myMod\addons\myPboName
The engine looks at .\arma\x\myMod\addons\myPboName for the data.

If it finds data there, it will replace all data in the namespace,
x\myMod\addons\myPboName here, with the unpacked data found at the path.

Setup

  1. You are recommended to use a subfolder with one char for your dev env. x is easy to type.
  2. You are very much advised to use your ofpec tag as namespace in the next level.
  3. To be able to have both PBO and unpacked data in the same folder, to have the string addons as 3rd folder level.
  4. Finally PBO name is the last folder level.

Considerations

You can have the PBO and unpacked data in the same directory. This makes it easier to re-pack or delete the PBO if needed. At the same time it can become messy with lots of PBOs in one folder.