Jump to content

What Are Your Thoughts On Developing A Game Entirely In Lua


Guest Red Ocktober
 Share

Recommended Posts

Guest Red Ocktober

with the current release in mind, and also in anticipation of the upcoming version release, i'd just like to open up a discussion on how c++ and BlitzMax coders feel about writing an entire game in lua script...

 

personally, i've got no problem going back and forth between c++ and blitzmax, but i've always found lua to be a lil akward, hence my resistance to using it... but i'm of an open mind here, and would like to hear opinions from those who use lua extensively, and from those who do not... pros and cons...

 

thx

 

--Mike

Link to comment
Share on other sites

I don't have a thought, just a sound... *ugh*

 

It shouldn't matter, a game is a game and whatever works for you then go for it. You can script things in LUA in Unity easily enough but the whole system is built around plugging things together. In LE2 it was a sliding goal post which is still awkward to use (get an object reference wrong and the editor will EXCEPTION quit on you). It's hideous to work with for anything but simple things.

 

This will change in LE3 as you know already. We're promised single step debugging loveliness which is the bare minimum you'll need but don't have now.

 

As a language it's flexibility can't be beat. Loose type casting, everything as an object. I wouldn't use it for a full game unless it was a simple one. As you say, current implementation is awkward. But it has its uses.

 

I tend to use it for entity level effects and static animations. Not much more but it's pretty good for that.

6600 2.4G / GTX 460 280.26 / 4GB Windows 7

Author: GROME Terrain Modeling for Unity, UDK, Ogre3D from PackT

Tricubic Studios Ltd. ~ Combat Helo

Link to comment
Share on other sites

My experience from moving to Lua from C++ in LE:

 

1) Lua is more flexible in that I could freely pass and store functions all over the place without worrying about function signatures, which I found useful for "event" type driven stuff. You could also store different types in the same table which is both a blessing and a curse.

 

2) I feared making big changes to my Lua program because 1 typo and you could be hunting for hours/days given the current debugging situation in LE, which is not good.

 

3) Lua tables took some practice but once I got them figured out they were a joy to work with and you could get some pretty complex structures going.

 

4) Because simulating classes in Lua is sort of a hack to tables I generally just stuck with the procedural style of coding which I don't enjoy all that much. Coming from an OO language I often found myself missing working in that fashion.

 

I do find myself back in C++ atm however, mainly because I feel it's more structured and organized which I like.

 

From what I have seen, I think a game could easily be written all in Lua.

Link to comment
Share on other sites

Well i am not a developer only a scripting guy from my work experience and

i never feel confortable with C++ even if i tried sometimes to get in it, lua was new to me

but its simplicity once avoided the "notalking" errors, was pretty convenient for my (bloated) style of scripting

My UI is done, my core game too without a C++ line (except linked Dll from Rick to joystick)

saving and loading data is easy too, six months of coding in lua was very pleasant.

 

Not pretending it is well write or organize but functional and that is what i wanted.

Lua responded great to my desire and surprisingly fast enough to forget it was script only.

Concentrate now on modeling to populate what i call my game.

Just my thought, hope to see your Sub or your tank moving soon Mike

AMD Ryzen 5900HX - Nvidia RTX 3070 - 32 Go - 1To SSD - W11

Link to comment
Share on other sites

I haven't worked much with Lua but from what I've seen I'm not the biggest fan.

 

The code looks clunky and simple, I enjoy working in a strict environment with type declaration an OOP.

 

Lua works, it'd be great to get Leadwerks3D working with Monkey, code once and have your game in c++,c#, java, etc.

5c8e5100fc6df22c8938ce77ed686a42.png = OpenGL
Link to comment
Share on other sites

By the way, Unity does not use Lua...

 

I am used to working with no debuggers from past game design experiences so I am quite happy with the Lua debugger here. Sure, the EXCEPTION_ACCESS_VIOLATION errors in the editor is not great. but personally I think the editor should be just for making scenes. I have not had any real problems, computers are getting fast enough that Lua is good for %90 of everything needed for game programming. LE3 should have an even better Lua integration. In fact, the reason I came to Leadwerks was the Lua, if it did not have Lua I would have skipped past this engine.

 

Anyway guys, I would probably like to learn C++ at some point to handle the main game logic, but the way I like designing games is very modular...you load a scene and the objects in the scene handle most of the game logic. But yeah, I would like to be able to learn C++ because I can load lots of header files, however Lua is more then enough for %90 of what I do.

Windows 7 Professional 64 bit, 16 gigs ram, 3.30GHz Quad Core, GeForce GTX 460 one gig, Leadwerks 2.5, Blender 2.62, Photoshop CS3, UU3D

Link to comment
Share on other sites

I don't have a thought, just a sound... *ugh*

 

Lua is probably one of the most misunderstood languages in the public eye. Everyone forces OOP down it's throat all the while calling it a proceedural language. We have hacked up partial implementations of OOP paradigms in the language all over the place attempting to turn it into something it's not.

 

