Archived

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

dedicated server init

This topic is 5813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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_SetWindow(hAppWin);

   ChooseDevice();
   PR_Settings.UseAGP = 1;  // tried 0 also

   PR_Initialize(10000);             
   InitializeDevices();

   PR_AllocMaterials(512);
   PR_AllocTextures(512);
   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;

   PR_InitTimer(60);
   LS_InitializeCharacters();
   CHR_AllocateCharacterTypes(128);

   PR_SetD3DPipeline(1);
  
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 EPR.zip on the UserApps dir ?

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

Amadrias

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