[Behavior] Rubber Band

Post your work in progress addons and get feedback

Post » Sat Jan 24, 2015 9:44 am

Very cool update, linking to several objects is just great - see plenty of usage scenarios there. May be a little bit until I get to try it in a real gameplay scenario, but will surely comment then.

Thanks again for a great plugin!
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sat Jan 24, 2015 3:53 pm

It may be a good thing if there is still some time left. :)
I still want to flesh it out a little more. Add actions to change the band length at runtime, collision detection, etc...
B
9
S
2
G
2
Posts: 15
Reputation: 886

Post » Mon Jan 26, 2015 9:05 pm

Would also be great if we could have the linked sprites rotate in correspondence to gravity :-)
B
59
S
21
G
14
Posts: 779
Reputation: 13,927

Post » Mon Jan 26, 2015 10:45 pm

Beware, long story.

I tried combining my movement with the build-in physics behavior. Because, you know, would be nice if I wouldn't have to do my own gravity (although 'Physics' doesn't have a config value for the gravitation, like I do), friction and elasticity and stuff, if I can just use whats already there.

That didn't go too well.
Basically my object just gets stuck. (Which feels somewhat familiar. Either Physics just refuses to move if it detects a foreigner or it constantly resets speed or something. I've been there.)
So I took a peek at the code, and sure enough, it reads like one of my earlier drafts.
"Remember position and compare."
"If external movement is detected, measure and set own speed to the one observed."
and
"Reset own speed once external source stops interfering."
Just without the nice combinability feature that I settled for lately.

So I put on my megalomania hat and thought, maybe if i rearrange things a bit, make'em work my way, I can make the physics Plugin compatible and cut the amount of work my behavior has to do.

So, I roll out my pattern of 'collaborative movement' and yay, it moves.
Only that it seems to be 'falling' towards 2 o'clock. Wait, what?
Is that a bug? Did I confuse x and y by accident? But then where does that angle come from?
...
angle...
I rotate the object and yupp, sure enough, it 'falls' straight up in the sky. hrmpf.
Its not a bug - its a feature. :idea: The gravity is local to the object.
Maybe i should not have ticked the 'Prevent rotation' config, so it could rotate to find 6 o'clock and fall down.
But no - it just starts rotating, which makes it fly circles around its anchor. hrrg.

Looking closer at the Physics I notice, -- 1 -- you can configure gravity via an action. It is labled 'Set world gravity'. (On a gravity local to an object? what might that do?)
And -- 2-- that it can do something called 'joints'. It accepts options that read a lot like mine. This thing can probably obsolete my behavior. :shock:
Why did nobody tell me? :cry:
However, within 5 minutes of trying I could not make it do what my behavior does. I could have just googled for the docu or a tutorial at this point, but instead decided to blow off some steam in a wall of text. :ugeek:

Now, I'm kind of at a loss here. What should I do? Abandon my behavior? Or finish it anyway, just in spite.
Well a few things are to be said here.
That Physics behavior is part of the C2 core. It has a far more complete set of features than I need atm. It is probably much more optimized than my humble pile of code. (It lies with a file bearing the awe-demanding, magic letters asm *subconscious quiver*.)
But! there are problems.
Actually the paragraph above is the problem. This behavior does too much. Its complex. (At least, I don't get how most things there work.) It does it all - maybe because that allows for better optimization? And it cannot be used only partially. It is a God-Behavior. That is not the thing I expect in a modular toolbox. At least not the first thing.

I have already been thinking about this with my behavior. At the time of this writing, it does 3 things. A rubber band. Gravity. Drag. These could also be 3 separate behaviors. If they could play nicely together.
So it comes down to the question how small, how specialized should modules be?

Thats actually a pretty old question, you may have heard it in the incarnation of 'many small specialized linux-tools vs. a Windows-Monolith kernel' or systemV vs. systemd or...

I think the pros and cons are pretty straight forward.
Many small, focused behaviors:
easier to explain & understand
can only use the ones really needed
more work to click together the desired behavior from its aspects (though this might be outweight by the more demanding work to understand the one-does-it-all behavior)
possibly a lot of overhead for duplicated internal state and calculations
-> Easier & low initial hurdle, suboptimal for professional, high performance or other advanced use cases.

Multi-functional complex optimized behaviors:
more difficult to understand / learn
may enable andvanced behaviors which require an in-depth connection between simple components
may not be flexible enough to be reduced to only the required functionality
less overhead from duplication
-> high effort to learn/master, interessting/required for advanced & cool projects.

Now from the perspective of the C2 project I can understand that we don't want to prevent the cool&advanced stuff to be possible.
But on the other hand the ease of use, especially for a non-programming audience is also a big part of the target group of C2. (Which, i may have to throw in here, it does a pretty good job at, at least from my POV, and atm i'm really excited by this. Awesome job guys. Really.)

So, ultimately, I think we need both.
Have a 'Simple Movements' section, containing tiny, stupid, specialized stuff like 'gravity', 'friction' and 'solid'.
And an 'Advanced Movements' section for the likes of 'Physics', maybe as 'Combined Physics'.

I, for my part, would like to see Physics additionally available in smaller aspects. Though I'm most likely not able to do it by my self. And some cross-cutting concernes like collision-detection might not work like this at all. I guess I would have to start with finishing this plugin. Seems like a legit first step.

I have to put a disclaimer here: I have not much of an idea, of what I am talking about. I never tuned a mobile app for acceptable performance, I don't know how precious the CPU cycles there really are and what are the tradeoffs to be made.
I also don't know what the dev's already tried, what failed and what didn't. Providing a working yet accessible set of compatible modules is a very non-trivial problem.

I guess, i just wanted to get that off my chest. For anyone, who made it this far -- I am sorry. Thank you for your time and maybe your sympathy. Thanks for reading.

And in case this post is beating an already dead horse/debate, maybe someone could link the earlier iterations for me to find. :oops:
B
9
S
2
G
2
Posts: 15
Reputation: 886

Post » Mon Jan 26, 2015 10:49 pm

@Savvy001 maybe the Physics behavior can already do that - i am not sure. (after today)
Could be worth a look, if you are serious and have the time.

(I'm sorry if this is not the answer you were hoping for.)
B
9
S
2
G
2
Posts: 15
Reputation: 886

Post » Mon Jan 26, 2015 11:40 pm

I already did, and it does work, but i'd rather dont use such a cpu consuming behavior when not needed.
B
59
S
21
G
14
Posts: 779
Reputation: 13,927

Post » Wed Jan 28, 2015 12:26 am

@Savvy001
Hmm. I don't know much about CPU intensity in each case.

Also I am not sure what kind of 'moving in correspondance to gravity' you mean.
I could think of a -- maybe a little complicated -- way to orient a sprite downwards using a dedicated weight. (again - i have no intuition of how wasteful that might be in terms of CPU/GPU)

So ... did you mean something like this?
You do not have the required permissions to view the files attached to this post.
B
9
S
2
G
2
Posts: 15
Reputation: 886

Post » Wed Jan 28, 2015 11:53 am

Thats exactly it!
Both are nice.
The angel one is perfect.
Thank u very much for this update!
B
59
S
21
G
14
Posts: 779
Reputation: 13,927

Post » Sun Feb 08, 2015 6:14 pm

Okay, after playing around with collisions for a week or two I think I'm going to let that feature go for the time beeing.
That one demands more time and dedication and definitely does not belong into this behavior.

Soo, I think I'm going to wrap it up with this one.

Now i wonder what should the procedure be?
Should I post a new entry to the 'Finished Plugin' subforum or is one friendly mod simply going to migrate this thread?

@Kyatric
B
9
S
2
G
2
Posts: 15
Reputation: 886

Post » Tue Feb 17, 2015 3:26 pm

Thanks for sharing!
B
156
S
27
G
17
Posts: 910
Reputation: 32,553

Previous

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 0 guests