• 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
andrei94

Why LUA Script ?

12 posts in this topic

Hello everyone ! My name is Andrei and i'm 18 years old. I'm interested in game development and i started to read some books...now i read something about DX11 and its very interesting but in a section about game engines i heard about LUA scripting and heard that it's a good practice ... But why to use it if C++ can do the same thing?


I just wanna some opinions pro's or con. Thanks for help guys ;D
0

Share this post


Link to post
Share on other sites
Also, on top of not having to recompile you can actually modify scripts while the game is running and see the result immediatly, it can also make it quite easy for non programmers (level designers for example) to add custom behaviour to the game without having to ask the programmer to add every tiny little feature.
2

Share this post


Link to post
Share on other sites
In addition to the moddability and decreased turn-around time on modifications that has been mentioned, it also has to do with tooling and productivity.

You can leverage C++ in ways that yield a great deal of performance, but at the same time it has essentially no guardrails and pitfalls are not uncommon -- things like memory leaks, maintaining ownership of resources correctly, and the rabbit-hole of premature optimization. In truth, a large part of the game-specific elements don't need all the performance that C++ can offer you, and so it doesn't make sense to expose that part of the code to all the potential pitfalls. Instead, you can implement those parts of code in a language that is safer, more productive, and "efficient enough" -- and leave the core engine to more-experienced programmers using C++.

There still exists a certain inertia among game developers that "all code is performance-critical" and for a certain type of developer -- say, those pushing the limits of AAA console gaming, it's not entirely untrue. However, this notion that this is true of all games is something that dogs some in the industry, and far too many of those aspiring to be in it.

Objectively, yes, performance matters (you can measure it it, therefore you can rank it), and 300 frames per second is "better" than 270 frames per second -- but subjectively, no one's going to notice whether your game runs at "only" 80 or so frames per second. In the end, all that matters to the consumer is "does this run well enough on my hardware?" and the number of consumers you want to reach is defined by "what hardware can I make this thing run well on?"
1

Share this post


Link to post
Share on other sites
Yes, Lua may execute slower than C++ code, but that shouldn't be seen a reason not to use it. First, make it work. Then, if profiling shows it to be a bottleneck, you can optimize, which may include migrating some routines from Lua to C++. But honestly, JTippets's Goblinson Crusoe is written almost entirely in Lua. The C++ bit is an extrapolation of the Lua interpreter that comes with the Lua distribution.

There are other languages that can be used as scripting languages, such as Python and JavaScript. One thing I like especially about Lua, though, is that it works well for data description, which can be nice if you're into a more data-driven approach.
1

Share this post


Link to post
Share on other sites
lua is great... and lua is horrible...
lua is great as once it is setup and going, it is wonderful, you can modify your game as it plays, not having to recompile and get to the state that you were testing
lua is horrible because setting it up can drive you insane. Well, at least me. Oh, and the documentation isn't always that helpful, for instance, lua_pcall(L, NumArgs, numRet, 0) when I first started using it I had my numArgs being the number of arguments the function needed, the documentation didn't specify specifically that the function call was also an argument, so it was failing on me. The documentation wasn't wrong, it just wasn't helpful enough for an impatient tiered student as of myself find understand it how it was meant to be.

I would recomend that you look into luabind... It can be hard to set up due to the lack of examples to follow and it can be made even harder if you can get impatient.
but once you have it implimented it can be really useful, I am currently working on my own luabinding, yes, it is driving me nuts, but the sheer flexibility it offers is what keeps me going at it.
0

Share this post


Link to post
Share on other sites
[quote name='falconmick' timestamp='1334079283' post='4929946']
Oh, and the documentation isn't always that helpful, for instance, lua_pcall(L, NumArgs, numRet, 0) when I first started using it I had my numArgs being the number of arguments the function needed, the documentation didn't specify specifically that the function call was also an argument, so it was failing on me. The documentation wasn't wrong, it just wasn't helpful enough for an impatient tiered student as of myself find understand it how it was meant to be.
[/quote]
Take no notice of this, Lua's documentation is excellent.

falconmick maybe you should read the documentation next time it clearly tells you the protocol as lua_pcall links to [url="http://www.lua.org/manual/5.1/manual.html#lua_call"]lua_call[/url]

As people are mentioning the speed of Lua compared to C and C++, if this does become a problem you can always you use the excellent and blazingly fast [url="http://luajit.org/"]LuaJIT[/url] which supports quite a lot of platforms now with speed being the same or close to C code.


edit: I just can not let it go :) The Language's name is Lua not LUA,
2

Share this post


Link to post
Share on other sites
I've always thought of args as things that are passed into functions, not everyone is a whiz on this forum.

the downvote button is for not agreeing with someones opinion. That is all it was, I gave a first hand experience of how I have experienced LUA (:3) and even given a description of myself so they can understand why I would say what Ive said


lua needs time to be build in correctly, it is somthing that should be planned and implemented in segments.
0

Share this post


Link to post
Share on other sites
[quote name='falconmick' timestamp='1334114935' post='4930097']
the downvote button is for not agreeing with someones opinion.
[/quote]

Congratulations, you have earned the award of being downvoted by me again.
Grow up, I sent the private message to explain the reason and to tell you it was me that downvoted you please do not use private messages to insult me.
-3

Share this post


Link to post
Share on other sites
This is not the place to discuss the reputation system or your down-votes, and certainly not the place to air a private dispute. If you feel you are being treated unfairly, or that someone is misusing a site feature, use one of the many "report" links around the site and/or contact a moderator.

[b]dmail: [/b]"falconmick" was reasonably clear that he is inexperienced and that he was just sharing his own experience with Lua, and I don't think his intention was to mislead anyone. We are in the "For Beginners" forum here, and correcting a beginner's mistake or taking a moment to highlight the fact that not everyone shares a particular opinion is great, but having been shown the contents of your PM I would suggest that you could be a [i]lot[/i] more tactful in future.

[b]falconmick:[/b] In future, please try not to lash out at other members; if you feel the contents of a private message are abusive or insulting you can use the "report" link at the bottom-right of the message to have a moderator review the situation for you.

[color=#ff0000][b]Any further off-topic replies will be deleted. You have been warned.[/b][/color] Edited by jbadams
Added personalised feedback to each user after having been shown the contents of the private message in question.
1

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