Stingray Forum (Read Only)
Welcome to Autodesk’s Stingray Forums. Share your knowledge, ask questions, and explore popular Stingray topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Questions about DLC resource package

15 REPLIES 15
SOLVED
Reply
Message 1 of 16
Anonymous
1006 Views, 15 Replies

Questions about DLC resource package

Hi,

 

I am currently trying to achieve streaming data.

 

I have been trying DLC content for a while now. From what I understand, stingray.Application.resource_package takes in a .package file only?

Which means that if I am adding a new mesh as a DLC content, the .FBX, materials and textures are not included?

 

In order to physically have the .FBX and textures, I will have to manually patch them into the game first before stingray.Application.resource_package can load the unit properly?

 

I understand that from the Asset Browser, I am able to export a zip file of the unit which contains all the crucial data. Is there a way to load this zip file on run-time into the game so I can use stingray.world.spawn_unit to create this newly imported unit on run-time?

 

Thanks,

Wilson

15 REPLIES 15
Message 2 of 16
_robbs_
in reply to: Anonymous

Hi,

have you tried looking at the stingray.Application.release_package_from_url() function?

http://help.autodesk.com/cloudhelp/ENU/Stingray-Help/lua_ref/ns_stingray_Application.html#sig_stingr...

 

Instead of giving it the name of a .package resource in your project, you give it a URL where it can download your bundled data file. That bundle would contain your unit, its FBX, materials, unit flow, etc.

Message 3 of 16
Anonymous
in reply to: _robbs_

Thanks for the reply.

 

When you mention bundled data file do you mean it takes in the zip output file from following this page?

 

http://help.autodesk.com/view/Stingray/ENU/?guid=__stingray_help_importing_assets_import_export_pack...

Message 4 of 16
_robbs_
in reply to: Anonymous

No, that zip output is only useful for transferring resources from one project to another inside the Stingray editor. Like, if you have a unit in one project and you want to use it in another, you open Project A in the editor, export the zip, then open Project B in the editor and import the zip. The engine doesn't handle those zips at all.

 

I was referring to the bundles of compiled data that get created when you package (deploy) your project.

Some background on that is here:

http://help.autodesk.com/view/Stingray/ENU/?guid=__stingray_help_managing_content_content_lifecycle_...

 

So, in your project, you'd need to create a .package file that contains all the resources you want to stream. Then, when you deploy your game, that package will get written to a bundled data file on disk. Then instead of distributing that bundle of data along with the bundled .exe, you can put it someplace on a web server, and use resource_package_from_url() to make your game stream in the data over HTTP instead of reading it off disk.

Message 5 of 16
Anonymous
in reply to: _robbs_

Thanks for the reply.

 

I think I am getting somewhere. So I have this testPackage.package in my project. I have also created a .dlc file for it.

When I deploy, it will bundle it as a b842be87dce2b1b2 file as printed in the log console.

 

Some more questions here:

1. So this "b842be87dce2b1b2" file is the one I should remotely stream using stingray.Application.resource_package_from_url?

 

2. How can I identify that testPackage is bundled to b842be87dce2b1b2 in the future? Is there a list where I can get this information?

 

3. I noticed I can get all the dlc packages in the project if I created a .dlc file for every .package I have. The .dlc file simply contains the name

and package location information. However, this is no longer useful since the package information should be changed from local to remote path.

Eg: "Streaming/testPackage" => http://hostsite.com/b842be87dce2b1b2

How am I able to change this?

If this is done I should be able to implement code that download the stuffs correctly on run-time via stingray.DLC

 

4. Am I right to say that using this method I am still able to create units as per normal?

Eg: Actually the testPackage will load a test.unit object. So in the original project folder, its located in data/content/units/test.unit

So I assume that loading this asset bundle will load them into the original locations which enable me to call this:

SimpleProject.world.spawn_unit(SimpleProject.world, "data/content/units/test")

 

Thanks for being patient with me!

Message 6 of 16
_robbs_
in reply to: Anonymous

yeah, there are two totally separate mechanisms you can use. (separate, but related.)

 

In both setups, you create a bundled data file, like you've already figured out. The difference is how that bundle gets downloaded and used in the game.

 

1. The "DLC" system, as explained under this page in the docs. In this setup, you figure out how to get the "downloadable content" bundle into the Stingray install directory. Then the game becomes able to load it with the regular resource package loading function like any other package. If needed, you can "patch" or override resources inside existing bundles. For a use case, imagine that you release your game, and a year later you want to release ten new levels. So you make a new installer that contains the bundle for those new levels. The user downloads and runs your installer, which copies the bundle next to the base content for the game.

 

2. Loading the bundle from a URL, as I suggested above. This way totally bypasses that other DLC system, you don't need a ".dlc" file or anything. The engine just loads the bundle over the wire instead of loading off disk.

 

