Loading ALL tiles at first time?

Dibalo

10-06-2007 16:47:20

Ok. Let´s make a little brief. I have a huge map (2049x2049) and it´s paged to 257 sized pages. I´m using physics engine Newton. Because it´s too slow to generate a collision data at runtime, I use newtons serialization system. I want to release my game so creating physics data to this size of map would take hundreds of megabytes. That´s why I´m trying to create those physics files when the map is loaded. The problem is that loadNow-command loads only few tiles around me. That´s why moving around world is terrible because newton has to create physics tiles when new tiles are loaded (of course the loaded physics tile files still exists after tiles unload. The "second load" of the tile is much quicker).

My question is: how can I get EVERY SINGLE pages (and tiles) index data at the beginning of loading that I can create all physic data to files for speeding up my game.


If you didn´t undestood me:

FIRST TIME LOADING MAP
- load every single tiles and create physics files (THIS IS THE PROBLEM)
- hide all unnecessary tiles
- start "playing"
- while browsing, just load physics data from files when new tiles are beight loaded

SECOND,THIRD... LOADING MAP
- load map and start playing (physics file already exist)
- while browsing, just load physics data from files when new tiles are beight loaded

Thank you!

Jon

10-06-2007 17:42:51

You could manually load all of the tiles during start up. This may not be the best way to do it, but should work:

increase MaxPreloadedPages in the terrain cfg file, then

plsm -> setOption ("LoadNow");


Why is it OK to store hundreds of megabytes of physics data on disk during runtime, but not to ship it?

And, why would you want to recalculate the same physics data each run?

One of the benefits of a paging scene manager is not having to load everything at startup.

Dibalo

10-06-2007 18:23:05

You could manually load all of the tiles during start up. This may not be the best way to do it, but should work:

increase MaxPreloadedPages in the terrain cfg file, then

plsm -> setOption ("LoadNow");


Oh... I didnt know that "MaxPreloadedPages"-option. Thank you! :D


Q: "Why is it OK to store hundreds of megabytes of physics data on disk during runtime, but not to ship it? "

A: I quess you understood wrong. Of cource I leave those physic data to disk after first loading. But if I want to share it with net, filesize of hundreds of megabytes is quite too much... :)


Q: "And, why would you want to recalculate the same physics data each run? "

A: As I said before: I don´t calculate those physics files again. Just first time is enought so that I can quickly load physics at the next run.


Q: "One of the benefits of a paging scene manager is not having to load everything at startup."

A: Yea, I know that. But those who have used Newton, knows that creating physics data from tile at runtime is very sloooooow. That´s why it´s better to calculate this data beforehand and load it. I´m not loading all physics data at once. I just create the files that I can load and unload each tiles physichs data fast.

EDIT: I tried to set MaxPreloadedPages value to 16 and load map. It doesn´t work, only gets stuck. :S

Grom

10-06-2007 23:21:14

I asked this same question a while ago. I don't think I ever got it to work, but maybe some of the replies I got can help you!

Jon

10-06-2007 23:53:24

Asking for a page to be loaded does not mean the page is immediately loaded. It depends on how one asks. Normally the requests are placed on load queues, and then loaded as the queue is processed. This means there is a time when the request is on the queue but the page has not been loaded.

I could easily see an attempt to access unloaded data to cause a problem. In fact I suspect this is at the root of a crash I have rarely seen, where I suspect that moving out of range of a page on a preload queue can cause memory to be released which hasn't been allocated yet.

Calling PagingLandScapePageManager::makePageLoadedNow will load a page immedately (and remove it from any pending queues).

Calling PagingLandScapePageManager::getPage(x, z) will return the specified page. So the two combined can force load pages.

Setting the option "LoadNow" as mentioned above will force load all of the pages.