Jump to content

LoadScene


Rekindled Phoenix
 Share

Recommended Posts

I 'm having issues loading the lights of a scene when calling the C# Header function LoadScene.

 

I didn't think that the engine natively had that function, I thought it was part of an additional file.

 

Here is my light declaration in the SBX file (2.28)

	Model {
	position=0.000000000,1.00000000,0.000000000
	rotation=54.9999962,24.9999924,3.02546209e-006
	scale=1.00000000,0.999999881,0.999999940
	"classname"="light_directional"
	"color"="255 255 255 255"
	"intensity"="100"
	"name"="light_directional"
	path="light_directional.gmf"

 

Any suggestions to get my lights to show up? (besides creating new ones)

Link to comment
Share on other sites

The engine has that function. Are you using Framewerk? If so, don't forget to set "true" to "enableLua". If not, make the "GlobalKey" for your world "world_main".

 

Framewerk.Initialize(true);

or

new World().GlobalKey = "world_main";

Link to comment
Share on other sites

I'm waiting for Josh to give me access to the 2.31 Dll, So I don't have access to Framewerk yet. Josh just gave me access to the 2.3 files this morning.

 

So far adding "world_main" or "world main" does nothing. This is the start to my testing app. Am I loading the Scene correctly?

 

VB

       
       '//Add Scene, needs a pointer for constructor
       Scene = New Scene(LoadScene("abstract::Distopia.sbx"))

       '//With Framewerk (alternate)
       Scene.Load("abstract::Distopia.sbx")

Link to comment
Share on other sites

Here's mine, tell me if you still get trouble after that:

Graphics.Initialize(1024, 768);
Framework.Initialize(true);
FileSystem.AbstractPath = @"C:\Program Files\Leadwerks Engine 3.0";
Scene.Load(@"abstract::test.sbx");

 

EDIT: Make sure your script directory is in the executable library, as lights are scripts.

Link to comment
Share on other sites

So even with the Abstract Path as the SDK or SDK/Scripts folder, the scripts still don't work. No light.

 

*Reads*

"Make sure your script directory is in the executable library, as lights are scripts."

Why can't Lua files be in the Abstract Path directory instead of adjacent to the EXE?

 

So I've copied and pasted the entire Scripts folder into my Debug / Bin folder, where VS2008 creates the EXE. Now I have too much light, even if I change the intensity in the SBX file. Everything is pure white...

 

EDIT:(...and is the framewerk water level supposed to follow your camera? O.o)

Link to comment
Share on other sites

I'd need to see some code and folder structure, it seems to act quite strangely on your side.

 

Why can't Lua files be in the Abstract Path directory instead of adjacent to the EXE?

I requested that feature. Can't remember why it got denied or delayed, but it did.

Link to comment
Share on other sites

  • 7 months later...

Sorry for necroposting but currently all my tries with LoadScene return me "Input string was not in a correct format."

Core.LoadScene("abstract::demo.sbx"); works like it should.

Whats the problem?

 

 

P.S. C# docs are awful :lol: Its just a pain to find anything. I should really consider switching to C++...

 

P.P.S Y as a vertical axis kills my brain

Link to comment
Share on other sites

You should use Scene class and not Core.LoadScene

It doesn't work!

Scene.Load("abstract::demo.sbx");

Results in:

Input string was not in a correct format.

 

 

Also Draw.Text("Test"); (same for Core.DrawText()) doesn't work. Text is not displayed on screen (but works in C++ with DrawText()). Maybe font is missing?

 

Also there is other stuff i that is working really strange... I started to think i wasted my money. I really expected much more docs to be present. :lol:

Link to comment
Share on other sites

C# docs at http://middlewerks.com/headers/ are awful?

They are great but there are only 5 of them!

http://middlewerks.com/headers/5 and all after are inaccessible, thats the problem. Other searches i've done on forums return confusing results (2 topics can have different implementation of 1 thing and i just cant get what should i use).

 

 

Also whats about not working Draw.Text? I just cant get it working. I tried all i can already.

Link to comment
Share on other sites

The following code works without issue for me (I use the latest headers and the official 2.40 engine.dll, not the custom one available in the download section):

 

namespace TestLeadwerks2Console
{
   class Program
   {
       static void Main(string[] args)
       {
           try
           {
               Engine.Initialize(DisplayMode.Window, 800, 600);
               Framework.Initialize();
               FileSystem.Initialize();
               FileSystem.AbstractPath = "C:/Leadwerks Engine SDK";
           }
           catch
           {
               Engine.Terminate();
           }

           Scene scene = new Scene("abstract::test.sbx");

           while (!(Window.HasRequestedClose || Keyboard.KeyHit(Key.Escape)))
           {
               Framework.Update();
               Framework.Render();
               Graphics.Flip();
           }

           Framework.Terminate();
           Engine.Terminate();
       }
   }
}

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

You could try to set the full path into a variable and debug its value, may be it returns a null or empty value so the engine LoadScene fails. After this I cannot see more possible issues (can you attach your sample not working project solution and demo.sbx?).

 

// After initialize try/catch
string path = FileSystem.GetAbsolutePath("abstract::demo.sbx");

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

You could try to set the full path into a variable and debug its value, may be it returns a null or empty value so the engine LoadScene fails. After this I cannot see more possible issues (can you attach your sample not working project solution and demo.sbx?).

 

// After initialize try/catch
string path = FileSystem.GetAbsolutePath("abstract::demo.sbx");

Path points right the way it should (to the map). Just checked. Demo.sbx is just a simple map with dummy terrain.

Anyway here is is: Maps.rar

Solution is just a blank template with Leadwerks.dll reference and 1 class file with sample code you provided. I don't think something is wrong with it.

 

I even tried filling the full path like this

Scene scene = new Scene("D:\\Leadwerks Engine SDK\\Maps\\demo.sbx");

Still the same. Will install VS2010 on my laptop and try it.

 

 

Quick question. How to change world gravity if i'm using Framework? (it creates world already and World.Current.Gravity.Y doesn't work, NullPointer)

 

 

