Jump to content

Procedural Script API


Josh
 Share

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

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

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
  • Upvote 3
Link to comment
Share on other sites

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

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

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
Link to comment
Share on other sites

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()

 

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

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.

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

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