Jump to content

LoadScene() hangs, out of ideas


Dan
 Share

Recommended Posts

Hi all,

 

I have a map that crashes when I load it in the following code:

#include "Framewerk.h"
#include "engine.h"

#include <string>
#include <map>
#include <list>

#include "globals.h"
#include "RvtXmlDomParser.h"
#include "RvtEntity.h"
#include "ProcessScene.h"
#include "CameraControl.h"

#include "UDPSocket.h"

int main( int argc, char* argv[] )
{
string configFile;
ConfigData configData;
map<int, RvtEntity*> entities;

TTerrain terrain;
TCamera camera;
TEntity scene;
TController player;
TBody spectator;

Initialize() ;
RegisterAbstractPath("externals/Leadwerks Engine SDK");
RegisterAbstractPath("./");
SetAppTitle("init");
Graphics();

leadwerks::Framewerk fw;

#ifdef DEBUG
fw.SetStats(2);
#else
fw.SetStats(false);
#endif

fw.Create();

// Setup Global Objects
SetGlobalObject ("world_main", fw.GetMain().GetWorld());
SetGlobalObject ("world_transparency", fw.GetTransparency().GetWorld());
SetGlobalObject ("world_background", fw.GetBackground().GetWorld());
SetGlobalObject ("camera_main", fw.GetMain().GetCamera());
SetGlobalObject ("camera_transparency", fw.GetTransparency().GetCamera());
SetGlobalObject ("camera_background", fw.GetBackground().GetCamera());

TListener listener = CreateListener(fw.GetMain().GetCamera());
SetGlobalObject("listener", listener);


// Setup Initial Post Processing FX
       fw.GetRenderer().SetGodRays(1);
       fw.GetRenderer().SetHDR(0);
       fw.GetRenderer().SetSSAO(0);
       fw.GetRenderer().SetBloom(0);
       fw.GetRenderer().SetAntialias(0);
       fw.GetRenderer().SetReflectionRenderComponents(ENTITY_RENDERABLE);
fw.GetRenderer().SetNearDOF(0);
fw.GetRenderer().SetFarDOF(1);
fw.GetRenderer().SetDistanceFog(1);
fw.GetRenderer().SetDistanceFogColor( Vec4( 1, 1, 1, .7f ) );
fw.GetRenderer().SetWater(1);
fw.GetRenderer().SetCaustics(0);
fw.GetRenderer().SetWaterHeight( 3 );
fw.GetRenderer().SetFarDOFRange(Vec2( 2500, 5000 ) );

fw.GetRenderer().SetContrast(1.2);
fw.GetRenderer().SetBrightness(1.2);
fw.GetRenderer().SetSaturation(1);

// Load Skybox
fw.GetRenderer().SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat"));

if (argc > 1) {
	configFile = argv[1];
} else {
	configFile = "test.xml";
}

initRVT(configFile, configData, entities);
SetAppTitle((str)configData.appTitle.c_str());
Graphics(configData.resX, configData.resY);

// Setup Collisions
Collisions(1, 1, 1);
Collisions(1, 2, 1);
Collisions(1, 3, 0);
Collisions(2, 2, 1);
Collisions(2, 3, 0);
Collisions(3, 3, 1);

scene = LoadScene((str)string("media/Scenes/"/*"externals/Leadwerks Engine SDK/Maps/"*/).append(configData.location).c_str());

 

But loads successfully in this code:

#include "Framewerk.h"

int main(int argc, char** argv)
{
Initialize();

RegisterAbstractPath("../externals/Leadwerks Engine SDK");
RegisterAbstractPath("./");

Graphics(1024,768);

leadwerks::Framewerk fw;

fw.Create();

// Setup Global Objects
SetGlobalObject ("world_main", fw.GetMain ().GetWorld ());
SetGlobalObject ("world_transparency", fw.GetTransparency ().GetWorld ());
SetGlobalObject ("world_background", fw.GetBackground ().GetWorld ());
SetGlobalObject ("camera_main", fw.GetMain ().GetCamera ());
SetGlobalObject ("camera_transparency", fw.GetTransparency ().GetCamera ());
SetGlobalObject ("camera_background", fw.GetBackground ().GetCamera ());

TListener listener= CreateListener(fw.GetMain ().GetCamera ());
SetGlobalObject("listener", listener);


// Setup Initial Post Processing FX
       fw.GetRenderer().SetGodRays(1);
       fw.GetRenderer().SetHDR(0);
       fw.GetRenderer().SetSSAO(0);
       fw.GetRenderer().SetBloom(0);
       fw.GetRenderer().SetAntialias(1);
       fw.GetRenderer().SetReflectionRenderComponents(ENTITY_RENDERABLE);
fw.GetRenderer().SetNearDOF(0);
fw.GetRenderer().SetFarDOF(1);
fw.GetRenderer().SetDistanceFog(1);
fw.GetRenderer().SetDistanceFogColor( Vec4( 1, 1, 1, .7f ) );
fw.GetRenderer().SetWater(0);
//fw.GetRenderer().SetCaustics(0);
//fw.GetRenderer().SetWaterHeight( 3 );
fw.GetRenderer().SetFarDOFRange(Vec2( 2500, 5000 ) );

fw.GetRenderer().SetContrast(1.2);
fw.GetRenderer().SetBrightness(1.2);
fw.GetRenderer().SetSaturation(1);

// Load Skybox
fw.GetRenderer().SetSkybox(LoadMaterial("abstract::FullskiesBlueClear0016_2_L.mat"));

// Setup On Screen Stats Info
fw.SetStats(2);

// Setup Collisions
Collisions(1, 1, 1);
Collisions(1, 2, 1);
Collisions(1, 3, 0);
Collisions(2, 2, 1);
Collisions(2, 3, 0);
Collisions(3, 3, 1);

LoadScene("media/Scenes/UAC_Range.sbx");

 

Both point to the same sbx, that's not the issue, it hangs during, or just after, having loaded some of the textures on the models. But like I said, it doesn't hang in the second code block.

 

Any suggestions as to why it won't load in the first example? I'm out of ideas =/

Windows XP SP3

Intel Core2 Extreme 3GHz

2GB DDR2 RAM

2x NVIDIA GeForce GTX 280 in SLI

Link to comment
Share on other sites

You must call Graphics() before you call any Framework commands. You are calling 2 times Graphics() in the first example too. Remove the 2nd call.

It looks like the string in LoadScene is also garbage, as it contains "*" characters.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

You must call Graphics() before you call any Framework commands. You are calling 2 times Graphics() in the first example too. Remove the 2nd call.

It looks like the string in LoadScene is also garbage, as it contains "*" characters.

Yeah, sorry about the comment I left in the LoadScene call. That was just there so I wouldn't forget where my test directory was.

 

As for the 2 calls to Graphics(), the first one is there because, as you mentioned I need to call it before any Framewerk commands. And the second is there so that the app title and resolution are set properly according to the XML. The duplicate Graphics() calls works flawlessly on other maps, so I didn't consider it an option here, especially since it's not a rendering issue, and just a loading issue at this point. But I will try to remove the second one and try it again and update you if it helped.

 

Thanks for considering my issue. Does anything else strike you as a possibility?

Windows XP SP3

Intel Core2 Extreme 3GHz

2GB DDR2 RAM

2x NVIDIA GeForce GTX 280 in SLI

Link to comment
Share on other sites

Guest Red Ocktober

have you tried stepping through the code... put a breakpoint near where you suspect it's hanging and start your step there...

 

 

also... i'm sure you've already considered this, just mwentioning it in case... but does the log show anything...

 

 

--Mike

Link to comment
Share on other sites

have you tried stepping through the code... put a breakpoint near where you suspect it's hanging and start your step there...

 

 

also... i'm sure you've already considered this, just mwentioning it in case... but does the log show anything...

 

 

--Mike

 

 

Thanks for your suggestion. I have tried that, and it hangs inside LoadScene() which is hidden inside the .dll so the exact spot where it gets stuck is a mystery, but I do know that it's inside the LoadScene() call. The log only shows that it has loaded some items, but does not show any errors, just what it has loaded up to the point where it gets stuck.

Windows XP SP3

Intel Core2 Extreme 3GHz

2GB DDR2 RAM

2x NVIDIA GeForce GTX 280 in SLI

Link to comment
Share on other sites

Thanks for your suggestion. I have tried that, and it hangs inside LoadScene() which is hidden inside the .dll so the exact spot where it gets stuck is a mystery, but I do know that it's inside the LoadScene() call. The log only shows that it has loaded some items, but does not show any errors, just what it has loaded up to the point where it gets stuck.

 

Just to let you know... I solved this issue by starting a new project and copying in my files. I have no idea why the first project didn't work, but it's fixed now. Has anyone seen Visual Studio corrupt a project file before?

Windows XP SP3

Intel Core2 Extreme 3GHz

2GB DDR2 RAM

2x NVIDIA GeForce GTX 280 in SLI

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...