About Store Forum Documentation Contact
Donations:
345$/mo



Post Reply 
Lua integration
Author Message
kulesz Offline
Member

Post: #1
Lua integration
When developing some software using a game engine, it is important to have as many things in one place as possible. Maybe integration with lua scripting language would be a good idea, instead of using external libraries like luabind?
10-24-2011 04:24 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #2
RE: Lua integration
May I ask what you have in mind in using LUA?

www.thinkplaystudios.com
10-24-2011 10:29 PM
Visit this user's website Find all posts by this user Quote this message in a reply
kulesz Offline
Member

Post: #3
RE: Lua integration
NPC behaviours, item actions, enemy actions, configuration scripts, world settings, quests, some game mechanics... There's quite a lot of this :-)
10-25-2011 05:56 AM
Find all posts by this user Quote this message in a reply
Seba Offline
Member

Post: #4
RE: Lua integration
10-25-2011 09:11 PM
Find all posts by this user Quote this message in a reply
kulesz Offline
Member

Post: #5
RE: Lua integration
I know this tutorial and I know, how to use LB. But it would be good to have such feature integrated with engine.
10-26-2011 06:00 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Lua integration
I'll more likely develop my own scripting than integrate lua
10-26-2011 10:56 AM
Find all posts by this user Quote this message in a reply
kulesz Offline
Member

Post: #7
RE: Lua integration
Won't it make a little less "compatible" (like UnrealScript compared to C# in Unity)? Lua is quite a popular scripting engine.
10-26-2011 11:26 AM
Find all posts by this user Quote this message in a reply
dylantan Offline
Member

Post: #8
RE: Lua integration
(10-26-2011 11:26 AM)kulesz Wrote:  Won't it make a little less "compatible" (like UnrealScript compared to C# in Unity)? Lua is quite a popular scripting engine.

Yeah quite agreed. Actually we are using them ourselves but mostly for AI purposes. As for the rest, we use C++
10-27-2011 10:08 AM
Visit this user's website Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #9
RE: Lua integration
I'm on the fence about having a 3rd party language to define game logic. And truthfully, anything that is outside of code should be just settings, and nothing more (not logic, etc). The reason the other engines extend 3rd party scripts is to allow simpler game designers to adjust game logic and behavior without touching real code. But for us indies, we can extend a configuration file and fill it with settings that we can use within our program executables. Unless you have a large team already and they need to participate in game logic and mechanics development thru a high level language, then I see this as a "like to have" and not a "need to have". We can code everything in C++ and have access to the code anytime, why is a scripting language necessary at this point?

www.thinkplaystudios.com
10-27-2011 04:39 PM
Visit this user's website Find all posts by this user Quote this message in a reply
kulesz Offline
Member

Post: #10
RE: Lua integration
I cannot agree... Even when you have a small team, 1-3 members, no matter how big the project is, scripting is a great tool.
Let's take an NPC AI... You can have a hundreds of characters, each with tons of lines of text, tons of behaviors and characteristics. Now:
Make a spelling mistake in quest - recompile the code
Make an error in player attributes - recompile the code
Make a mistake in filename - recompile the code
Add a new character - recompile the code
etc...

The same applies to level triggers, item actions and a lot of things...

In case you have these things in scripts, you don't even need the IDE.
I'm a programmer and my part is a code. I've got one person for graphics and a game designer, who is responsible for such things, as stated above - he doesn't care about the code, he doesn't waste time for hours of compilation... He just corrects the script and tests, sometimes there's even no need to restart the game. It boosts the project dramatically.

Personally I work as an A.I. programmer and I'm writing from my own experience - there's a lot of things that can be done with scripting. It saves our time (and therefore - money), makes coding easier and helps to control the code in a long term. Hardcoding is NEVER a good option, especially, when you have to set rules for entire game world.

And it doesn't matter, if you are a single indie or 50 people team.
(This post was last modified: 10-27-2011 05:00 PM by kulesz.)
10-27-2011 04:56 PM
Find all posts by this user Quote this message in a reply
dylantan Offline
Member

