Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preload all block textures at startup? #26

Closed
Nesh108 opened this issue Apr 20, 2017 · 2 comments
Closed

Preload all block textures at startup? #26

Nesh108 opened this issue Apr 20, 2017 · 2 comments

Comments

@Nesh108
Copy link
Contributor

Nesh108 commented Apr 20, 2017

Hello there!

Would it be possible to preload the textures at startup?
I am asking because I have noticed that if a new block texture is used, then the engine will try to fetch it, meaning that it can show an empty hole while retrieving it.

If it could just fetch and cache all the textures, it wouldn't matter much as it is expected to have some loading but at least it would have a better overall feel when playing the game.

How could one go about doing that in noa?

@fenomas
Copy link
Owner

fenomas commented Apr 21, 2017

Hey! Short answer: should be possible, but I have no particular idea how.

I think that it should work the same as preloading assets for any other purpose (like loading a font before you display the text). If you load each asset once before creating your noa/Babylon scene, then when Babylon loads the textures they'll come from cache instantly.

So my guess is that any existing "image preload" library should work for this. But I haven't tried it and don't know one to recommend.

@Nesh108
Copy link
Contributor Author

Nesh108 commented Apr 26, 2017

Yeah, that worked out. Just using image-preloader solved the latency issues. Thanks! :D

@Nesh108 Nesh108 closed this as completed Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants