Jump to content
  • entries
    945
  • comments
    5,899
  • views
    930,077

Picking up speed


Josh

4,479 views

 Share

Lots of things are happening around here right now!

 

First up, we've got some free professionally made animations for you to use with our futuristic soldier character. You can download the files here.

 

Michael Betke of Pure3D has been cranking out AAA-quality 3D models ready to use in Leadwerks Engine. The following sets are available:

Each set features new unreleased content. Buy a couple today and help support low-cost AAA media for independent developers.

 

I've been spending a little time with C++, and it's not that bad. Mika Heinonen was kind enough to investigate a method of integrating Lua with C++. Here are the findings he reported:

 

I started with the original Lua library, and compiled the source into a C++ project.

 

Then I looked for libraries which could call C++ classes from Lua, and ended up with 2 final candidates:

1) SLB (Simple Lua Binder)

2) Luabind

 

There were first many other alternatives, but they were eliminated pretty quickly on first examination due to the following lacks:

3) LuaBridge: one way only, exporting C++ to lua (no virtual callbacks to lua?)

4) toLua: dead

5) toLua++: requires manual creation of suitable .pkg files

6) luaQT: requires you to filter out unwanted classes, but after that its automatic

and the list goes on.

 

So I started with SLB since it was the first candidate. It was a bit difficult to get it to compile with Visual Studio 2008 C++, since the author

designed it to work only as a C++ library. I tried first to get it compile as integrated source, but it always failed on one line with "SLB::Manager::_singleton".

After I compiled it as a C++ library, it compiled fine and I could make my first Lua program to test it.

 

Soon I realized, it lacks of some essential features, which normally would not be so important, but due to the nature of LE's command interface, which is aiming at natural and easy syntax, the lack of those features would make the programming in LE a OOP hell :)

Basically it lacked of direct access to class attributes, but what was more gravitating, was the lack of dynamic function parameters.

I contacted the author of SLB and got also some reply, but it seems he has no plans to develop SLB very actively.

 

The final contestant was now Luabind. I was a bit sceptical about it first, which is the reason why I wanted to try SLB first, because many people think it's bloated due to the fact that it uses the C++ Boost library.

However, my concerns faded instantly when I first tried to compile my test project with Luabind. What I did first was a minimal project, without using any C++ source files at all, but only header files. I was amazed that it compiled!

 

So, if you don't call any Luabind functions, no Boost code is actually compiled into your executable program. Boost is also fully cross-platform, and standard C++ code, so it compiles on any machine. It's a candidate to becoming an industrial standard like STL, but nothing stops you from using it already today in that manner. Using it will even help it to become sooner an industrial standard.

 

Next I started to bind a C++ class and a few of its methods using Luabind's module() command. Now the compiler actually wanted some Boost source files, and it compiled then also only what it needed.

When people were saying that Boost was bloated, I guess they meant only the size of the files (and mostly documentation with pictures!) on disk, which is indeed quite large, but doesn't really matter anything for your compiled program. Or then they didn't even study how smart it is done, only using what is really neccessary to compile. Besides, you might use Boost anyway in your C++ programs, so it's no additional weight.

 

Finally I tested the Lua program, and everything worked. It's a real joy to work with Luabind, as it accesses directly C++ classes, methods, attributes and even operators (yes, they work even as Lua operators, so you can do: "c=a+b" in Lua, where each of those are class instances), and the effort to publish the classes from C++ to Lua is minimal, and very well structured and easy to understand.

On top of the icecream, the Luabind support and documentation is excellent, which is almost a reason alone to decide for Luabind.

 

At this point, we have a simple C++ project with some math classes the engine uses, and we're making sure it compiles for all the various platforms I want to support.

 

Finally, we're getting ready for the release of version 2.32. There are some physics features that need to be finished to support huge amounts of trees and rocks, and that information has been sent to the author of Newton Game Dynamics. Numerous bugs in the tracker have been resolved recently, and more fixes are on the way for small issues.

 

That's all for now!

 Share

11 Comments


Recommended Comments

I've used Luabind myself, didn't have any problems with it at the time (was a couple of years ago). I liked it anyway, seemed easy enough.

Link to comment

I've been using luabind since LE 2.28. I think it's great because it supports multiple object instances without getting all "confused". You can also define specific functions for each class. Luabind has treated me pretty good.

Link to comment

so when can we expect our current lua game/object scripts to become unuseable due to these changes just like last time? and how is this going to effect bmax + lua?

Link to comment
Guest Red Ocktober

Posted

so when can we expect our current lua game/object scripts to become unuseable due to these changes just like last time?

 

LOL... i was thinking the exact same thing :D

 

 

glad to hear my fears were unfounded... appreciate that Josh B)

 

looking forward to seeing how the new stuff will be integrated into LW...

 

hey... will other platform (macintosh) code start showing up (betas maybe) in 2.32...

 

 

 

--Mike

Link to comment

hey... will other platform (macintosh) code start showing up (betas maybe) in 2.32...

Not cross-platform code, because that is being done in C++, but I will be using version 2.x to develop new ideas before "engraving" the code in C++ for version 3.0.

Link to comment
Guest
Add a comment...

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

×
×
  • Create New...