PLSM and OgreNewt hates me

danni

30-09-2006 02:27:15

I have tried just about every implementation I could see on the forums for PLSM2 and OgreNewt, but everything I try is so god-awful slow that it would never be feasible in a real game.

I am using the gcanyon map scaled a little larger to about the scale I would want for the landscape, ultimately I want a whole map about 5 times this size but it looks like unless I have something totally wrong, PLSM2 and OgreNewt are not going to cut it.

I have used the tileLoader and Newton’s serializer in this implementation, but I also tried generating the geometry by page. Can anyone see what I am doing wrong, or is this just too large of a scale?

Full code here: http://server1.animelab.com/new.zip

danni

30-09-2006 15:25:11

I lowered the LOD to 2 and the CollisionTrees are now generated at an acceptable level. I assume MaxLodUnderCam=2 would force PLSM2's rendered terrain LOD to match the collision data?

HexiDave

30-09-2006 21:43:02

It's ungodly slow because it's adding polygons, one at a time, to a collision object. When you use the PLSM2 wiki/forum implementations, they're all at LOD 0 - you have to adjust the code to pull the other levels of IndexData.

MaxLODUnderCam is a boolean (true or false) so when you set it to 2, it's greater than 0, which means it is True - it sets the maximum LOD (0) when the camera is over that tile.

Instead of building every tile's collision data the second it loads, instead build collision data for tiles that are sure to use it, otherwise you're incurring a butt-load of extra overhead. This really depends on the game logic you're using as I have no clue what you need terrain collision for. You could also (this is on my list of things to do with my terrain engine) wait for an object to get close enough (a physics object or the camera) and attach that tile to a queue - during an update, give a loop a maximum completion time and have it keep looping, adding polygons from that tile to the collision mesh, until you run out of time (to keep frame-rates from dying.) I use this for terrain creation at all levels, so adding this to my terrain manager won't be tough, but basically figure out a frame-count limit and see how much time that would take and just use a Timer object to see how long you're taking.

If you need some code for that queue, I could probably read up on Newton again - I don't have it on my hard drive at the moment.

danni

01-10-2006 15:54:52

That makes sense but is a little disappointing. I am planning to attempt a MMOFPS. Client side this would work, but server side where I would have to duplicate the physics, i don't think it would be ideal to keep loading tiles.

My plan is to use the serializer to cache the generated collision data and load it at the start of a map.

I am quite pleased with the performance at LOD 2 and the size of the tiles collision data dropped from 2MB to 150KB.

How can I force a lower LOD? i.e. 2 instead of 0.

HexiDave

01-10-2006 19:42:25

I don't have time currently to look through your code, but I'll assume you're using the Wiki/forum implementations, so you probably have this code:

//ask reference to geometry to PLSM2
vector<void*> params;
int renderLevel=0;
params.push_back(&pageX);
params.push_back(&pageZ);
params.push_back(&tileX);
params.push_back(&tileZ);
params.push_back(&renderLevel);
sceneManager->getOption("PageGetTileVertexData_2",&params);


That's in the tileLoaded() function. Change renderLevel=0 to renderLevel=2;

That should work nicely.

EDIT: Also, on the server side you should load all tile data where players would be and also tiles in the neighborhood of that tile. You would build all that information beforehand, all of it, and load it from the hard drive on the server as stated.