Translations of this page:

Package system in WME

You probably already have some basic experience with the project manager and wondered how the packages works. Here's the brief explanation.

If you run your Project Manager on any of the demos, you see your typical directory tree and you can notice that the data folder has a different folder icon than the rest. The reason is that WME perceive this folder as a data folder and will make a data package as soon as you compile your project.

Now you can make any amount of packages you like. Try it for yourself - if you right click on the folder in Project Manager you can choose Promote to Package. This will tell WME that in next compilation run, it will create data repository from that folder as well.
Note that you can also Degrade to Folder by another right click

In praxis the result is that in testing mode (F5 in Project Manager) WME looks for data into folders marked as packages. When you compile the project it will generate dcp files named as folders marked as packages. So if you marked for example folders data, gfx, sound, speech and gui as packages, WME will produce into output directory filese data.dcp, gfx.dcp, sound.dcp, speech.dcp and gui.dcp.

Now comes the vital piece of information. For WME is all pathes relative to packages. So it completely doesn't matter how your packages are named. You always reference filenames relatively inside the package.

Let's give you an example:

imagine you have 3 folders marked as packages - data, gui and gfx

Now you put sound file called hello.ogg into any of them.

Then you can call

Game.PlaySound("hello.ogg");


and the sound will be played. You can help yourself with the following thought - WME creates a huge virtual directory into what it copies contents of all packages and create a huge data repository.

And now the pitfall - what if you put one file called hello.ogg into data directory and another into gui directory? The first one will get played. So count with it from the beginning of designing your game. If you decide to name your background image always background.jpg, you absolutely must create separate folders for them.

So imagine I have package for graveyard, another for forest and another for town, still I will create in these package directories folder structure like

  • graveyard
    • Entrance
    • Markers
    • Statue
  • town
    • Street_North
    • Square
    • Alley

inside of the folders (Entrance, Markers, Statue) you can of course have your background.jpg files and it will be absolutely valid. Just don't put them into main package folder because it will be handled as the same pathway. For exactly the same reason you shouldn't have two same folders in different packages. Good praxis is adding prefixes to folders (town_streeetnorth, town_square, town_alley), but it's up to your naming convention.

I hope that helps you and see you sometime in the future with another article.

 
kbase/package_system_in_wme.txt · Last modified: 2007/10/10 22:12 by Mnemonic
Recent changes RSS feed Creative Commons License Driven by DokuWiki