# Expression Stacker - A kind of 'click' expression

Chat about anything not covered in these forums, but keep it civil!

### » Tue Dec 22, 2009 8:58 am

Hey guys, I've been pondering over a kind of expression stacker, which might make doing maths a bit easier. I was pondering over the idea in this thread:

viewtopic.php?f=2&t=5296&start=20#p42206

So anyway, basically the idea I was was that you had 'blocks' that could snap to other blocks and be dragged around. You could easily insert blocks between blocks and generally it should be pretty easy.

So you could type

distance

Then drag 'distance onto the screen

Then type xy

Drag xy in one of the parameters of distance

Then mouse

Drag mouse into the other parameter

Then type

3 *

And get a block that has a multiply with one parameter '3' already filled in...then drag the 'distance' into the other parameter...

Then type clamp(,0,100) and it would leave the first parameter blank...

Simially you could just type the entire expression, or just type 'clamp', or select 'clamp' from a list....

Anyways, these are some designs I came up with :

And heres just one section by itself with nothing connected to it

I might not even end up programming anything like this, its just a fun idea for a project, and maybe it could be implimented for Construct 1+ or Construct 2, who knows...

So, design wise, what do you think?

Also...by just looking at the picture, do you think it would read logically as:

clamp( 3 * distance( mousexy, xy), 0, 100)

Or does it just look like a big confusing pile of blocks?
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

### » Tue Dec 22, 2009 9:11 am

dX=mousex-x
dy=mousey-y
distance=sqrt(dx^2+dy^2)
number = 3*distance
min=0
max=100
clamp(number,min,max)

Basically what you do is condense each operation into one variable and operate on the variables instead. It is much easier to work with units (variables) than whole expressions.

I suppose that these blocks would be named; when clicked, they would expand, showing the details. Click onto each of blocks to expand the whole expression or to collapse them into the simplest form:

clamp(number,min,max)

click on number and it expands that block
clamp(3*distance,min,max)

Etc.

Abstraction, woo.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

### » Tue Dec 22, 2009 9:22 am

I like this concept. I use a lot of these expressions and I think this is a good way to simplify and organize them.
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

### » Tue Dec 22, 2009 10:09 am

It's an interesting idea for sure, but (ya know I love ya David, no offense ) in all honesty there's not much difference in reading that than there is in reading

clamp(3 * distance(coordinates, coordinates), 0, 100)

It's just that the components are raised up in their own sections instead of being in between parenthesis. If you were to squash it down flat it would read pretty much the same. Moving the components around is also an interesting idea, but practically speaking is that really any easier than highlighting the part you want to change and typing something else?

I know you were looking for a more visual representation of the structure of a math function, but from the point of view of someone who doesn't understand math, I think it's still going to look pretty much like math. The problem of learning and understanding the math concept behind it is still there.

I'm sorry, I hate to be a naysayer. Perhaps I'm just misunderstanding the point?
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

### » Tue Dec 22, 2009 10:22 am

I'm kinda trying to find something in the middle of those weird visual language diagrams and traditional maths so people dont suddenly get locked into learning one style...but yeah I guess it is just like having one equation where brackets are raised.... meh
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

### » Tue Dec 22, 2009 10:40 am

It looks more complicated than events / scripting to me. Course that could be entirely different -in practice- cause even node/flowchart setups are complicated if you've never seen or used one before.

How about.. wizards, you know, those things that hold your hand every step. Wouldn't that work as a middle ground and keep everyone happy? It would also mean not changing much at all, so those wanting to learn events or scripting can continue to, but with the added help of more informative steps to help them, cause any language is easy to learn if you've got the proper documentation and help at hand. While others who already know and understand it, can switch the wizard off.

Basically, exactly the same way it is now, but with more information on what that particular step does. So not really a wizard either, just more info given.

--

Or failing that, go with the node based setup after all, but do it backwards like Lightwave's textures and XSI's render tree. Where you've got your base node (in constructs case, this would be things like 'Always' and 'Start of Layout' and anything that begins an event, collisions etc.) then adding other nodes to them as normal.

Now at the same time as that, you've got two columns, practically like you have now, and just move events up and down in the order, add sub events (which I admit could be more clear) and so on. Each node can have a help text attached, or linked to specific wiki pages. (Because clear documentation is the key really).

Each possible event could be represented as a node. So visually it would be much clearer if a node required more than one input to work.

As for keeping it clean, just have a + and - icon for expanding each event. So everything could be put away and kept nice and tidy. And also allow the option of displaying it in the current event method (since the above wouldn't be that different on the inside).

I know, I know. I posted a pic the other week complaining about these node things being a headache when they get complicated, but I admit in hindsight I was being unfair and did use Massive (which will always look complicated lol), but Lightwave or XSI do have much nicer node layouts.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

### » Tue Dec 22, 2009 10:54 am

[quote="David":2uzezisx]meh[/quote:2uzezisx]

I'm sorry, now I feel like a jerk

I do think the search for a more visual method of displaying math functions is an interesting idea though. I just can't think of anything that doesn't involve a picture of five apples over a picture of three apples and a cartoon worm wearing glasses asking how many apples there are all together.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

### » Tue Dec 22, 2009 1:48 pm

Thing is its already freakishly simple. When you come to a input section all you have to do is click on the system icon, and that brings up all the system expressions. Heck you guys made picking expressions easy. Instead of just saying lerp(), or distance(), it says linear interpolation, and distance between two points.
B
160
S
48
G
80
Posts: 7,234
Reputation: 61,496

### » Tue Dec 22, 2009 1:51 pm

But wait! What if you used that stacker for EVENTS rather than expressions?
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

### » Tue Dec 22, 2009 2:36 pm

I agree with Deadeye, Its practically the same thing. I think it may even end up destroying readability for those really long expressions; you'd have a pyramid sky high.

[quote="deadeye":1ywec0yf] I just can't think of anything that doesn't involve a picture of five apples over a picture of three apples and a cartoon worm wearing glasses asking how many apples there are all together.[/quote:1ywec0yf]

this pretty much sums it up. And I assume you meant 5 apples and a worm.... or else i'm confused.

[quote="Lost my Keys":1ywec0yf]Basically, exactly the same way it is now, but with more information on what that particular step does.[/quote:1ywec0yf]

I think that's what the wiki is for though, all the expressions are explained clearly. It could use some expansion however.

It would be great to find a middle ground like Davo said; between text and graphics. I just don't see how multiplying by 3 with (*3) in text is any more complicated or unreadable than a square or node which says multiply::::__3___::::: __number__:::::.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Next