NxOgre Pinball - Source Available

bytewrench

30-12-2009 21:03:38

Ok gang, here is something for you to play with. I decided to make our pinball project open source. There are a lot of things that need improving upon, but it is a darn good start. It is using an older version of NxOgre, which is probably one of the first things that needs to be tackled.

Most all the basics are there though, table, lights, thumper bumbers, targets, flippers and more. This version is based on a Bingo theme, but I would like to see the project move forward in a more generic and reusable form. A sweet table editor would be nice. Well, there are many things that would be nice, we just dont have enough time to commit to the project.

I searched long and hard for a good open source pinball game on which to base my project, and the closest I could find was Emilia Pinball, and it just was not what I was looking for. When NxOgre came around, I thought "Wow, this will be great!" and it was! I had been through a few different physics engines using different rendering engines, but NxOgre beat them all, hands down.

This is my first attempt at releasing code to the developer community, so be easy on me. I have never claimed to be a good programmer, I am more of the kind of guy that says, "I wonder if this will work?" and hack away until I prove myself one way or the other.

I will try to answer questions as best I can, but my day job keeps me very busy and I may not be able to answer as quickly as I would like. The code is fairly easy to read and follow, and with some smart game devs getting into the code, I feel that it will end up being a really strong and flexable game.

http://github.com/bytewrench/NxOgre-Pinball


have fun!
Eric

betajaen

30-12-2009 21:31:19

Good Job!

I'm glad you decided to use GitHub as I suggested. Now upgrade it to use BloodyMess! ;)

ShUr1k3n

01-01-2010 13:22:13

Hi, thanks for sharing the code with the community, i have one question you might know the answer.

What scale do you use for the objects? Real dimensions, like the Pinball itself with a few centimeters?

If that's the case, didn't you have problem with the physics? Like gravity, because i am working on a project that uses small objects and the physics are not working very well. I think the solution should scale the objects like, 1 cm == 1 meter, and then adjust some values of physics (Gravity?), that i don't know if that is possible.

Thanks again for your contribute to the community :)

betajaen

01-01-2010 14:07:03

Browsing the source looks like it's just normal gravity and sizes.

ShUr1k3n

01-01-2010 15:55:45

Browsing the source looks like it's just normal gravity and sizes.

Hum, so the ball is in centimeters? So, any idea why did the objects in my project (small object with 3-15cm) are not responding well to Physics?

Thanks in advance.

betajaen

01-01-2010 16:05:45

Yep, ball is in centimetres but referenced in metres. I expect why it's more accurate as the pinball doesn't travel that fast enough for collision to be a problem.

As for your problem. Try increasing the iterator and use more primitive shapes for better collisions. You could also use sweeping, and raycasting if your doing "missile" type objects.

ShUr1k3n

01-01-2010 16:20:56

Yep, ball is in centimetres but referenced in metres. I expect why it's more accurate as the pinball doesn't travel that fast enough for collision to be a problem.

As for your problem. Try increasing the iterator and use more primitive shapes for better collisions. You could also use sweeping, and raycasting if your doing "missile" type objects.


How can i increase the iterator? Are you talking about this?:

mTimeController->advance(evt.timeSinceLastFrame);

No, my project does not use missiles, but for instance i had all object like 1centimeter = 1meter and all work ok, but once objects are extra-big they need a lot of time to "reach" the floor ( should i increase the Gravity)? And when i change to real-dimensions (1 centimeter = 1 centimeter), they physics didn't work well, like the Gravity seems to be 2-3 times "faster" and the balls keep bouncing on the floor! :?

thanks a lot for the tips.

betajaen

01-01-2010 17:28:48

No in ~SceneDescription.maxIterator. When I mean missiles I mean fast moving objects; like golfballs, grenades, throwing knives, etc.

You can work in CMG if you like but you need to correctly scale (power of 10 everything), as NxOgre is working in metres.

ShUr1k3n

01-01-2010 17:51:09

I can't find maxIterator in SceneDescriptor (using last version of NxOgre), name changed?

For example (Pro Evolution soccer) the ball is like a "missile" and should be used sweeping, and raycasting or not?

Sorry for taking your time.

ShUr1k3n

03-01-2010 00:33:44

No in ~SceneDescription.maxIterator. When I mean missiles I mean fast moving objects; like golfballs, grenades, throwing knives, etc.

You can work in CMG if you like but you need to correctly scale (power of 10 everything), as NxOgre is working in metres.


Hi, i tried to scale everything to CMG, so the gravity now is -981.0f, right?

The "fall" of objects seems fine to me now, but when the ball is at the floor, this happens:

