Jump to content

Lua and LE


Sooshi
 Share

Recommended Posts

No this is the way I am going to do it, im not using the editor for now...

 

 

 

So this was the sort of documentation you were after :D

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

well lol i was after documentation simliar to the c++ tutorials for doing things in the editor. But the editor and its class entity scripts arent explained in detail simliar to the video tutorials. So what I am doing is watching the c++ tutorials and transfering that knowledge into Lua code. :D

 

Thanks btw Josh...

Working on a major RPG project.......will showcase soon.

 

www.kevintillman1.wix.com/tillmansart

Link to comment
Share on other sites

ah .. thought there was a time issue somewhere? :D

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

there is, that issue is that there is no in depth docs on the class entity scripts, so I would rather not waste time trying to "figure stuff out", that is going to take lightyears without some official tutorials explaining that stuff...

Working on a major RPG project.......will showcase soon.

 

www.kevintillman1.wix.com/tillmansart

Link to comment
Share on other sites

Its not as bad as it seems.. I didn't know a thing about Lua, other than it was a great scripting language before Josh implemented it..

 

Take it one model or class at a time. you'll get it

 

thanks for the encouraging words bro, I just like the idea of a workflow tutorial laid out for me, simliar to the c++ tutorials and the panda 3d examples, those are perfect. I know a great deal of Lua aside from metatables and metamethods. But that being said, I come from a background of learning by starting off very simple with a workflow and working my way up step by step, there isnt anything like that for the LE to guide me, so I dont see myself staring at code that I have no idea of whats going on and trying over and over to get the answers when all that needs to be done is document the knowledge behind it, I would just rather wait and study other areas of leadwerks. Because im still new to this engine anyway..

Working on a major RPG project.......will showcase soon.

 

www.kevintillman1.wix.com/tillmansart

Link to comment
Share on other sites

thanks for the encouraging words bro, I just like the idea of a workflow tutorial laid out for me, simliar to the c++ tutorials and the panda 3d examples, those are perfect. I know a great deal of Lua aside from metatables and metamethods. But that being said, I come from a background of learning by starting off very simple with a workflow and working my way up step by step, there isnt anything like that for the LE to guide me, so I dont see myself staring at code that I have no idea of whats going on and trying over and over to get the answers when all that needs to be done is document the knowledge behind it, I would just rather wait and study other areas of leadwerks. Because im still new to this engine anyway..

 

What your asking for needs to be better defined. The 'Getting started' document helps understand some of the basics functions that are part of the entity scripts. The existing scripts are examples of how to use those functions. You can make the script do whatever you want. There's no way anyone can make it so you just have all the possible scenarios that you could possibly make with the entity scripts. If you at least try and then have a problem, people here are more than happy to help explain how to do something. You stated that you have been using lua for a year. I have been using it for exactly a month and a half. I learned and am still learning lua by at least trying.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Well the code underlying the basic template code probably isn't going to be documented. It's all setup code that most people will never need to edit. You basically just add stuff to the object:Update() function and possibly one of the other functions listed in the Getting Started document. If you want to start simple, this is as simple as it gets:

 

require("scripts/class")

local class=CreateClass(...)

 

Just put those two lines in the objects .lua file and you get the basic properties dialog so you can modify settings.

 

Then for the next step, here's how you would do some stuff when the model is first created:

 

function class:CreateObject(model)
local object=self.super:CreateObject(model)
object.mysupervariable = 5
end

 

The thing to note here is object is one level above the model. The model is what the normal LE API functions work off of, a TModel basically. The object is what you'd usually manipulate in your own Lua code. So you wouldn't want to do object.model.mysupervariable = 5 because model is an LE TModel. object on the other hand is your Lua "class" that you can do whatever you want with.

 

Ok, so the next step is to do something every frame.

 

function object:Update()
self.model:Animate(AppTime()/40, 1, 0, 1)
end

 

The Lua syntax to Animate is in the Wiki. So the full code would be:

 

