What follows explains in detail the creation of my Gotcha! level.
If you haven't played it yet, you should, and you certainly should before reading on... otherwise it'll spoil the surpises!
Get it here http://goofans.com/download/level/gotcha
First a couple of basic building blocks...
Pretty much exclusively in the original levels, compositegeom objects were used to either
i) Produce more complicated movable shapes than just a circle or a rectangle.
(The lifting fingers in Genetic Sorting Machine, the Third Wheel in Third Wheel)
or
ii) To collect together a load of static items (walls, platforms etc) from all over a level, so they could all be tagged and moved together.
It's the third possibility that you can exploit when making traps, and I'm sure it'll have other uses as well.
A compositegeom object is built from a number of child rectangles and circles. Each one is positioned relative to the "center" of the compgeom object, so that when the main object moves or turns all the children move and turn in exactly the same way... as if they were a single solid object.
But... it doesn't mean that any / all of the children have to be close together or even touching. So, you can have multiple objects that move, turn, spin, act together (as if they were a single object).. but that aren't connected together by anything "solid".
This is a VERY useful "feature" of compgeom
When dealing with any non-static (moving/movable) object you need a hinge to fix it to "the world".. otherwise they just free-fall.
The hinge has an "anchor" position and an object it attaches to (the "body")
If you want something to spin about its center (like the Wobbly head in Chain) you position the circle, put the hinge at its center point.. and hey presto.
But there's nothing that means the anchor has to be in the center of the object, or even inside it, or anywhere near it!
Like compositegeom objects, the hinge and the body act as if they are firmly connected together, without having anything solid actually connecting them.
This is also VERY useful
I spotted this in Product Launcher, it's how they got the gun to rise up at the end.
The gun was just a normal rectangle, non-static with a mass and a material and an the image of the gun applied to it.
Initially it's sitting below the Z, and has a big Forcefield pushing up on it, but it can't move because the blocks that make the Z are in the way.
Once the Z blocks have exploded, the Gun rectangle is pushed up slowly by the forcefield.
Note: There is a very useful property of a linearforcefield.. geomonly
When set to true it means that the force field only acts on geometry objects, and NOT Goos. So you make huge and/or strong force fields wherever you need them, but they don't affect the goos, so the player doesn't know they are there... until it's too late!
The inspiration for this trap, came from a prototype level made by momo1526 which had 2 pipes and 2 levelexit's. It didn't work how he wanted it, but it gave me an idea.
Before you read on...
To understand how this trap works.. you should read [Wog Editor Reference : Multiple Exits and Pipes (Advanced)]
The mechanics of the trap are quite simple, although a bit fiddly to get just right.
View Trap Setup
The Spikey Bar is supported by the tiny rectangle (Latch) just below it.
The Latch is part of a compgeom object which also contains the Anchor_Support block... and there's an AnchorStickyInvisible Goo sitting on that.
The compgeom object is non-static and hinged. In this case I put the center point and the hinge in the same place, so that I could see how things would move by rotating the compgeom object in WoG Editor.
But that's it!
View Trap Triggered
When the lower exit is triggered, the Sucker (upper exit) pulls the Anchor Goo towards the center, the compgeom rotates, pulls the latch out from under the Spikey Bar.. and "Gotcha!"
Note: Normally the lower exit (the "Out of Order" pipe) would also collect Goos.
Because I didn't want that to happen in this level... I set the exit Filter to collect GooProduct only, so Ivys, Fuses and Commons will not go in. This means that NO Goo's can be collected in this level...ever!
Which is why I added the "targetheight" to the level, so there IS a way to finish.
I had to be a little careful about what happened after the trap was triggered, and if the exit closed and the sucking stopped.
I didn't want the latch block swinging back to its original position and getting in the way. So I adjusted the mass of the Anchor Support and the position of the hinge, to ensure that once it was triggered it would remain in the triggered position.
Note:
In v0.3 I removed the fire object that was covering the "workings" and put a big pipe graphic over it instead. I also put some geometry around the pipe, so the player wouldn't get caught on the top block, and also to make it easier to build up to the second pipe.
Also I set strandgeom = true (level root) so that you can't build through this new pipe, and strands don't try to attach to the AnchorStickyInvisible
In Trap #1 we used gravity to do our dirty work. Once the latch was released, the Spikey bar just fell on its own.
Here I didn't want the killing object to just fall... I wanted it to be "Spring-Loaded" and fly sideways... and for that we use the "geomonly" Linear Forcefields I mentioned earlier.
Again the mechanism here is quite simple, but took a bit a tweaking to get right.
View Trap Setup I have reduced the size of forces in the image, for clarity
The killer block starts inside Forcefield #1, and is held in place by the latch.
The killer block is just a normal rectangle, with an image and tagged as deadly.
Note: In the final level the wall graphic is set to depth=1 so that it hides the block, I changed it here so you could see it.
The latch and the pressplate are parts of the same compgeom object, so that they move together, and the compogeom is hinged. The part of the floor image which moves, is applied to this compgeom object, and I cut out that bit from the "background".
Even though the pressplate is bigger than the latch, the latch is actually much heavier. This is needed to ensure that the latch stays in place, even through the killer block is pushing on it, and to stop the pressplate just falling on its own and releasing the block without the player touching it.
The Endstop holds the pressplate in place, without it the latch is heavy enough to lift the pressplate out of the floor.
I balanced it so that the whole trap is "lightly weighted".. so that even a single Goo would set it off.
View Trap Release
Goo steps on..the pressplate drops, the compgeom rotates and the latch lifts upwards.
Forcefield #1 pushes the block to the right and into Forcefield #2.. which really WANGS it.
You'll notice that ForceField #2 is in the shaft... but it's set to "geomonly=true" so won't affect the goos if they go into it.
Both fields have an upward component to lift the block a bit, and get the firing angle just right.
Notes:
Originally I had one large force field, but I found that it also pushed on the latch.. and could trigger the trap on it's own. So I split the field into 2, and left a gap where the latch is.
Materials:
When the killer block hits the far wall it's going fast. I found using the default material "rock".. made it bounce off to much. The killer block is now "fruit" and the back wall is "swamp". This really deadens the bounce nicely, so even though the block is going fast, it only bounces just enough to land on the pressplate.
In v0.3 I put the Endstop at an angle and changed its material to "ice", because sometimes the killer block would get caught on it. Now the block almost always slides off and kills any remaining Goos...
This one's more of an obstacle than a "trap" since it's not triggered by anything and it's active and running right from the start.
The "trick" is, how to get a block to move across the shaft, and then go back to where it started and go across again.
A couple of early ideas...
Something like "PONG", where the block goes across one way, then comes back.
Something like a machine gun, with a load of blocks on one side, that drop into the "barrel" and get fired across one after the other. I think this would have worked, but you have a finite amount of "ammo", so if the player takes ages to get there, you'll have run out by the time they do.
(Editor's comment: Maybe that would have worked, if you route the blocks around the level, like the Goo Balls in "Alice and Bob and the Third Party" [AB3])
The "neat" answer: Have just one block, and make it spin in a very large circle.
So it goes across the shaft, then moves round (outside the game area) and back where it started and then goes across again.
Despite the fact that this should be simple to make, it was in fact rather annoying. The problem seems to be.. WoG's physics engine doesn't handle rotating, unbalanced objects very well.
Just a single rectangle and a hinge a LONG way above it, and set it to rotate, so the rectangle moves in a big circle. But it was juddery and the rectangle kept moving away from the hinge and catching on other geometry and getting stuck.
View Setup I did say the hinge was a LONG way above it.
The new setup has a compgoem object which has 2 rectangles in it (block #1 and #2) These are a long way apart (about 7500 px) and there's a hinge in the middle.
The important thing is that its nicely balanced, and spins great!
The complication with doing it this way, is you can only have 1 image on any compgeom object, so I had to make a tall picture with a little block at the top and one at the bottom.
Having written this guide, I decided that it would be nice to show that these "mechanisms" could also be used to help you, rather than just killing Goo Balls.
So I added a new "feature" to the level, the "Do Not Pull" handle.
The idea was simple; add a lever that can be pulled to stop the blocks. Doing it proved less simple.
View Setup Image
The problem was I wanted a moving lever that would push a "killer" block (tagged geomkiller) into the path of the fast moving blocks, and destroy them. However, because the lever is also a dynamic object the "killer" block killed the lever as well. The key was [DIY compositegeom] so that the pushed block and killer block move as a single object, but can have different tags. A similar idea was used in a few of the original levels, Red Carpet for one, but for different reasons.
View Image
The lever is pulled, this pushes the "pushed and killer" blocks into the support field, which keeps them in position, and the next time one of the fast moving block comes around.. the whole "spinner" object is destroyed.
The killer block is also tagged deadly so kills the UtilNuker Goo, which makes the "siren,shut down, hiss" noise.
The "Damping Field" is there to stop the "Do Not Pull" sign from swinging really wildly when the lever is pulled. It is a normal linearforcefield, but it applies no force and just has a dampeningfactor
I found another "bug" in WoG..
The nogeomcollisions attribute doesn't work when applied non-static compgeom objects, but it's fine on static ones.
So instead.... View Solution
I split the walls on both sides, and added nogeomcollisions rectangle over each pipe mouth.
This stops Goo Balls going into, or getting stuck on, the mouth of the pipe, but it lets the blocks through to kill them just fine
Just when you thought you were in the clear... a blooming great spikey wheel lands on you!
This trap is one of the most complicated and was one of the hardest to set up. Although I think there's a simpler way to do it.. which I might put in a later version of the level.
But for now....
View Trap Setup
There where several issues to consider when I was designing this trap ...
I want it to be triggered as soon as a Goo (balloon probably) comes out of the shaft
I want it to trigger no matter where (left - right) the Goo comes out
I don't want there to be any visible effect on the Goo when the trap is triggered
To cover these 3 things, the Trigger Bar rectangle seemed a good solution.
It's light (mass=1) so it doesn't affect the Goos, it's long and covers the whole shaft, and without an image it's invisible.
The problem is.. because it's so light, it can't do much... and because the Goo won't be going very fast, it doesn't have enough momentum to make very much happen.
That's where the Thrower Field comes in. It's geomonly again, so doesn't work on the Goos, but it's also a "force" field, rather than a "gravity" field, so as soon as the trigger bar moves up into it, it gets chucked nice and fast, which is enough to make something happen.
I wanted the Wheel to come from above, so the Pusher bar had to be nice and long and hinged above its center so it just hangs still to begin with.
The Ramp and Hurryup Field are just to guide the wheel and give it a bigger push... otherwise the goos have got up and out before the wheel arrives.
The final touch to this trap is the Quaker Goo (UtilEarthquake)
I got this idea from Product Launcher too...
The Quaker Goo is invisible and doesn't interact with anything and the player can't do anything with it...
What it does do... ALL it does in fact... is make the Earthquake sound when it dies.
The Pusher Bar is tagged as deadly.. so as soon as it moves the Goo dies and the rumbling sound begins... and moments later... Gotcha!
Well first... here's a video....
It shows all 4 traps in action, using Visual Debug Mode.
So you can see all the hidden stuff, and all the important geometry is nicely highlighted.
My aim in designing Gotcha! was not to trick you, trap you and kill a lot of unsuspecting Goos....
although I'll admit it was fun...
I know some of you are already thinking about designing similar levels.. or levels that do similar things...and I look forward to playing them... but consider this....
My aim was to show that you can use the physics stuff in World of Goo to create some quite complex "mechanisms".
OK I used them for traps, but that's not the only thing they could be used for.
I can think of plenty of situations where very similar setups could be used to HELP the Goos not just to HURT them.
(See the "Do Not Pull" lever in Trap #3)
They can now open doors, without needing a Bomb to blow them up. They can pull levels and push buttons that actually DO something. A group of goos in one area could complete a small task and open a trap door for other goos in another area.
In short, I believe this is the start of something wonderful... we can now set proper "problems" for the Goos solve...
the possiblities ARE endless.
Have fun!
DaB