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
Solved! Go to Solution.
Solved by _robbs_. Go to Solution.
Hi,
have you tried looking at the stingray.Application.release_package_from_url() function?
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.
Thanks for the reply.
When you mention bundled data file do you mean it takes in the zip output file from following this page?
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:
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.
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!
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.
3. If you're using the resource_package_from_url, you don't need the .dlc file at all.
4. Correct!
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!
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.
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!
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
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.
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?
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!
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!
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
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.