local class=CreateClass(...)

function class:CreateObject(model)
local object=self.super:CreateObject(model)
function object:Update()
	self.model:Animate(AppTime()/40, 1, 0, 1)
	self.mysupervariable = self.mysupervariable+1
end
end

 

object:Update() will be called every frame by LE, so anything you want to do every frame should be put in there. I added the incrementing mysupervariable so you could see how variables assigned to the object can be referenced. When you're inside any object:<somefunction> like object:Update, then self will be the same as object.

 

Anyways, I've gone over this before with you, and people above has posted about it, but this might be a little clearer to you. It doesn't get any simpler than this really. Don't worry about what

 

local class=CreateClass(...)

function class:CreateObject(model)
local object=self.super:CreateObject(model)
end

 

means or does. It's just initialization code that sets up the object to be a Leadwerks lua object and you won't want to mess with it unless you're doing some pretty advanced stuff that you're clearly shouldn't be doing at this point.

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

Link to comment
Share on other sites

Oh ok that makes more sense, I have never done any coding where I didnt have to create a single line from scratch. Thats what has concerned me the most this whole time.. I have never just copied and pasted code and not concern myself with what it does....

 

But if you guys say I shouldnt worry about this code, then I guess I shouldnt, thanks for trying to help me out this whole time Niosop and macklebee, you guys have been very helpful and patient with my concerns. A much appreciated quality in this community.

Working on a major RPG project.......will showcase soon.

 

www.kevintillman1.wix.com/tillmansart

Link to comment
Share on other sites

I think you will find the knowledge you gain in the C++ videos will transfer almost 100% to Lua, since the commands are the same.

 

Yes and I actually prefer doing things this way. I have been studying the c++ tutorials while coding in Lua and its a breeze. All I have to do is memorize the functions and parameters and I can do the rest for setting up my logic. Everyone has their way of doing things I guess....

Working on a major RPG project.......will showcase soon.

 

www.kevintillman1.wix.com/tillmansart

Link to comment
Share on other sites

I think learning with the C++ tutorials is the best way to start. Really the lua objects in the editor are almost setup so that programmers can create objects for others to just drop and drag and use without knowing how to code. As you work with it more though you can see that it's almost like object oriented programming because you can build some cool logic objects that can be pretty reusable and generic enough that you can almost create a visual programming language with it.

Link to comment
Share on other sites

I think it's a cop-out to expect new 2.3 users to learn how to code the Leadwerks Engine in Lua by looking at old C++ Tutorials. What's needed are working examples in Lua. The 'Getting started with Lua Script' Tutorial is a good example of how they need to be although even that digresses into C++ at the end. Have a look at the number of posts on the Lua Forum compared to the C++ forum.. People are desperately trying to understand just the basics of the LE script only to find there is almost no documentation, only helpful Lua coders. Once again, we have the 'one man band' syndrome where promised Tutorials just aren't appearing because the one man is looking in other areas.

AMD Athlon x2 7750 2.7ghz, 6gb ddr2 ram, Galaxy9800GT 1gig ddr2 video card, Windows 7,64.

Link to comment
Share on other sites

I think it's a cop-out to expect new 2.3 users to learn how to code the Leadwerks Engine in Lua by looking at old C++ Tutorials. What's needed are working examples in Lua. The 'Getting started with Lua Script' Tutorial is a good example of how they need to be although even that digresses into C++ at the end.

 

I guess I don't understand how people don't consider the standard models/entities that have lua scripts as working examples? After using the 'Getting Started...' tut and actually trying the examples within, I looked at the existing models/entities scripts as examples of how to implement.

 

The only difference I see here that is making people complain is because there is no video? :);)

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

I guess I don't understand how people don't consider the standard models/entities that have lua scripts as working examples? After using the 'Getting Started...' tut and actually trying the examples within, I looked at the existing models/entities scripts as examples of how to implement.

 

