WIP: Physics driven machine (slides&slopes)

This is my first attempt to create some sort of modular design for a physics-driven machine in Blender.

http://farm1.static.flickr.com/151/374298524_753a6290e8.jpg

Modular elements so far

  • Horizontal slides
  • Slopes (slides with an angle) + Curves (Straight)
  • Spirals
  • Dropper (basically a hole in a slide)
  • Shooter takes a ball that drops in from above (e.g from a Dropper) and redirects it into a horizontal motion again. This one has the special property of rotating 90 degrees (forward&back) each time a ball has passed trough. Also slows down a passing-trough ball.
  • Bumper + Catcher (Shooter bumps a ball vertically into the air and the Catcher redirects it into a horizontal motion again)
  • Teleporter and Teleporter-Target (the target can be any object)
  • Colorizer - This little gizmo changes the mesh/colour of the ball when activated. This is the first script i had to separate into two script-files in order to work. See ā€œcolorizerā€ & "colorizer2"UPDATE8 2007-01-30: You can download the most recent blend file here.

TODOs

  • [DONE] I still have some problems with the Bumper since they behave differently every time I use them (caused by small differences in the physics-calculation) and i need to figure out a way to ā€˜aimā€™ or ā€˜guideā€™ the spheres a bit.
  • [OPEN] I still need to figure out how to display the exchanged meshes correctly. They currently are on layer 2 and are drawn ā€˜shadelessā€™ when exchanged.This thread is a follow-up on two other (problem driven) threads of mine - where my progress in the GE is documented quite well :wink:
  • ā€˜removeā€™ and ā€˜addā€™ objects from collision detection (Questions that came up when I tried to create the ā€œShooterā€.)
  • Shape key (and armature) animations in GE? (First tests with the ā€œBumperā€.)
  • Exchange material of object in GE? PhysicsId & actuators of an object Questions about exchanging materials and similar stuff as needed by the colorizer
  • reusing scripts (was helpful when creating the ā€œmain.pyā€ file - donā€™t call it ā€˜globalā€™ btw ;))Comments, critics and suggestions welcome,
    Werner

you gonna put that in the ā€œbest machine using bulletā€ contest?

Screenshot, .blend, clear intentionā€¦perfect. I just want to commend you for taking the time to post right, it just made my day. Thanks.

That said, I like the look and feel of your marble machine. There are still some mechanics issues (like when the balls misalign with certain pipes, and go ā€œoverboardā€), however Iā€™m sure thatā€™s something that can be tweaked out quite easily.

Are you doing this for the new Bullet competition?

If so, I think this is a pretty good start toward a contender.

Keep it up.

The contest was definitely an inspiration to play with the GE again, but Iā€™m not sure if I can get something complete up in time.

So Iā€™m most probably not going to enter the contest - anybody feel free to salvage parts of my stuff (as long as the result goes back to the blender community ;))

My dream-come-true would be if the ā€œplayerā€ could place all these modules himself ala ā€œincredible machinesā€, but thatā€™s an aim to far in the future (and way beyond my current skills) to be realistic right now.

Werner

is there any way you can make the spheres sit longer before they are launched? it seems they arenā€™t all the way ā€˜lockedā€™ into place before they get shot, which is causing them to fly wrong, what if you took the launcher and made the hole deeper, so the ball canā€™t move back and forth, and then when it launches, it will launch straight.

btw, very nice concept, I am going to play around with it if you donā€™t mind

Overboard: I noticed that too, but this depends heavily on the machine (and blender version) i run it on. On some combinations nothing runs overboard, on others it"s pure chaos - seems like the physics code is heavily CPU/computer dependent :frowning:

EDIT: What i actually want to say is that tweaking it might help for one system, but one needs to check it everywhere else as well continuously.

The only constant problem i see is the mis-aiming of the ā€œBumpersā€ when shooting balls into the air (as mentioned in my fist post). Anybody got ideas how to stabilize the flight of the ball?.

Werner

On a related note: A ā€œGame Engine WIPsā€ forum or something like that as s/b mentioned elsewhere would really be a good idea.

Making the time longer is easy enough, just change the ticks value f:10 to 30 or higher in the ā€œball_pulseā€ sensor(s) - doesnā€™t help much (here at this comp)

I also fiddled around with the shape of the bumper, but nothing really helps, the ball just has some ā€˜fuzzynessā€™ when launched :confused:

btw, very nice concept, I am going to play around with it if you donā€™t mind
Sure as i mentioned earlier Go ahead and improve on it :slight_smile:

Werner

I think we still have a set of marble pieces a lot like those at home. Canā€™t wait to see what you will do with them.:slight_smile:

Ok, i think i found a fairly good solution of the bumper (sans the fine-tuning), but i ran into some problems ā€¦ first the script Iā€™m using that is connected to a collision sensor:


# Get the script-controller
co = GameLogic.getCurrentController()

# Get the collision sensor the script-controller is linked to (assumes there is only one - thus it's a precondition when making logic blocks).
sensors = co.getSensors()
sens = sensors[0]

