Best way to manage and preload multiple large scenes?


#1

Hi!

Currently I am working on a large project that involves a basic number of scenes (scene’s that every user always sees) and a number (20 in total) of ‘conclusion’ scenes.

Only one of these conclusion scenes will be shown per user, as they are picked based on the choices of the user in the initial basic scenes. The total load of the basic scenes is around 2mb (non retina), the total load of each ‘conclusion’ scene is also about 2mb (non retina).

My question is: has anyone an idea how to manage all this data? Currently I am thinking about doing the following:

  • only preload the assets involved in the initial basic scenes before the game starts
  • as soon as the result is available, preload only the data for the final ‘conclusion’ scene
  • show the conclusion scene as soon as this one is done preloading

My questions are:

  • Do I need to have ALL the scenes in a single Hype-document? The total export-load is going to be insane (around 50mb for only the regular non retina assets, let alone the retina included). Exporting takes a long time and there is a lot of animation involved, so I need to export very often.
  • Is there an ‘hype-way’ to preload assets in files? I’ve read that calling showNextScene and showPreviousScene back to back will do the trick, but it seems kinda ‘hacky’.
  • Also a not related question: is there an easy way to use folders in the Resources-tree?

Cheers!


Loading logic - best practices?
#2

Simple answer. No. You can spread scenes over multiple documents. And, using the techniques for “accessing scenes from inside and outside Hype” (search for the relevant post here), you can perhaps access the relevant scenes (document) as and when you need it. Can’t really elaborate more as I don’t know your setup. May take a little work to get it as you want it. Data gathering and saving would become a small issue when doing this.

Thinking out loud. I would just have one conclusion scene and dynamically change the data in it based on the user. Again, not knowing your setup I’m not sure what’s being included in those scenes.

image assets are preloaded by default (checkbox in Hype resources pane) others not so much. The only foreseeable way, at least for the moment, is to do the “hacky” thing or get more elaborate in how you introduce data + assets into your setup. Getting dirty with a little Javascript for example.

Unfortunately no. But, there is a way when advance exporting to create a folder structure for assets I believe


#3

Thanks for your reply.

Unfortunately every ‘conclusion’ scene is different (different setup, different animations, different objects, etc). I’ll have another look at the different scenes in different files, but it seems overly complex for a ‘simple’ action.

I’ll see what the ‘hacky’ solution to the preload-issue does. I don’t mind getting dirty with JS though. Do you know if I simply download the assets through external JS, that Hype takes them from the same cache as where I download them, or handles Hype this differently?


(Ken Heins) #4

Probably no more than trying to engineer a way to keep it one document :wink:


(Jonathan Deutsch) #5

Images will be taken through the browser cache so you can preload these yourself*. Audio likely will not be (Hype has a few different methods and the most common WebAudio API method can’t be preloaded via a mechanism beyond Hype’s knowledge). Video could but I think browsers are pretty aggressive about evicting video data.

  • there are web server settings that can invalidate this, but they are rare.

Also these are all areas I’d like to improve on in the future!


#6

Because of the load? I’ve put in 4 of the 20 ‘conclusion’ scenes and already it is running sooooo slow. Is there a good resource on how to combine scenes from multiple files / documents?

edit: Ah, Ive found this: Linking to a specific scene from inside and outside of a Tumult Hype document I’ll give it a try.

another edit: okay I get how they switch scenes, but how do I combine two exports of Hype within one single HTML without them messing each other up.


#7

Ah thanks for pointing that out. I’m only using images, so preloading them should do the trick. Thanks!


#8

#9

Wow, awesome.

I keep running into very specific problems but I also keep running into a lot of deadlines and work (not complaining though!). Hype is such an amazing product with amazing support and community. It sucks that I can’t really take the proper time to test all these scenario’s for myself.

Thank you so much, I’ll have a look into it (when I finish my deadline :smiley:).

Thanks again.