This topic is now archived and is closed to further replies.

Dr Pain

dedicated server init

Recommended Posts

How can PR be set up so it doesn''t have a rendering window, but still work? I''ve got an MFC application that is to be used as a dedicated game server, so it needs to be able to load PRO files and packages, but it doesn''t need to render. And in fact, I don''t want it to have a graphical window displayed, just the MFC window. After the MFC initialization, I use the following code to attempt to set up PR.
   PR_Settings.MissingTextureFatal = 0;  
   PR_Settings.UseWindowed = 1;
   Terrain_Globals.InitializationParameters.ScreenWidth = 800;
   Terrain_Globals.InitializationParameters.ScreenHeight = 600;
   Terrain_Globals.InitializationParameters.MaxPolys = 10000;
   Terrain_Globals.InitializationParameters.MaxTextures = 1024;
   Terrain_Globals.InitializationParameters.MaxMaterials = 1024;
   Terrain_Globals.InitializationParameters.MaxCharacters = 32;
   Terrain_Globals.InitializationParameters.MaxParticles = 5000;
   Terrain_Globals.InitializationParameters.MaxEmitters = 500;
   Terrain_Globals.InitializationParameters.MaxVoices = 32;
   Terrain_Globals.InitializationParameters.MaxWAVs = 32;
   strcpy(Terrain_Globals.InitializationParameters.PackagePath, "Data/Packages");


   PR_Settings.UseAGP = 1;  // tried 0 also


   PR_SetMode(800, 600, 60);

   Terrain_Globals.DrawCollisionWireframes = 0;
   Terrain_Globals.LOD_Distances[0] =  5000.0f;
   Terrain_Globals.LOD_Distances[1] = 10000.0f;
   Terrain_Globals.LOD_Distances[2] = 20000.0f;
   Terrain_Globals.LOD_Distances[3] = 30000.0f;
   Terrain_Globals.terrain = NULL;


If I leave in the call to PR_SetMode, I get the error that "This video card does not support rendering to a window". If I remove that call, I get an "Unhandled exception in Server.exe" from the PR_SetD3DPipeline call. I''ve also tried removing a variety of the above init lines with more or less the same results. How can I fix this?? What am I missing?

Share this post

Link to post
Share on other sites
Dr Pain, did you got a chance to have a look to on the UserApps dir ?

It implements the terrain engine within a MFC app... It would maybe help you!


Share this post

Link to post
Share on other sites
Thanks for the tip, Amadrias. I looked at MFCPR4F, EPR, and PR4EPR, but they all create a graphical rendering window, which is what I''m trying to avoid.

Share this post

Link to post
Share on other sites

You shouldn''t call PR_Initialize() but LS_InitializeTerrainEngine() instead. That''s the way you get all terrain engine initialized...


Share this post

Link to post
Share on other sites
Well, I found the problem. Once again just a stupid mistake.

I had not included the devdlg dialog resource in my project, and the call to DialogBox() in PR_ChooseDDraw_Driver() fails without a warning, and therefore doesn''t enumerate my video drivers.

Share this post

Link to post
Share on other sites