# Get the object the sensor is assigned to (inner part of the "bumper").
#obj = co.getOwner()
obj2 = sens.getOwner()

# Get the location of the "bumper" object.
location = obj2.getPosition()

# Gets the object that has touched the "bumper".
obj_ball = sens.getHitObject()


# Place Ball on top of the "bumper"
obj_ball.setPosition([location[0],location[1]+5,location[2]])

# Bump the ball upwards.
obj_ball.applyImpulse(obj_ball.getPosition(),[0,0,20])

Two questions remain:

  1. How do i prevent ā€œNoneTypeā€ objects from executing the last two comamnds (i.e. how do i check for ā€œ!=NoneTypeā€)?
  2. [EDIT: Nevermind, found my error] Why is collision suddenly not active for the ball after executing ā€œapplyImpulseā€ (i.e. the ball is passing right trough the ā€œcatcherā€)?

Werner

I updated the blend file with the new script-driven ā€œBumpersā€.

You can download the most recent blend file from the link in the original post.

The script above is included (in a version that actually works ;)), the only thing left is to remove all those nasty ā€œNoneTypeā€ errors.

Werner

Added a teleporter and teleporter-target (the target can be any object btw). One defines the name of the target-object in the properties of the teleporter-sensor.

You can download the most recent blend file from the link in the original post.

Suggestions for more modules are welcome.

Werner

Itā€™s looking good! Nice job so far.

Would it make sense to create ā€œassemby lineā€ or ā€œtrackā€ component to the kit? It could be active all the time or activated when ball hits it. See tracktest.blend for better reference about what I mean by ā€œassembly lineā€. http://mediawiki.blender.org/index.php/Release_Notes/Notes243/Modifiers

hey nice workā€¦ just downloaded it. .seems to work farely wellā€¦ sometime the balls drop off the bottom right side curveā€¦ you should enter it in the competition

I added a slowdown script to the shooter so the ball isnā€™t thrown trough the air as often (it can still happen if the balls drop in too fas after each other though).

You can download the most recent blend file from the link in the original post.

Band-conveyor: Good idea, but I think array-modifiers do not work in the GE or am I wrong? Dunno if I wanna do this much work :wink:

Werner

Added the possibility to rotate the camera (left+right cursor key), a small fix (slower) so the ā€œstarterā€ doesnā€™t work as a spoilsport and a readme with some info on the file.

You can download the most recent blend file from the link in the original post.

Werner

yyyaaaaaahhhā€¦ Now this is what I am talkin bout :stuck_out_tongue:
I am having lots o fun with it now :smiley:
AWESOME!
5 *****

ohā€¦ darnā€¦ I canā€™t vote on this threadā€¦

Well ummā€¦ * * * * *!!!

There!

1 Like

I added a new element: The Colorizer ā€¦ This little gizmo changes the mesh/color of the ball when activated. This is the first script i had to seperate into two script-files in order to work. See ā€œcolorizerā€ & ā€œcolorizer2ā€ in the file.

I still need to figure out how to display the exchanged meshes correctly. They currently are on layer 2 and are drawn ā€˜shadelessā€™ when exchanged.

I could place them on the first layer, but this isnā€™t really a good (it gets crowded there without them already) solution - any tips?

You can download the most recent blend file from the link in the original post.

EDIT: This version (i.e. the colorizer in slopes17.blend) does not seem to work with blender 2.43 RC1 (didnā€™t have time to check others) tough it works fine in 2.42a. Iā€™ll look into this.

Werner

Added a resurrection point for balls that fell of the slides (or the shooter which is the weak link in the chain right now). It uses the ā€œteleporterā€ script with just another target (defined in the properties).

By itself this wouldnā€™t even be worth a message in this thread, but i also added an additional logic=brick counter that tells you how many balls touched the ground.

This little GE blend file of mine now has a goal ā€¦ keep the resurrection number at zero without spending a lot of work into the logic & structure :wink:
This is the most in-deep interaction youā€™ll ever get out of a game ā€¦ fiddling with the game(-code) itself (codewars comes to mind :))

EDIT: Longest run that Iā€™ve stopped was 19 minutes with 10 resurrections.

You can download the most recent blend file from the link in the original post.

Werner

so basically, make a setup and see how long it lasts w/o editing itā€¦
hmmmm let the games begin!
/me starts to download the new fileā€¦

Not exactly ā€¦ if I would need to make defined rules of the game i would state it like ā€¦ ā€œModify the shooter (with as few changes as possible) so no ball is dropped (0 resurrections) at all in a time-frame of 20 minutes ā€¦ in the default setup.ā€ So the aim in the default ā€œgameā€ is to make the elements work as expected :wink:

Of course thatā€™s just a suggestion ā€¦ Iā€™m looking forward to the results if you create your own slides&slopes setups :smiley:

Status update: Iā€™m playing with the idea to make modules that work similar to quake3-style jump-pads (using the ā€œbumperā€ code) but I donā€™t have much time right now.

Werner