A library for functions would be great

Post » Fri Feb 24, 2017 6:11 pm

It would be great, if there was a library for functions,

where all functions can be saved seperately and one can include & call them simply by dragging&dropping them to any Project.
B
9
S
3
G
4
Posts: 58
Reputation: 2,799

Post » Fri Feb 24, 2017 6:33 pm

I think that might lead to the overuse of functions, but that type of modularisation is planned for C3.
Image ImageImage
B
171
S
50
G
179
Posts: 8,394
Reputation: 113,482

Post » Fri Feb 24, 2017 6:42 pm

One can use a knife to cut bread or to kill somebody - in the right hands it will be an asset, while the wrong Hands have enough opportunities to go wrong even without a knife.
B
9
S
3
G
4
Posts: 58
Reputation: 2,799

Post » Fri Feb 24, 2017 11:53 pm

Cant we already include another event sheet and call functions from it?
The event sheets are not seen as a resource type that can be easily transferred between projects unfortunately - because of their dependency on the objects in the scene. You can't refer to objects via a variable - that makes it harder to make reusable event sheets.

That stuff is available in godot and game maker btw- it's much easier to do it there. Of course, you gotta learn other engines and some scripting then. Most game engines allow you to have classes that extend other classes and scripts that can call functions from other scripts. You can reuse functions by passing the game objects they are affecting as parameters- and even easily expose them to the editor - where the designer selects what game object is to be affected by the reusable function without typing a single line of code.
B
40
S
15
G
4
Posts: 426
Reputation: 5,848

Post » Sat Feb 25, 2017 12:14 am

Well the problem with functions is that they aren't very linear, the return event can be anywhere. To continue the simile, it's like a blade, and a handle that are separate.
If you wanted to "sharpen" the blade you might have to go digging for it, and includes might actually complicate things.
They might work great, or terrible depending on how well they are planned.
Image ImageImage
B
171
S
50
G
179
Posts: 8,394
Reputation: 113,482

Post » Sat Feb 25, 2017 12:56 am

@newt is right - you have to carefully design your reusable logic and one glove doesnt fit all. If you want more flexibility, learn programming. Construct's event sheet is awesome, but it does have limitations compared to what you can do compared to godot for example.

The more flexibility you have - the more complexity and learning curve

The linearity in functions is not a problem at all - once it completes execution of whats inside the function, the process should continue from after the line where the function was called. Unless inside the function you haven't rerouted the execution to some other specific part of the game loop - which would defeat the purpose of the function - to be reusable.

My suggestion is to plan it out on paper first- say to yourself exactly how you want to structure it.
I personally try to make things modular, but have fallen in the trap of tangling myself in a mess in the past
B
40
S
15
G
4
Posts: 426
Reputation: 5,848


Return to General Discussion

Who is online

Users browsing this forum: NetOne, tunepunk and 2 guests