Jump to content

Mixing C++ with lua models


Rick
 Share

Recommended Posts

isn't that the point of scripted entities?

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

Well just asking because everything I've done has been all in lua. The main program being in lua. I assume I have to use the framework in my C++ program and make a global variable for it? I've never used the framework before in C++ I always did things manually myself. Is there an example of this somewhere>

Link to comment
Share on other sites

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

Well just asking because everything I've done has been all in lua. The main program being in lua. I assume I have to use the framework in my C++ program and make a global variable for it? I've never used the framework before in C++ I always did things manually myself. Is there an example of this somewhere>

 

 

Well LoadScene() seems to handle things fine script wise in a test scene I have animations and switches turning things on and off .. but then I only want to use scripting in this fashion with Bmax. Lumooja has posted somewhere the templates for the Wizard or theres this ..

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

That's what I was looking for. Question:

 

// Set Lua framework object
       SetGlobalObject( "fw", fw );

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

 

That looks to me like the first line is doing the same thing as the next 4.

Link to comment
Share on other sites

The main game script should not be used from C++, but it's meant as standalone lua main program when you write your game completely in lua.

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

If I call SendEntityMessage() in C++ will that fire the lua script ReceiveMessage() for that model?

 

 

 

I think so Rick ;)

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

If I call SendEntityMessage() in C++ will that fire the lua script ReceiveMessage() for that model?

Yep. The scripting functionality is built into the model class, so it doesn't matter if it's being used in the editor, a BlitzMax program, a Lua program, or a C++ program. The same routine is called every time. The only tricky difference between the editor and a C++ program is the framework object, but that has been covered in the Lua tutorial.

 

The whole "framework" thing has been kind of a mess. It works the way it is now, and I am not going to change it, but that's one little detail I feel like the design of could have been better.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Yep. The scripting functionality is built into the model class, so it doesn't matter if it's being used in the editor, a BlitzMax program, a Lua program, or a C++ program. The same routine is called every time. The only tricky difference between the editor and a C++ program is the framework object, but that has been covered in the Lua tutorial.

 

The whole "framework" thing has been kind of a mess. It works the way it is now, and I am not going to change it, but that's one little detail I feel like the design of could have been better.

You don't think its worth changing while you can? I mean the LUA functionality has only been out for a month or two. Or is it too fundamental a change to dive into now?

Programmer, Modeller

Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64

Visual Studio 2008 | Photoshop CS3 | Maya 2009

Website: http://srichnet.info

Link to comment
Share on other sites

You don't think its worth changing while you can? I mean the LUA functionality has only been out for a month or two. Or is it too fundamental a change to dive into now?

Why would I want to change the design? What's wrong with this approach?

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Why would I want to change the design? What's wrong with this approach?

You tell me hah. I was just commenting on this:

The whole "framework" thing has been kind of a mess. It works the way it is now, and I am not going to change it, but that's one little detail I feel like the design of could have been better.

Programmer, Modeller

Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64

Visual Studio 2008 | Photoshop CS3 | Maya 2009

Website: http://srichnet.info

Link to comment
Share on other sites

You tell me hah. I was just commenting on this:

The whole "framework" thing has been kind of a mess. It works the way it is now, and I am not going to change it, but that's one little detail I feel like the design of could have been better.

 

i think he meant that in past tense... like the framework implementation before could have had a better design

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Oh, I see.

 

I mean, my original design for the renderer was too low-level for most people to understand. I am not sure what I would have done differently, but it is clear that people want commands like SetBloom(), etc. But then they also want it to be easily customizable. It seems like some kind of higher-level effects layering system would be best, but then it is so hard to use texture memory efficiently and minimize the number of passes. You throw in water reflections, and the whole thing just gets incredibly complex.

 

I think rasterized graphics are just too damn complicated. There should be a mechanism to read the underlying pixel's value, then we wouldn't have to do all this buffer swapping back and forth. Early depth discard is utilized 0% of the time when rendering post-processing effects, so I don't see why it can't be done.

My job is to make tools you love, with the features you want, and performance you can't live without.

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