Git Product home page Git Product logo

Comments (11)

sriharshachilakapati avatar sriharshachilakapati commented on May 27, 2024

Coming to adding and removing, you can do that already in the current development version. See the clear method in the ResourceLoader class. I think this is what you are trying to achieve.

Coming to the second point, I don't think that is easy to implement, as I still haven't experimented on how multithreading will effect the GLFW and LWJGL. But if it was achieved, it would be a good addition to the engine. Thanks for your suggestions.

from silenceengine.

ShadowLordAlpha avatar ShadowLordAlpha commented on May 27, 2024

Ok here Ill show you your own code -_-

public void clear(boolean dispose)
{
    if (dispose) dispose();

    fonts.clear();
    fontsToLoad.clear();
    textures.clear();
    texturesToLoad.clear();
    sounds.clear();
    soundsToLoad.clear();
    models.clear();
    modelsToLoad.clear();
}

This clears all your lists and maps so it is no longer possible to old loaded models from the Loader after this call is made. I was thinking more along the lines of adding a way to actively add items to those maps something like an addModel(Model model) method that allows the engine to cleanup at the end and a removeModel(int modeID) that allows for cleanup of the model before the engine finishes without needed to clear the whole list and possibly even keeps that ID so that the user knows it has to be loaded again.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on May 27, 2024

You didn't understand my words, it is possible to reuse the models after clearing these maps. But you have to do so manually and get a reference to the loaded objects. Then you clear the maps, redefine your new resources and load them. Or it may also be that I may not have clearly understood you. My idea is that this is a ResourceLoader and not a ResourceManager. There is a difference between them in my opinion.

from silenceengine.

ShadowLordAlpha avatar ShadowLordAlpha commented on May 27, 2024

OK then my second suggestion still remains but you should probably make a basic resource manager and move the your maps of objects to that so that the only thing the loader handles is loading though its up to you what you do with your engine

In how to load and do things asynchronously as long as the initial thread handles the window and lwjgl stuff it should work fine though synchronization becomes an issue so if you do add it it would probably be a more advanced feature or hidden from the user

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on May 27, 2024

Thanks for your suggestion, it will be done in 0.0.4a release. I'll be leaving it open until it is done in 0.0.4a.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on May 27, 2024

I have re-implemented the ResourceLoader so that now it does asynchronous loading of resources. And by resource map, do you mean a reference counted resource cache or something?

from silenceengine.

ShadowLordAlpha avatar ShadowLordAlpha commented on May 27, 2024

wow I've been slow recently -_-, well being sick does that would be a resource manager. I was talking about a way to add and remove different items from what was the internal list. I have yet to look at the new code that you wrote but if the core is still the same the idea was that it would make it so that you could use the resource loader to load items as needed without loosing the reference to the object or having to reload it when you reset the loader as it kept a reference and cleaned up after itself as I remember.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on May 27, 2024

Okay now that there are a lot of changes in the new resource loader, I would like to know what you are thinking about this. This loader does load asynchronously, has the ability to load at anytime in between, and create as many loaders as you want. See the wiki for the information on what's been changed recently.

Are there any new things that I should have in it? Of course, I do plan to make the rendering of the progress controllable from outside so it might be possible not to block the game loop when loading takes place in middle of the game.

from silenceengine.

ShadowLordAlpha avatar ShadowLordAlpha commented on May 27, 2024

You could probably decouple it from rendering or just add a secondary method or something that tells it not to render a loading screen just because you don't always want a loading screen showing up in a seperate window like if your main loop shows its own loading screen that can be shifted (those are cool and give the user something to do while the gane is loading) while the loading takes place in another thread

other than that though it looks good to me (trying to get my port of TWL to work properly with LWJGL 3 though and its a pain though 90% of it does work now)

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on May 27, 2024

This is now done. I've added another method startLoading(boolean async) that when set async to true, this doesn't take the loop into it's hands. Then through the isDone() and renderLoadingScreen() methods, you can display the resource manager to the screen.

I'm considering to rename the renderLoadingScreen() to update() so that when one sets the rendering callback to null, then it ignores rendering the progress. That is because the progress is currently calculated in renderLoadingScreen() method inorder to smoothly increase the progress bar.

Any opinions on this? See the latest ResourceLoaderTest for more info on this.

from silenceengine.

sriharshachilakapati avatar sriharshachilakapati commented on May 27, 2024

This is done using commit e67e01e so I'm closing this issue. If you have anything to say, you can still comment here.

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.