Jump to content

Scene Loading Example


Marleys Ghost
 Share

Recommended Posts

Note the change: shaders.pak not textures.pak ... see told you I was full of beer :D

 

Again all complaints addressed in PM and sent to Macklebee .....

 

 

:D

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

still the same problem...

 

the noise.dds is in materials/effect folder

shaders.pak in the directory where the source code is

all engine related dll's are also in source directory

RegisterAbstractPath() points to the correct folder

 

no idea what the problem is....

 

copied the noise.dds to the source directory and it works!

but this cant be the way...

Link to comment
Share on other sites

still the same problem...

 

the noise.dds is in materials/effect folder

 

 

which is where? (the materials/effect folder that is)

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

yes it loads the texture if I copy it to the source directory.

warnings: aosizereduce and ssaostrength does not exits.

but it works now.

no idea why I have to copy this texture....

 

 

can you post your abstractpath line?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

And "Leadwerks Engine SDK" is the install directory for 2.3 yes?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

sorry it's all working now without copying the texture.

slashes instead of backslashes in the abstract path registration did it :D

thanks anyway for your immediate support

hope you will forgive newbies :D

 

thanks

Andi

 

 

No problems at all Andi, am glad its all working now :D

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

RegisterAbstractPath("D:\Program Files\Leadwerks Engine SDK");

 

glad to see you fixed it, in C it should be double backslashes (because backslash is a escape character)

RegisterAbstractPath("D:\\Program Files\\Leadwerks Engine SDK");

 

your solution works as well, but I'm not sure why...

RegisterAbstractPath("D:/Program Files/Leadwerks Engine SDK");

Desktop:

Intel 2600K - Gigabyte Z68X-UD3H-B3 - 16GB G.Skill Sniper - EVGA 580 gtx - Raid0 OCZ Vertex 3 SSD - Win7 64bit.

Link to comment
Share on other sites

Using VC++ 2008 Express

 

Use the 2.3 Project Wizard to create a new project

 

I simply called the example "sceneloading" (again ...)

 

Delete the generated example code in sceneloading.cpp

 

Replace with the following code:

 

 

#include "engine.h"

int main(int argc, char** argv)
{
Initialize();
RegisterAbstractPath("PATH TO YOUR SDK FOLDER");
Graphics(800,600);

AFilter() ;
TFilter() ;

TWorld world = CreateWorld() ;
if (!world) {
MessageBoxA(0,"Error","Failed to create world.",0);
return Terminate();
}

TFramework framework=CreateFramework();
TLayer layer = GetFrameworkLayer(0);
TCamera cam=GetLayerCamera(layer);
PositionEntity(cam,Vec3(0,0,0));

//Set Lua variable
BP L=GetLuaState();
lua_pushobject(L,framework);
lua_setglobal(L,"fw");
lua_pop(L,1);

// Setup Initial Post Processing FX
SetGodRays(1);
SetHDR(1);
SetSSAO(1);
SetBloom(1);
SetAntialias(1);
SetStats(2);

LoadScene("abstract::YOUR_SCENE.sbx");

// Setup spectator
TBody spectator=CreateBodySphere();
SetBodyMass(spectator,1);
SetBodyGravityMode(spectator,0);
SetBodyDamping(spectator,1.0);
EntityType(spectator,3);
SetBodyBuoyancyMode(spectator,0);
PositionEntity(spectator,Vec3(0,5,-10));

TVec3 camrotation=Vec3(0);
float mx=0;
float my=0;
float move=0;
float strafe=0;

HideMouse();
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

// MAIN LOOP
while (!KeyHit(KEY_ESCAPE))
{

mx=Curve(MouseX()-GraphicsWidth()/2,mx,6);
my=Curve(MouseY()-GraphicsHeight()/2,my,6);
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

camrotation.X=camrotation.X+my/10.0;
camrotation.Y=camrotation.Y-mx/10.0;
RotateEntity(cam,camrotation);

move=KeyDown(KEY_W)-KeyDown(KEY_S);
strafe=KeyDown(KEY_D)-KeyDown(KEY_A);
TVec3 force = Vec3(strafe*10.0,0,move*10.0);
force=TFormVector(force,cam,0);
AddBodyForce(spectator,force);

UpdateAppTime();
UpdateWorld(AppSpeed()) ; 

PositionEntity(cam,EntityPosition(spectator));

// Update timing and world
UpdateFramework();

// Render
RenderFramework();

// Send to screen
Flip(0) ;
}

return Terminate();
}

 

