Jump to content

LE3D Asset Loading and Threads


Roland
 Share

Recommended Posts

Josh. In LE3D, will it be possible to load models etc in a background thread.

In Leadwerks3D we have the LoadXXXX command which loads an assets and attaches it for rendering in the same command. That makes background loading hard to do. Would it be separated so LoadXXXX just loaded the asset, and we then could Add the asset when its time for rendering, background loading would be easy in LE2. How will that be in LE3D?

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

The only reason why multithreading does not work in LE2, is that when loading a model, the texture size is reported as 0 in the threads. This is probably caused by the way how LE2 uses OpenGL.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

But say I want to load a completely new scene while still at end of current one. The LoadModel commands will automatically show the new models as they are loaded, right? I don't want to show or use them until the current scene is ended, and then quickly be able to switch to next one without loading delay.

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

LoadModel works only in the main thread, because of the texture 0 size problem. Everything else in LE2 is multi-threading capable, just not LoadModel.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I don't think it can be fixed in LE2, because it uses garbage collection, that is the core reason for all problems with LE2. Slow CPU performance (GPU performance is OK), Windows Desktop disappearing (the classical BlitzMax bug, which some have, some don't (or who don't use their computer much, but still have it)). The sole fact that LE3D is written in C++ will solve a lot of problems, because C++ just works.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Leadwerks3D makes extensive use of multithreading in its internal routines. Great care has been taken so that physics and pathfinding will constantly run in a background thread, only syncing up with the main thread when tasks are complete. However, you can't just call engine commands from different threads arbitrarily.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Like Windows Phone apps, everything should be done in multi-threading manner. Sorry for giving Microsoft a credit, but they accidentally do sometimes something right. I actually noticed this with Fastnet yesterday, the whole idea of of WinSock is to drive the whole init+run+term chain into a seperate process. Kinda wierd, but it makes sense, and it requires also less programming, because you just multi-thread the whole program and don't have to take care of any threads or conditions.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

..actually, you can do it in LE2, by loading your assets and Hidding them, soon as they are loaded, just before render/flip calls..it works for me..

 

That is what I was doing. I loaded all the models I needed for a level and hid the ones that were not necessary. Kinda like a content factory. However, doesn't that take up a lot of memory space to store all the data for all the models?

 

I like that you are giving Microsoft a credit smile.png

 

Same I actually like Microsoft..

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

Same I actually like Microsoft..

Same here ... and apparently the chip on the shoulder of Linux fanboys is manufactured by AMD and not Intel ... fits the stereotype I guess biggrin.png

Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++

Link to comment
Share on other sites

..actually, you can do it in LE2, by loading your assets and Hidding them, soon as they are loaded, just before render/flip calls..it works for me..

Yeah that should work. But how do you know when you are just before 'flip' when you are in a 'loading thread'.

Maybe some semaphore or other thing.. hmm.. yeah that would probably work. Great idea.

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

@Roland

Yes, of course..what I said is just a simplified way of process itself, but basically, there is a loading manager what will make sure that all assets are loaded before render/flip call is executed..it does work fine so far, even more elegant solution will be levels set in such way that initial camera cant see them, regardless of rendering/flip execution or not..

 

Link to comment
Share on other sites

You can potentially get random crashes doing that. There are a great many ways it can mess things up. For example, if the model surfaces get initialized while the engine is in the middle of rendering something, or if the global models list gets modified while being read, etc. it will cause unpredictable behavior and nondeterminstic results.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

You can potentially get random crashes doing that. There are a great many ways it can mess things up. For example, if the model surfaces get initialized while the engine is in the middle of rendering something, or if the global models list gets modified while being read, etc. it will cause unpredictable behavior and nondeterminstic results.

Yes. That was what I was afraid of.

Well. No big deal. I will manage it some other way.

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...