The only difference I see here that is making people complain is because there is no video? :blink::lol:

 

It all depends on who you are, If doing things this way isnt a waste of time in your eyes, then thats all on you.

Everyone has to follow their own path. I took out 3 years to study Art and animation. But some people would think thats a waste of time in itself. And some people who just want art jobs or programming jobs at a studio would think that I am wasting MY time because I am trying to become good at programming, art AND animation. You just have to do you. I dont like whats going on with the documentation for the LE as of now. So im not going to utilize my time to mess with it right now.

 

And as for video tutorials, the panda 3d tutorials arent videos. Its not about rather its a video or not. Its about providing a workflow with examples to build a foundation off of.

Working on a major RPG project.......will showcase soon.

 

www.kevintillman1.wix.com/tillmansart

Link to comment
Share on other sites

:blink:

AMD Bulldozer FX-4 Quad Core 4100 Black Edition

2 x 4GB DDR3 1333Mhz Memory

Gigabyte GeForce GTX 550 Ti OC 1024MB GDDR5

Windows 7 Home 64 bit

 

BlitzMax 1.50 • Lua 5.1 MaxGUI 1.41 • UU3D Pro • MessiahStudio Pro • Silo Pro

3D Coat • ShaderMap Pro • Hexagon 2 • Photoshop, Gimp & Paint.NET

 

LE 2.5/3.4 • Skyline UE4 • CE3 SDK • Unity 5 • Esenthel Engine 2.0

 

Marleys Ghost's YouTube Channel Marleys Ghost's Blog

 

"I used to be alive like you .... then I took an arrow to the head"

Link to comment
Share on other sites

To be honest I think it is much easier getting started with GameLib, than going through all the tutes and trying to build something from scratch. Once you get a world loaded and you can run around in it, it will do wonders for your confidence. Perhaps we need a GameLib LUA version? Or perhaps one already exists?

Win 7 Pro 64 bit

AMD Phenom II X3 720 2.8GHz

GeForce 9800 GTX/9800 GTX+

4 GB RAM

Link to comment
Share on other sites

The C++ tutorials cover the basics of different aspects of the engine. C++ was chosen because it is a standard everyone should be able to follow along with.

 

There isn't much different between this:

 

TModel model = LoadModel("thing.gmf");

 

And this:

 

model = LoadModel("thing.gmf")

 

What's needed are working examples in Lua.

There are two working examples in Lua, located in the "Script/Games" folder.

 

I am not clear on what you are asking for. It seems you want a tutorial that goes through and makes a simple game in Lua piece by piece.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Perhaps we need a GameLib LUA version? Or perhaps one already exists?
Yes, GameLib Lua will come also, and it seems Rick has done the most part of it already. It will be based on thingoids and model scripts. So you could just use what Rick (and others) have done, before the folklore collector comes and makes it a published package (like what happens with all human languages also, townpeople people invent them, then someone collects them together and makes them available for all in a standardized, unified fashion). That's how GameLib C++ was also made. Although Rick's scripts are branded as Pi, so I must ask him if Pi can used by GameLib (plus other non-Pi scripts of course).

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I am not clear on what you are asking for. It seems you want a tutorial that goes through and makes a simple game in Lua piece by piece.

 

Which I would be happy to provide....for a fee.

Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX

ZBrush - Blender

Link to comment
Share on other sites

what they are asking is for you to make every possible thing they could ever want in a game as an example so they can just cut and paste... basically make the LE version of FPSCreator. This way they don't have to learn anything about programming at all and they have a playable game which they can put their name on. And could you have that done by this weekend? :P:P

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

what they are asking is for you to make every possible thing they could ever want in a game as an example so they can just cut and paste... basically make the LE version of FPSCreator. This way they don't have to learn anything about programming at all and they have a playable game which they can put their name on. And could you have that done by this weekend? :P:lol:

 