Copy to the sceneloading project folder

 

engine.dll

newton.dll

shaders.pak

Scripts folder

 

from your 2.3 SDK folder

 

 

Create a scene and save it in the maps folder in your SDK folder. Should work, but I am having a few beers :blink: so address all complaints to .. erm ... Macklebee :)

 

If I use LEO Framework, how can I pass framework to LUA?

This doesnt work:

Framework *fw1=new Framework();
fw1->Create();

BP L=GetLuaState();
lua_pushobject(L,(BP)fw1);
lua_setglobal(L,"fw");
lua_pop(L,1);

LoadScene("C:/test/deserthighway.sbx");

 

It gives me error "Access violation reading location 0x2f005800" on LoadScene function. Im doing something wrong?

Q6600@2.4GHz - 9600GT - 4GB DDR2@800MHz - Windows7 x64

3ds max / photoshop CS3 / C++

http://www.arbuznikov.com

Link to comment
Share on other sites

If I use LEO Framework, how can I pass framework to LUA?

This doesnt work:

Framework *fw1=new Framework();
fw1->Create();

BP L=GetLuaState();
lua_pushobject(L,(BP)fw1);
lua_setglobal(L,"fw");
lua_pop(L,1);

LoadScene("C:/test/deserthighway.sbx");

 

It gives me error "Access violation reading location 0x2f005800" on LoadScene function. Im doing something wrong?

you cannot do this. you must choose between full C++ framewerk or engine.dll included framework.

Lua expects a handle to the engine.dll framework, the C++ framewerk is not compatible.

 

i know this because i also hit this problem, one solution would be to extract framework from engine.dll and create a framework.dll with defined header ... this way we could create a compatible framework.dll in C++ and lua could call exported methods without knowing it's bmx or C++ compiled code. But i don't think Josh is headed this way now that framework is included in engine.dll.

 

Anyway, if you don't want to modifiy the framework code, solution 2 with the engine.dll integrated framewrok is the easyest solution.

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

It should work, since it works in gamelib too (and gamelib is using LEO Framework):

 

from gamelib.cpp:

	luat.Create();					// create the LuaTools object
luat.SetScriptObject("fw",scene.framewerk);	// set the Lua variable fw

// Structs

int LuaTools::GetStackSize()
{
return GetTop();
}

void LuaTools::SetStackSize( int size )
{
int currentsize = GetStackSize();
if( size<currentsize )
	Pop( currentsize-size );
}

void LuaTools::SetScriptObject( const std::string& name, BP o )
{
int size = GetStackSize();
PushObject( o );
SetGlobal( name );
SetStackSize( size );
}

 

from gamelib.h:

// Structs

class LuaTools : public Lua
{
public:
int GetStackSize();
void SetStackSize( int size );
void SetScriptObject( const std::string& name, BP o );
};

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

It should work, since it works in gamelib too (and gamelib is using LEO Framework):

 

very interresting :D ... i'll have a closer look at LEO. Thanks

 

EDIT : Hmmm ... when i see this in LEO framework :blink:

 

   inline void Framework::Update() const
   {
	::leUpdateFramework();
   }

   inline void Framework::Render() const
   {
	::leRenderFramework();
   }

 

this makes me think LEO is calling the engine.dll framework methods ... and not the C++ framewerk renderer methods

 

not sure ;) but probable

 

in that case it will work, but the C++ framewerk is not used

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

Yes, LEO is using Framework, not Framewerk.

And ArBuZ is using LEO Framework also:

Framework *fw1=new Framework();

However, he seems to be passing **fw to Lua, and not *fw, that might be the problem.

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

Yes, LEO is using Framework, not Framewerk.

And ArBuZ is using LEO Framework also:

Framework *fw1=new Framework();

However, he seems to be passing **fw to Lua, and not *fw, that might be the problem.

Happy you found out Arbuz problem. If it's just a C++ coding issue than you're far better than me ;) for sure.

 

