jmonkeyengine
jmonkeyengine copied to clipboard
Multithreading in AssetManager
Multithreading is an important issue right now. Taking advantage of it in jME3 is critical. Some areas where multithreading can be used:
- Skeleton animation, mesh skinning
- Particle update
- Physics
- Networking
- Input polling
- OGG/Audio streaming
- Resource loading
- Terrain streaming
The details on how to implement these areas using multithreading will be specified later.
Some parts of jME3 are already multi-threaded:
Physics runs in a parallel thread. Networking runs in a parallel thread. Audio and OGG streaming is done on a parallel thread. Terrain streaming/LOD is done in a parallel thread.
jME3 is still missing asset loading on a separate thread, which can be critical if the application loads assets dynamically.
The AssetManager is the last part of jME3 that needs to take advantage of multithreading.
Reference on googlecode: https://code.google.com/p/jmonkeyengine/issues/detail?id=94
Actually, the assetmanager is quite capble of being used in a background thread, however the uploading to the gpu is not currently.
To upload to GPU you can use Application.enqueue()
with a Callable
that calls RenderManager.preloadScene()
.
Actually what I was thinking was something like
Future<T> loadAssetLater(AssetKey<T> assetKey)
which would let you load an asset on a separate thread. Perhaps you can set the executor via
void setExecutorService(ExecutorService executorService)
Long time, what's the status of this ? I will work on it, please provide adequate information on what's need to be done if possible, there a multiple approaches this can be done.
I believe JME's asset manager is sufficiently multithreaded. In my opinion, what's missing is documentation---in other words, a tutorial explaining how to load assets in the background.
I believe JME's asset manager is sufficiently multithreaded. In my opinion, what's missing is documentation---in other words, a tutorial explaining how to load assets in the background.
Hmm, I guess this is not the case, jme lacks an async TaskManager in general, see #75, and by building a good async task manager we will be able to natively load our assets easily without the need of external means of java concurrency, I was willing to put some effort onto this and try implementing the feature if that is the case.