I’m in need of some clarification:
I’ve been reading an article over on HaxeCoder.com about embedding assets and the author mentions an ‘Application.xml’ file which I have not been able to locate in my own project which is based on the same author’s Pong tutorial. I have a 'Project.xml’
file in the root of the project tree in FlashDevelop 184.108.40.206. The structure of this file is similar to what the author discusses in his ‘embedding assets’ tutorial so I assume that we are dealing with the same file? Is that correct?
I take it that when the author says ‘embedding’ he means that the paths to the assets are embedded in the application and not the actual assets themselves?
Yes, application.xml is now project.xml.
Embedding means that the asset isn’t copied next to the executable but inside it.
What you have described is my understanding of what ‘embedding’ usually means - packing the assets in the *.exe file, but if that’s the case wouldn’t the *.exe become hugely bloated? I must be missing part of the puzzle
I think you got the puzzle
if you embed heavy assets then you exe will become really large.
So for larger projects the assets would actually be copied to a folder relative to the *.exe and loaded only as needed, at the start of a level, etc.
Well yes and no.
The more “normal” way is indeed to not embed assets, they get copied next to the exe.
But whether they are embedded or not they get loaded when needed,
it’s just their storage location that change.
(As a side note the flash and html5 targets actually preload the assets by default)
With regards to embedded assets what exactly do you mean by “loaded when needed” - loaded from the hard drive, or shunted from one area of RAM to another? If the assets are embedded won’t they all be loaded into RAM when the application runs regardless of when they are actually needed?
Oh yes of course, I overlooked this but yes the entire exe, including embedded assets, gets loaded into ram by the operating system.
But from what I could understand from the Assets class it’s the raw file that gets embedded, meaning that when you ask for the asset a decoded object gets created.