• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Toadhead

[Lua] Installing/compiling and usage of Lua in Windows

4 posts in this topic

Hello guys,

 

I was just wondering, I downloaded the newest source files, compiled them and ended up with a .dll file and the compiler and intepreter .exe files.

But don't I also need a .lib file to link with my program? (as right now I'm getting linking errors when compiling example files).

If so, how do I obtain this .lib file from the source? I am using Visual studio 2012 (btw I know I could just download the binaries).

 

Second, I was wondering why people use the LuaBind or other wrappers, the buildin C API seems quite easy to use, what are the advantages of using these third party wrappers? Wouldn't it give trouble with newer versions of Lua? (having to wait til these wrappers update as well).

 

Kinds regards,

Rob

 

0

Share this post


Link to post
Share on other sites

Took me some time to find it out, but it turned out I had to write  "#define LUA_BUILD_AS_DLL", this also produces the import *.lib file along with the *.dll.

I don't think this was mentioned in the manual, at least not easy to find.

 

About the wrappers, still no good answer. I think most of the wrappers such as tolua and Luabind were last updated in around 2010, not sure if they support lua 5.2 and/or if these projects are dead, but in general I dislike to be dependent on too much third parties. I'll just see how far I get with Lua C API alone and if i need more I'll take a look at them.

0

Share this post


Link to post
Share on other sites

There's a bit of boilerplate code going on with running your own binding if you are using c++, especially when dealing with object oriented stuff. But after you get that out of the way, you can probably write a script that will parse your .h files and output binding code which would require very little fixing. That's what I've done in my most recent project, and it is always a bit of a pain binding classes, but not so much that I hate myself. http://lua-users.org/wiki/BindingCodeToLua for a place to start.

 

If you don't mind depending on boost, then luabind is the way to go. Boost adds an incredible amount of utilities, with the cost of keeping up with another 3rd party library. I've used luabind previously, and the binding code is simple, and easy to read/write. I'd absolutely recommend luabind if you aren't doing this for purely educational purposes.

 

Make sure to take a look at LuaJIT as well. You specifically said 5.2, but LuaJIT has all of 5.1 and some of 5.2 at the same time.

1

Share this post


Link to post
Share on other sites
You can also just include all of Lua's (or LuaJIT's) code directly into your game if you don't want a separate DLL.

Binding libraries are designed to make it easier to glue your C/C++ and Lua code together -- e.g. 1 line of code per function, instead of a dozen.
They also make everything act the same way -- e.g. With manual binding code, you could accidentally pop the wrong argument, or forget to push your return value, or forget some type-safety checks; a binding library ensures every bound function does all these actions in the exact same way.

Also, Lua is *not* an object oriented language (it does not have classes as a built in feature), but it is so flexible that it's very simple to implement OO features like classes and class-inheritance yourself, in Lua code.
Often a binding system will do this for you (implement classes) so that your C++ OO code can be sensibly translated into Lua.

The guys behind the BitSquid engine do actually recommend *not* using a binding library, and instead doing all your binding work manually using the Lua C API. Their reaoning is that these binding systems are often very inefficient, and that they hide a lot of important details, such as big differences between C/C++ and Lua. They say that by doing the binding work yourself, your Engine's Lua API will be much more Lua-oriented, rather than a C++-oriented API that's been shoehorned into Lua.

Personally, I found the existing binding libraries that I surveyed to be way too bloated and inefficient for my tastes, so I wrote an extremely simple one for use in my engine, where most of the time I can bind things to Lua with one line of code, but sometimes need a few more in complex cases - a kind of middle ground between the raw Lua API, and something like luabind..
2

Share this post


Link to post
Share on other sites

Ok thanks guys, guess I'll just play around with the C API and if I feel I need more I'll go to these wrappers.

And I know I can staticly link to Lua but I prefer dynamic, especialy since its very unlikely that I will ever need to change the source code.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0