So, to answer your other questions.

 

1. Yes, that data file is the one you should put on the web server.

 

2. The funky names are generated by hashing the human-readable names into an ID with a fixed number of characters. So as long as you don't change the name of your package resource, or move it to a different folder, the name of the bundle should remain the same. If you open the Window > External Console, there's a little built-in utility that you can use to translate between strings and the hashed IDs.

 

http://help.autodesk.com/view/Stingray/ENU/?guid=__stingray_help_managing_content_compiled_resource_...

 

3. If you're using the resource_package_from_url, you don't need the .dlc file at all.

 

4. Correct!

 

 

Message 7 of 16
Anonymous
in reply to: _robbs_

Hi,

 

I tried downloading and loading the binary file and it works!

The last thing I need is to know is if the ID lookup tool is able to take in multiple files at a time?

Or there is some other way I can do it?

 

Thanks!

Message 8 of 16
_robbs_
in reply to: Anonymous

Not sure what you mean by "take in multiple files". The IdLookup tool is just a translator for humans to look at. If you have a name, and you want to know what its equivalent binary ID is, you open up the tool and type in the string. It doesn't actually handle files.

 

Message 9 of 16
Anonymous
in reply to: _robbs_

Hi,

 

Basically I need to generate a text file like this:

 

0cb1a741e89d4092 -> ObjectA 

1cfc2c96ca9ccc9b -> ObjectB

4ea53c11fb1d43d6 -> ObjectC

6f7252297b1b85ff -> ObjectD

19ff3f4e568c34cd -> ObjectE

...

 

by sending in the whole folder of bundles files into the the ID lookup tool.

 

Is this possible?

 

Thanks again!

 

Message 10 of 16
_robbs_
in reply to: Anonymous

Not with the tool, no.

 

However, the funky IDs are generated by a hash function, which you can call yourself in Lua.

 

So for instance, I have a package file named "content/packages/my_test_package_name.package". When I bundle, that turns into a file named "6c7a7bd25612f329".

 

In Lua, I can create a stingray.IdString64 object, giving it the string whose ID I want to get. Then I can call the to_hex() function to get that funky ID.

 

-- note that I create the ID without the .package extension:

local id_object = stingray.IdString64("content/packages/my_test_package_name");

local hex_id  = stingray.IdString64.to_hex(id_object)

print (hex_id)                      -- prints 6c7a7bd25612f329
Message 11 of 16
Anonymous
in reply to: _robbs_

It works. That's all I will be needing for now.

 

Thanks for helping me!

Message 12 of 16
Anonymous
in reply to: Anonymous

Hi again.

 

So far I am able to stream stuffs using resource_package_from_url in editor and dev build.

However, it crashes immediately upon running in release build.

 

Any idea why this is happening?

 

resource_package itself works fine when streaming from local.

Message 13 of 16
_robbs_
in reply to: Anonymous

Hm, I don't see any reason in the code why it would work in dev but not release.

 

Could you post the crash dump, if you get one?

Message 14 of 16
Anonymous
in reply to: _robbs_

Hi,

 

Attached is the crash dump. It works in editor and dev build.

 

Basically this is the only thing I do:

 

local is_loaded = false
local resource_package = nil
local testObj = nil

function LoadAssets.init()
    resource_package = stingray.Application.resource_package_from_url("http://linkofbinaryfile")
    stingray.ResourcePackage.load(resource_package)
end


function LoadAssets.update(dt)
if is_loaded == false then
         if resource_package ~= nil and stingray.ResourcePackage.has_loaded(resource_package) then
             is_loaded = true
            stingray.ResourcePackage.flush(resource_package)
            
            testObj = SimpleProject.world.spawn_unit(SimpleProject.world, "theUnit")
        end
    end
end

 

 

Thanks!

Message 15 of 16
francis.lavergne
in reply to: Anonymous

I have the same problem...

 

It works fine in the editor (but I get a memory leak problem when I quit the application)

In dev built, it doesn't crash, but the imported units are a pink interrogation mark.

It crash in release built.

 

In html5, the chrome console says that the imported file doesn't exist...

 

If anyone have a solution for this, I would be very interested too! 

Message 16 of 16
Shanii2
in reply to: francis.lavergne

Check that you have released the resource package that u loaded,  also theres a difference between a patch bundle n compiled resources, here's the link that shows this  

https://help.autodesk.com/view/Stingray/ENU/?guid=__stingray_help_managing_content_content_lifecycle...

 

When u deploy each package along withs resources gets bundled up in separate hence their ids are changed, U can manage lookup id tool u to see which content goes where,, and then u have to update the targeting url, with data bundle thats created replacing the one it exists there,  hence u need to manage this ureself and how to load resource bundles for release from the url.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report