Git Product home page Git Product logo

Comments (6)

sriharshachilakapati avatar sriharshachilakapati commented on July 3, 2024

This is what I have thought of, and in a way this is solved by using the ResourceLoader. Consider a game which has a large sized resources, and it needs one large file in one level. Now in case we are going to keep a preloader, then we have to keep all these files in the memory, which is not the developer of the game wants. This is the reason I went with the callback approach like JavaScript.

And I said that ResourceLoader can solve this issue, it is like a pre-loader that you are talking, you tell it which files to preload, and once the loading is done, you can get the files content directly because they are already loaded into the memory.

My question is, why to use the ResourceLoader directly in the engine when it is designed to be used by the users?

from silenceengine.

Darkhax avatar Darkhax commented on July 3, 2024

When loading asset files, the developer would almost always want to keep them in memory. While larger files would be the rare exception. It would make much more sense to preload things by default, and have defined ways of dealing with the exceptions.

As for your question, I don't really understand what you're asking. Specifically the used by the users part.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on July 3, 2024

What other engines actually do is they use BrowserFS. I should have searched for it in the beginning, it is awesome and it do really have support for synchronous IO like preloaders do, but once loaded it also caches the data in either LocalStorage, or HTML5 FileSystem or IndexedDB or whatever the browser supports, making it the best choice that we had to have.

I think this can bring us a new synchronous API, even large files means that they need to be loaded only once. This also removes the synchronization issues we have in Android, because we no longer need threads and hence the apps can properly quit without some hacks in AndroidWindow.

I'll start by writing GWT bindings to this API.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on July 3, 2024

It is time for about a release. This is post-poned for now, but in future version, we will have a synchronous API along with the current asynchronous API.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on July 3, 2024

The solution for this is to have the renderers pre created and let the user use the ResourceLoader for the purpose of loading the files. This is even more simpler if you use the ResourceLoadingState.

To make your files loaded in before the game starts, use the on-init callbacks.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on July 3, 2024

Now that the renderers and programs are precreated once in the engine and are cached, I think this is resolved. Regarding access to synchronous IO, that is not possible without increasing memory consumption, and may pose as an issue on HTML5 backend for larger games. So closing this stating that it is now solved.

from silenceengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.