What will happen with the old C++ framewerk. Totally deprecated or a come back is possible ?

Windows 7 home - 32 bits

Intel Quad Q6600 - nVidia GTX 460 1GB - 2 GB RAM

Link to comment
Share on other sites

You can still use it for games which don't use Lua, also in LE 2.3.

You could also use it for games which use Lua, but then you need to customize a few entity scripts.

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

  • 1 month later...
  • 2 weeks later...

sorry to knock at this door again but i got trouble with LE 2.31

not working on compile project

 

Exception non gérée à 0x1014eec4 dans projetx6.exe : 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0x00000068

 

and stopping in engine.cpp at these lines:

 

inline void RenderFramework(void)
{
leRenderFramework();
}

 

 

 

and here my full code page:

 

#include "engine.h"

int main(int argc, char** argv)
{
       Initialize();
       RegisterAbstractPath("C:\Program Files\Leadwerks Engine SDK");
       Graphics(800,600);

       AFilter() ;
       TFilter() ;

       TWorld world = CreateWorld() ;
       if (!world) {
       MessageBoxA(0,"Error","Failed to create world.",0);
       return Terminate();
       }

       TFramework framework=CreateFramework();
       TLayer layer = GetFrameworkLayer(0);
       TCamera cam=GetLayerCamera(layer);
       PositionEntity(cam,Vec3(0,0,0));

       //Set Lua variable
       BP L=GetLuaState();
       lua_pushobject(L,framework);
       lua_setglobal(L,"fw");
       lua_pop(L,1);

       // Setup Initial Post Processing FX
       SetGodRays(1);
       SetHDR(1);
       SetSSAO(1);
       SetBloom(1);
       SetAntialias(1);
       SetStats(2);

       LoadScene("abstract::jeux6.sbx");

       // Setup spectator
       TBody spectator=CreateBodySphere();
       SetBodyMass(spectator,1);
       SetBodyGravityMode(spectator,0);
       SetBodyDamping(spectator,1.0);
       EntityType(spectator,3);
       SetBodyBuoyancyMode(spectator,0);
       PositionEntity(spectator,Vec3(0,5,-10));

       TVec3 camrotation=Vec3(0);
       float mx=0;
       float my=0;
       float move=0;
       float strafe=0;

       HideMouse();
       MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

       // MAIN LOOP
       while (!KeyHit(KEY_ESCAPE))
       {

       mx=Curve(MouseX()-GraphicsWidth()/2,mx,6);
       my=Curve(MouseY()-GraphicsHeight()/2,my,6);
       MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2);

       camrotation.X=camrotation.X+my/10.0;
       camrotation.Y=camrotation.Y-mx/10.0;
       RotateEntity(cam,camrotation);

       move=KeyDown(KEY_W)-KeyDown(KEY_S);
       strafe=KeyDown(KEY_D)-KeyDown(KEY_A);
       TVec3 force = Vec3(strafe*10.0,0,move*10.0);
       force=TFormVector(force,cam,0);
       AddBodyForce(spectator,force);

       UpdateAppTime();
       UpdateWorld(AppSpeed()) ; 

       PositionEntity(cam,EntityPosition(spectator));

       // Update timing and world
       UpdateFramework();

       // Render
       RenderFramework();

       // Send to screen
       Flip(0) ;
       }

       return Terminate();
}

 

thank you for helping

AMD Ryzen 5900HX - Nvidia RTX 3070 - 32 Go - 1To SSD - W11

Link to comment
Share on other sites

Compiles ok for me. Using the deserthighway.sbx

 

How have you set the project up?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

i set it like other wiki C++ tutorials, exactly like josh video tutos

(was working with "camera controls" official tuto)

i think i am wrong somewhere here

 

general dir out : "..\$(ConfigurationName)"

 

debug working dir : "../.."

 

C++ with include dir "SDK_path/CPP"

 

link editor: "../../$(ProjectName).exe"

 

that's all i can see for my settings

 

thanks for help

AMD Ryzen 5900HX - Nvidia RTX 3070 - 32 Go - 1To SSD - W11

Link to comment
Share on other sites

The LE Wizards much easier. but have you copied over the DLL's, shader.pak and scripts directory to your app dir. ?

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

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