Jump to content
Josh

Procedural Script API

Recommended Posts

I noticed during the switch from procedural to OOP in the Blitz community (Blitz3D to BlitzMax), a large number of users were unable to grasp the idea of functions tied to objects. I am considering making the script API procedural in Leadwerks 5:

OOP:

local box = CreateBox()
local material = LoadMaterial("Materials/brick.mat")
box:SetMaterial(material)
box:SetPosition(1,5,3)
box:SetRotation(0,90,0)
box:Move(0,0,1)

Procedural:

local box = CreateBox()
local material = LoadMaterial("Materials/brick.mat")
SetEntityMaterial(box,material)
SetEntityPosition(box,1,5,3)
SetEntityRotation(box,0,90,0)
MoveEntity(box,0,0,1)

This is just an idea. I don't know if I will do this. What are your thoughts?

  • Confused 1

Share this post


Link to post

I'm personally not a fan but I guess it comes down to if you think you are losing sales or that is stopping people from making games with LE or you can get to market faster with that style.

  • Like 1

Share this post


Link to post

I would prefer the OOP-way since you can easily get information about what can and what cannot be made with an object... This especially applies to auto-completion, like intelli-sense. It is far more convenient to only see the functions that apply to the given object. But why don't you do both? You can also create the procedural functions as wrapper-functions that merely call the OOP-functions or vice versa.

  • Like 3
  • Sad 1

Share this post


Link to post

OOP, please. Mostly for the selfish reason that it allows me for the most part to use old code without having to completely rewrite it and procedural will pretty much guarantee that majority of your current users will be frustratingly be typing in the wrong code because they keep forgetting that you just decided to randomly change your API syntax.

  • Like 3

Share this post


Link to post

Gross, please don't go procedural. I would use plain C 100 pct of the time rather than C++ if I didn't want OOP.... If a user has problems grasping the concept of OOP they should spend some time learning the tools that each programming language provides before moving onto game development.... If you can't grasp the concept of OOP, you will never be able to make a game.. Simple as that.

The concept of polymorphism is fairly simple, it is taught to first year computing students @ any university in North America and these classes are absolute jokes most students take to avoid having to take calculus. It would be a shame to see LE move away from object oriented programming.

Not to mention Blitz isn't a great example to follow, considering it is not a very popular programming language to start with. It certainly isn't known for it's "smart" design choices.

  • Like 1

Share this post


Link to post

You dont really need advanced OOP to use Leadwerks and can simply do a game procedural style is suported by c++ also.

Unless new api is more simple to use for users i would go for oop.

 

For example i really like this api change because it simplify things:

local model = Model:Box()
local box = CreateBox()

 

Share this post


Link to post
17 hours ago, Ma-Shell said:

I would prefer the OOP-way since you can easily get information about what can and what cannot be made with an object... This especially applies to auto-completion, like intelli-sense. It is far more convenient to only see the functions that apply to the given object.

Best reasoning here.

However, the author completion we have now is limited. The dynamic nature of Lua makes this difficult because a variable’s type is not explicit. So developing a parser will be necessary.

Share this post


Link to post

I agree with the auto-completion/intelli-sense reasoning too.  Especially when something is not documented and/or unofficial, it's nice to see something suggested you didn't think of.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...