Lua is a wonderful language, but it is not a language with an OOP paradigm. Lua is a wonderful language and people call it a proceedural language largely out of ignorance (If it's not OOP, it MUST be proceedural!)

 

Lua is a wonderful language and it is a functional language. Let me say that again. Lua is a functional language. It is not a pure functional language seeing as it does in fact revolve around state and mustable data due to being designed as an embeddable language, but it is still very much a functional language.

 

A few common misconceptions:

  • Functions are NOT ojects. They are a fundamental datatype in most functional languages (Lua, Python, Lisp, Haskell, etc.)
  • Tables are not Dictionaries, Hashes, Tree's or lists. Tables are a data type who's functionality is designed to be altered via metaprogramming and in effect creating new data types. Embrace it!
  • Lua is not an OOP language. This doesn't mean you can't write an OOP model in the language. Did you know that the entire OOP paradigm was written in and for functional languages? It was originaly created in smalltalk. That said there is little resemblence to it's original intentions. One of the key original OOP concepts was a lack of global state for objects. Sadly this never carried over outside of the functional world and is part of the reason parallel programming is so difficult in the usual OOP languages.

 

Excuse the rant. This is just one of my pet peeves (of apparently many). It's rarely taught or even understood that there are more paradigms than OOP, proceedural or imperative programming. Functional programming is only one of a great many. When I was teaching I made sure my students knew they existed and at least at a basic level, understood the difference.

 

----

 

Now as to the original question...Yes, there's no reason you can't make an entire game via Lua, depending on the scope. LE2 has it's problems with Lua, as has already been pointed out by others in the thread and so I would not suggest it. But it can certainly be done.

There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?"

Let's make things happen.

Link to comment
Share on other sites

Guest Red Ocktober

thx for the replies guys...

 

@flex... LOL biggrin.png

I don't have a thought, just a sound... *ugh*

 

good one...

 

i found some good, thought provoking points raised... gained additional insight... and was thoroughly bewildered by some...

 

 

@Brent.. a question...

your response had me scratching my head... i don't understand how you can extrapolate out your reasoning to raise the functional programming paradigm to a level of comparison between procedural v. object oriented...

 

lua is purely procedural... just like c... both being extensible to include OOP capabilities... within either can be applied in a functional methodology (which is nothing more than applying a paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data)... at least that's what i think...

 

the people at lua dot org seem to think similarly... they say

Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics.

 

if you have time, i'd like to hear more on your view that lua is a functional language...

 

 

@ Diedir...

always a pleasure to hear from you... i think i still have your email addy... i'll send you a copy of the tank thingee for you to play around with... feedback welcome...

 

 

@ Benton...

By the way, Unity does not use Lua...

are you sure about that one... me thinks there has been a been an implementation of lua in Unity... the lua interpreter has been ported to C#, which Unity uses... but we're here at the Leadwerks shop, so we'll go no further with this...

 

@ Josh..

In Leadwerks Engine, probably no since there is no real debugger. In Leadwerks3D, yes.

yes... definitely makes lua a consideration...

 

 

thx again to all for their input...

 

--Mike

Link to comment
Share on other sites

Using Lua means I don't have a GUI I guess. But that's fine, I'm just using Debug text and pictures to get my point across. It's not going to be too much worse than Minecraft's default interface. Just don't look under the hood. It's a mess in there, how I'm doing things at least, but it runs fast.

Core I5 2.67 / 16GB RAM / GTX 670

Zbrush/ Blender / Photoshop CS6 / Renoise / Genetica / Leadwerks 3

Link to comment
Share on other sites

@Brent.. a question...

your response had me scratching my head... i don't understand how you can extrapolate out your reasoning to raise the functional programming paradigm to a level of comparison between procedural v. object oriented...

Keep in mind most if not all functional languages are procedural/imperative languages as well. Functional languages simply have a general feature set that other procedural languages simply do not have (C for example).

 

lua is purely procedural... just like c... both being extensible to include OOP capabilities... within either can be applied in a functional methodology (which is nothing more than applying a paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data)... at least that's what i think...

Not exactly. Keep in mind functional languages borrow heavily from lambda calculus. C for example lacks functions as a fundamental data type and doesn't support closures (which are fundamental to functional languages). Lua does support these things.

 

the people at lua dot org seem to think similarly

Keep in mind, as mentioned, Lua is a procedural language. It's also multi-paradigm. For example, you rarely see looping constructs in functional languages outside of recursion. However, lua still uses functional paradigms even when using some of these "foreign" looping constructs. For example one of the foreach loop variants iterates over a table, passing each element over to a user supplied closure. In most functional languages you'll see this functionality in the map/fold/reduce functions.

 

Lua is multi-paradigm, but it's functional roots are fairly dominant in it's entire feature set. From it's support of closures to it's Lisp like choice of a Table as it's primary data structure and the way things are designed to be used. It's very powerful, yet that power is rarely tapped as few people these days actually know how to use a functional language.

 

You can use Lisp or Scheme as if it were C but you'll quickly find that it becomes very cumbersome until you make that paradigm shift. If you really want to learn about functional programming, pick up a pure functional language like Haskell or maybe even Scheme.

  • Upvote 1

There are three types of people in this world. People who make things happen. People who watch things happen. People who ask, "What happened?"

Let's make things happen.

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