lol, yea and then once I accomplish this, I am going to get someone to create a workflow for me to do my art assets, character rigging, concept art and my animation for me step by step. Because I dont know how to work hard towards accomplishing anything for myself. :lol:

 

keep fiddling around with the code, you will get a game published one day :lol:

Working on a major RPG project.......will showcase soon.

 

www.kevintillman1.wix.com/tillmansart

Link to comment
Share on other sites

lol, yea and then once I accomplish this, I am going to get someone to create my art assets and do my animation for me step by step. :lol: Beaause I dont know how to work hard towards accomplishing anything for myself. :lol:

 

Dont get upset because I am stating what it appears that you want... Several people in this post have tried to help you and have asked you repeatedly to define what you are asking help with on how to create a lua scripted entity. From what you have posted, you continue to say that you're not going to even try until you get some magical tut that explains how to do everything you could want to do in lua & LE. If thats the wrong impression, then sorry but that's what it appears that you are asking. Just try to follow the tut, look at the examples, look at what has been shown in this post, and post what exactly you are having difficulties with getting to work. There are a lot of people here that are more than willing to help in any way they can. :lol:

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

Dont get upset because I am stating what it appears that you want... Several people in this post have tried to help you and have asked you repeatedly to define what you are asking help with on how to create a lua scripted entity. From what you have posted, you continue to say that you're not going to even try until you get some magical tut that explains how to do everything you could want to do in lua & LE. If thats the wrong impression, then sorry but that's what it appears that you are asking. Just try to follow the tut, look at the examples, look at what has been shown in this post, and post what exactly you are having difficulties with getting to work. There are a lot of people here that are more than willing to help in any way they can. :lol:

 

Lol by saying the term "magic", I am assuming you mean I feel things should be handed to me. Well let me tell you something, people pay the price for knowledge that has already been acquired. Thats why they go to college buddy. If every teenager in high school thought the way I did, it would be a dream come true. Because instead of teachers getting upset at kids these days for free education that they dont take advantage of,(instead they skip class and smoke pot and worse drop out)it would make all the difference. And that statement you made about FPS creator, your just one guy lol. There are tons of people out there on tons of indie game engine forums who would tell you anyday of the week that proper documentation is KEY!

Im not saying create me a game, are the examples on the Panda link a way for anyone to say oh, let me copy and paste!? No, its an EXAMPLE, a WORKFLOW lol...

 

And let me give u a scenerio, lets say I currently know where one of my friends are located. And you try to guess, it takes u forever and a day, you waste hours guessing. All I had to do was tell you the answer, and if I would have just told you where he is located from the begining, you would have saved hours of your time that you have wasted from trial and error. Trial and Error is left for people who want to perfect a craft. Ill say it again, trial and error is left for people who want to "perfect a craft"

 

There is a thin line between hard and easy my friend. They are both illusionary words. Because either you know something or you dont. And there are only two ways you can figure something out, through trial and error or through a source. A source is where the knowledge is CONTAINED. I am just using basic common sense to decide the route I should take with this whole thing. And besides, I can come back and learn the entity scripts when the proper documents ARRIVE. And believe me they will arive, because you know why? Because after all the trial and error being put into obtaining the knowledge from people like you, It will finally be understood to where it can be explained in dept for everyone to understand. In the meantime, I will be learning other things bro...

 

 

Like 95% of people on ALL endie game engine forums never see the realese of a finished published game, im making the decisions that I feel I should make in order to map out the best possible route for me.

 

If I was so in a rush to get a game made by the weekend, I wouldnt have taken out years to study art so I can have my game look good next to the competition. I had my goal set in mind years ago, im just at the final stages, and thats choosing a good game engine with great documentation.

 

My goal is to achieve my lifelong dream to make a game, not to become a master of art, not to become a master at programming. But to make a game and express my ideas on what makes a cool game and get it published for everyone to experiance my ideas.

Working on a major RPG project.......will showcase soon.

 

www.kevintillman1.wix.com/tillmansart

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