Jump to content

Long script complation time


photo

Recommended Posts

Hello.

Some of our users are very unhappy with load time of our game.

After profiling, we found top time consumers:

1. Terrain loading.

We got 8192x8192 terrain which produces more then 3K texture files, and engine tries to load them all at game load time. AFAIK this problem was already mentioned on this forum. So we are waiting for its resolution in upcoming updates.

 

2. Sripts compilation

int Interpreter::parse(const char *src,NameSpace *ns)) eats lot's of time.

 

The problem seem to have two solutions:

- move code from Unigine script to C++, but this seems unfeasable at the moment as our codebase (only cpp and h) has reached 2.5MB in size and our team has only one client side programmer;

- create a script to byte code compiler, which would do the compilation on design vertion and the game could use a precompiled binary on production version.

Is it possible to make such a precompiler?

Link to comment

You can enable world script caching. Just change "source/engine/world/World.cpp" file at 1616 line "if(interpreter->load(script_name) == 0) {" on the following one:

if(interpreter->load(script_name,engine.engine->getCachePath() + "world.cache") {

This modification will be available in the next SDK update.

 

We will try to improve terrain loading time.

  • Like 1
Link to comment

Wow that would be awesome.

 

There are a couple of things I have noticed that help speed load times up.

 

1) Make sure all assets have full paths starting from data/. Otherwise unigine has to do a search (this isn't so slow when you start out but currently our asset library is in excess of 50,000 files and this really shows);

2) be careful about your use of includes. I tested this after reading that this can be a time killer for C/C++ and it does seem to improve load times. What I have done is made a single.h file and called include.h and in that I have put every file that needs to be included in the order it needs to be included. then included this once in main world file. I then use #ifdef IN_IDE_PARSER to include this file in the other files so that my IDE picks up the code for purposes of code completion.

  • Like 1
Link to comment

if(interpreter->load(script_name,engine.engine->getCachePath() + "world.cache") {

With slight modification of the given code, like:

if(interpreter->load(script_name,engine.engine->getCachePath() + "world.cache") == 0) {

It worked great! Thanks a lot!

 

Thanks for info! We will wait for the upgrade of the terrain loading and advanced node streaming.

Link to comment
There are a couple of things I have noticed that help speed load times up.

Danni, thanks for sharing you ideas!

After fixing all the mentioned troubles we will face the last one: big amount of materials which take pretty much time to load.

In our case the problem appears because all our material libraries are being loaded at the world load time.

 

Did somebody had any experience optimzing materials libraries load time?

Link to comment

Material parsing takes a lot of time due to texture file access and possibly shader compiles. There will be / has to be a solution for this problem for planned world zone streaming, where all these operations have to be delegated to a background task or deferred in a clever way for avoidance of render stalls.

 

Also then possible splitting of large worlds into much smaller world zones (with only some shared 'top-level' material libraries and multiple zone-specific libraries) could speed of world loading a lot.

 

Still there is no info when this long-awaited feature will be available.

Link to comment

"world_load my_world" will load my_world and will save script into the world.cache file.

"world_load my_world my_cache" will load my_world and will save script into the my_world.cache file.

Link to comment
×
×
  • Create New...