Edit: Ok, tested on my Dell Vostro. Fresh VS10Ultimate, empty template. Same result.

Link to comment
Share on other sites

Sorry but I finished my ideas about your scene loading problems, have you tried to use the express version of VS 2010 instead of Ultimate (or use another folder for the compiled+medias like "C:\TEMP")? Or also running directly the compiled EXE instead of start debugging? I know this is odd but I don't know what to try next because I have no issues with that code and your sbx.

 

Quick question. How to change world gravity if i'm using Framework? (it creates world already and World.Current.Gravity.Y doesn't work, NullPointer)

Gravity vector is not initialized from default (even if I read somewhere in the forum that a ~20 gravity is already set by default internally in the engine), so you should initialize yourself with a new Vector3(0,WHAT_YOU_WANT,0)

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

Sorry but I finished my ideas about your scene loading problems, have you tried to use the express version of VS 2010 instead of Ultimate (or use another folder for the compiled+medias like "C:\TEMP")? Or also running directly the compiled EXE instead of start debugging? I know this is odd but I don't know what to try next because I have no issues with that code and your sbx.

 

 

Gravity vector is not initialized from default (even if I read somewhere in the forum that a ~20 gravity is already set by default internally in the engine), so you should initialize yourself with a new Vector3(0,WHAT_YOU_WANT,0)

I tried all this before (moved to C:\, renamed, replaced, copy, etc etc etc). All the same. It just doesn't work.

 

Also no Draw functions work. Thats so lame. I cant figure out what is wrong :) This really stops me from doing anything.

 

Maybe someone from header devs can look into this problem? This is really REALLY bad.

Link to comment
Share on other sites

Of course your project build platform is set to x86, right? I'll try to find a PC with VS10 Ultimate, even if it's a bit strange that the difference of VS family in the same version could create such issues but it seems to be the only difference between our systems.

Yep, its x86. I will install a VS2008 on my old laptop with XP today and try the compilation (binaries won't work there though)

Link to comment
Share on other sites

You cannot use 2008 with the new headers because it requires framework 4.0, so you must use 2010. You should just try with C# 2010 Express.

Tested with Express version on my net-book. And... it still doesn't work when i try to run it on work pc. Maybe it has something to do with my russian windows (path gets corrupted on executing machine? Because i have an english win on net-book)?

Anyway it seems to be a library bug. (Draw doesn't work with express too).

 

So until this bug is fixed i can't do anything (scene loading is working with Core, but Draw doesn't so i cant draw any interface currently, nor show debug info on screen).

 

And this is not a low priority bug because if i compile it on english version it still doesn't work on russian one, so all russian windows is currently unable to run C# coded leadwerks apps correctly. Thats very bad.

 

ZioRed can you please send me a compiled exe with scene loading (just exe, and empty scene)? If it won't work then its a locale bug with headers.

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...