Michael Edwards wrote:
Cool, no sweat!  The bowling app is here:
http://workingweek.org/apps/bowling-0.1.tar.gz

It makes pretty good use of the ode extensions, though I'd like to add
more complexity to the physics.  It requires the latest Soya from CVS
(to get the linear velocity to work).

To play:
* By default, the game is for two players.  You can specify more or less
on the command line, like so:
python bowling.py 3
* To aim the ball, hold down the left mouse button
* To throw, release the left mouse button
* After your ball has hit all the pins you think it's going to hit,
press "Enter" to continue.
  
It's funny that if you just wait, the ball starts rolling away. I should probably provide a way to stop the simulation, but doing the simulation step in begin_round is not conducive to that. Eventually there will be a separate step method. For now you could just deactivate the ball until the person throws it.
Notes:
* Scoring is VERY generous.  Just tapping a pin will mark it as hit
(TODO: make this tougher)
* The game logic isn't finished yet, so there is no end to the game.
(TODO: add 10th-frame logic)
* The struck pins get moved behind the "player".  Don't be surprised if
you see them in the background. (TODO: find a better place to stash
these, probably behind some scenery)
  
You could just delete them from the simulation, which I think world.remove(pin) would do. Come to think of it, it probably won't work right. I need to override the remove method in ode.World.
* I'm really looking for ideas to make the game look and play better, so
all suggestions welcome.
  
The pins could be fatter. Also, the center of mass and intertia tensor for them aren't quite right. You can adjust the center of mass without adjusting your model by making a subvolume to contain the shape as a child of the actual body of the pins.
* Any tips on using FRICTION would be appreciated.  I played around with
mu and slip, but I didn't get good results.  Eventually, I'd like the
ball to be able to hook, which would require that the ball spin fast
enough at first to overcome static friction, then slow down enough to
catch the floor and start hooking.  Not sure how to make this work.
  
The friction model in ODE is somewhat simplistic, so it may be hard to get good results. For one thing, the ball will probably tend to suddenly "catch" as soon as the speed slows down enough to get below the static friction.
* The code is an undocumented mess.  Sorry!
* The scale is wacked out.  The units are about 4 times as large as they
ought to be, assuming 1 unit ought to equal 1 meter, hence my fudging
the gravity.  4 units = 1 meter.
* Does anyone have any idea how to use the widgets?  Right now, I'm just
using text labels, but I'd like to use Banner objects if I can get them
to work.

Hope it's fun and educational!
  
It's great!

Couple bits of advice:

  • You don't need to implement methods if you're not overriding them. For example, you don't need begin_round on any of your classes, since you're just calling ode.Body.begin_round with no modifications.
  • Alley can be a Volume. It doesn't need to be a Body because it doesn't get affected by anything else in the simulation.
How come you are using a box for the pin geometry? I noticed the commented out cylinders are on the wrong axis. Were you not able to get that to work? GeomShape won't work right now as you've probably noticed. It collides fine with anything other than another GeomShape, which is what you're using for the alley. If you used a bunch of boxes for the alley geom, you could use GeomShape for the pins, but then they would tend to stick to one another, which is bad. I *think* the problem is my setting of the previous state each step. If you can figure it out, it would make me very happy  :)

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to