Post: #11
RE: Lua integration
@ kulesz

Yes I absolutely agreed with you. This is also the reason why we opted to use LUA for our AI Scripting instead of everything done in C++. Its the flexibility to modify the scripts without needing to touch and recompile the core program every time we do some changes on the AI. And we have a very tiny team and using this method (as you mentioned above) gave us the flexibility that we needed.
10-28-2011 08:03 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Sadahar Offline
Member

Post: #12
RE: Lua integration
AI server side FTW grin (C#)

Btw, compiling a single cpp (the new AI change) in my enviroment takes about.. 2 seconds?
Recompiling whole project less than 30 seconds.
Use optimizations and precompiled headers... learn about compiling options.. it will boost your project as you said grin

Also lua is pretty slow, maybe just too slow if the AI's load is too heavy.. you wont have such problem with C++, also consumes more memory.

Maybe a better solution is to keep AI in a separated DLL? I (personally) dont like Lua grin
(This post was last modified: 10-28-2011 12:41 PM by Sadahar.)
10-28-2011 12:40 PM
Find all posts by this user Quote this message in a reply
kulesz Offline
Member

Post: #13
RE: Lua integration
But you can have the bottle-necks of AI system written as functions in code.
For example you don't need to scan environment for nearby enemies. You can write a function in game and make it visible to the LUA code, so it won't need to make these operation itself.
10-28-2011 01:54 PM
Find all posts by this user Quote this message in a reply
aceio76 Offline
Silver Supporter

Post: #14
RE: Lua integration
There are definitely two schools of thought. I came from using a platform that use python for scripting what I call the "quick hit" code, and I tell you, over time, I found most of the scripts (not settings such as "idletime=xx", "behaviorpriority=attackfirst", "race0=Sirens", "defaultracestrength=10000000") should be part of the compiled code. Again, there is value in a 3rd party scripting language, but full-on ai or behavior coding should be part of the compiled code, imo.

Here is an example of what I think how to utilize a 3rd party script at most:
Code:
quest=new Quest("Flush the toilet')
quest.NPC=...
quest.Reward=...
quest.Behavior=...
quest.Waypoints=...
QuestSystem.add(quest)
...
QuestSystem.generalRefresh=12 //in hours
...
behav=new Behavior("Lunatic Madness Looney Tunes")
behav.greeting=...
behav.idleaction=...
behav.fightchance=...
behav.callforhelpchance=...
...
BehaviorSystem.add(behav)
...
mob=new Mob("HairRaiser")
mob.faction=...
mob.behav=...
...

I'm not 100% opposed to having some logic test in the script, but with my example above, the script is utilized just to provide parameters to the compiled code. Any designer can handle providing parameters, and they don't need an inkling of coding experience for it as long as they have examples to follow.

Just so you know, that's how I utilized the 3rd party script with the previous engine, although I can write full-on code through it. The 3rd party script is really there if there are part of the compiled code you cannot recompile. Recompiling takes seconds.

*BUT* if the 3rd party scripting is utilized just like above, we can do that NOW with parameter files in EE (that's what I'm doing now).

www.thinkplaystudios.com
(This post was last modified: 10-28-2011 06:35 PM by aceio76.)
10-28-2011 06:28 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Demostenes2 Offline
Member

Post: #15
RE: Lua integration
(10-26-2011 10:56 AM)Esenthel Wrote:  I'll more likely develop my own scripting than integrate lua

Why? Integraration de-facto industry standard would be timesaver, because nobody have to learn any proprietal language.

Anyway I support any scipting language, it makes developement much faster and far less demanding on resources. Scripting can by done by almost anybody, C developement not.
(This post was last modified: 11-28-2011 11:48 PM by Demostenes2.)
11-28-2011 11:47 PM
Find all posts by this user Quote this message in a reply
Post Reply