____O____

then:

----O----

and then (again):

____O____

Legends:

"_" and "." == Floor
"O" == Ball

And if i put the gravity (-9.8f) this doesn't happens, but the scale don't work ok.

Any suggestion?

Do i need to change this values?:

StaticFriction (current == 0.5)
DynamicFriction (current == 0.5)
Restitution (current == 0.1)

Thanks.

betajaen

03-01-2010 10:47:14

No, only lengths/distances and masses.

Like I said have a look at the maxIterator (or words like that in the SceneDescription), double the amount and see if that helps.

ShUr1k3n

03-01-2010 17:15:51

No, only lengths/distances and masses.

Like I said have a look at the maxIterator (or words like that in the SceneDescription), double the amount and see if that helps.


So the gravity should stay -9.8f? Or are you talking about Friction values?

About the "maxIterator", these are the ones i found:

sceneDesc.mMaxSubSteps

and

sceneDesc.mMaxTimeStep

but unfortunately didn't help! Any other suggestion?

regards.

betajaen

03-01-2010 17:29:33

No, gravity is an acceleration; measure of length/time, so it needs to be multiplied as well.

It's substeps, you can also try increasing the substeps on your ball actor (in the RigidBodyDescription as well).

Otherwise you'll have to use PhysX directly and try out CCD to see if that helps.

ShUr1k3n

03-01-2010 17:56:02

No, gravity is an acceleration; measure of length/time, so it needs to be multiplied as well.

It's substeps, you can also try increasing the substeps on your ball actor (in the RigidBodyDescription as well).

Otherwise you'll have to use PhysX directly and try out CCD to see if that helps.


There is no substeps on RigidBodyDescription, only this "mSolverIterationCount", is that?

I tried to duplicate that value, and same results :S

I think i will need to check the PhysX CCD, or are you gonna add it in the next release?

Regards.

betajaen

03-01-2010 20:58:47

SolverIteration count, yes.

What are your shapes? Sphere and ?

ShUr1k3n

04-01-2010 12:39:52

The floor itself, SceneGeometry.

I also tried with a triangleMesh, and same result.

Do physX support "small-objects" (few centimeters) ?

Or thats not the problem here?

Thanks.

betajaen

04-01-2010 13:05:38

PlaneGeometry?

Collisions with small objects are difficult in any physics/collision engine. Since time is effectively sliced up, PhysX is seeing the scene in snapshots - like taking pictures on camera very slowly. One frame it's above the plane, then the next one underneath it. Usually you can catch objects if they are big enough but CCD helps because it extends the shape in direction of travel, and sweep testing can help if you know where the object will be.

My advice is; To play with the Scene iterator (have more substeps, lower timesteps) and use CCD with PhysX directly, or just increase the size of your object.

ShUr1k3n

04-01-2010 13:25:33

yes, PlaneGeometry.

Ok, i will try your tips, today + tomorrow as see what i can get.

Btw, any reference i should start, except Documentation/examples of PhysX?

Thanks.

girishgap

29-03-2010 06:36:14

extermly sorry for that but i dont kw how to run the code becs i m fresher in my cmpny and i got assingment no doubt i run all the ogre tutorial also nxogre tutorial.
rely i m nt understand just download code form github go to vc8 there will file name nxtutorial204.vcproj click on it but debug give path all stuff it wont run it gives lot of error can u tell wher could i found nxogrescenecontactcontriller.h file it is nt in my nxogre folder. so i download latest nxogre in that also it is nt present anyone help me i saw all ms3d file game will gud plz rply as soon as possiable

girishgap....

betajaen

29-03-2010 13:07:39

extermly sorry for that but i dont kw how to run the code becs i m fresher in my cmpny and i got assingment no doubt i run all the ogre tutorial also nxogre tutorial.
rely i m nt understand just download code form github go to vc8 there will file name nxtutorial204.vcproj click on it but debug give path all stuff it wont run it gives lot of error can u tell wher could i found nxogrescenecontactcontriller.h file it is nt in my nxogre folder. so i download latest nxogre in that also it is nt present anyone help me i saw all ms3d file game will gud plz rply as soon as possiable


I can only understand every word there. Write out your post again, using full English, with punctuation and the proper spelling. If you don't speak English as your first language; I'll give you some slack.

Otherwise we won't help.

NazguL86

02-04-2010 00:11:19

I'm trying to compile the source but I get this error message:

Cannot open include file: 'NxOgreSceneContactController.h': No such file or directory

I tried to search online and on my NxOgre / PhysX folders but I didn't succeed in finding it ... what is wrong ? :?: