Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (SBGuy), 652 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 5 1 2 3 4 5
Re: Newbie Question [Re: A.Russell] #27628
06/01/04 20:44
06/01/04 20:44
Joined: Mar 2003
Posts: 4,427
Japan
A
A.Russell Offline OP
Expert
A.Russell  Offline OP
Expert
A

Joined: Mar 2003
Posts: 4,427
Japan


Okay. while I didn't have much to do at work today I planned this pachinko simiulation a little more and read the physics commands in the manual.

Since the entire playing field is no more than 50cm diameter, and there are a lot of small objects, I think the scale should be something like 1 quant = 0.5mm (a pin wouldn't be much more than 1mm diameter in any case).

If the scale were 1q = 0.5mm then gravity would need to be set to -7620 (381*1/0.05 -isn't that right?).

That being the case, should I use geometry for the pins, or entities (set up somehting like ph_settype(pin, ph_rigid, ph_cylinder) ?)

To shoot the balls onto the field, would I create the ball at its start position and use phent_adforcelocal()? This command is difficult for me to understand ,so some light on how this could be made to work would be useful.

I have no idea what the mass of a pachinko ball would be. I'll try and ask someone.

There are spinners in the machine too. I haven't got to thinking about how they would be made to act.

Firstly, if you physics' gurus could tell me if I'm on the right track so far as regards scale, I can go ahead and make a playing field for testing.

Re: Newbie Question [Re: A.Russell] #27629
06/02/04 10:00
06/02/04 10:00
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
The overriding theme to this reply:

Don't rely on physical numbers to guide you but only to inspire you. Rather, manually vary all the settings till it looks and feels good or right or appropriate.


Quote:

Since the entire playing field is no more than 50cm diameter, and there are a lot of small objects, I think the scale should be something like 1 quant = 0.5mm (a pin wouldn't be much more than 1mm diameter in any case).




At this scale, your whole machine will only be 1000 quants wide and each pin would be 2 quants. I would scale up the whole machine so that your pin is at least 10 quants wide. Otherwise, your pins will look like rectagular nails instead of pins and while the PE should be able to handle 1 or 2 quant object collision, it's asking for trouble IMO.
Of course I'm not aware of the steel ball dimensions; that plays a factor too.

Quote:

If the scale were 1q = 0.5mm then gravity would need to be set to -7620 (381*1/0.05 -isn't that right?).




It would actually have to be set to -19.6 kq/s/s.

[ (1q) / (.5 mm) ] * [9800 mm/s/s] = 19600 q/s/s

My advice with gravity is though don't use physical numbers. Tweak it manually till it "looks" and "feels" right...it's not the real world inside your computer, so why be bound by it's numbers.

Quote:

That being the case, should I use geometry for the pins, or entities (set up somehting like ph_settype(pin, ph_rigid, ph_cylinder) ?)




Go with a larger pin size as above and use cylinder. Otherwise, any should do.

Quote:

To shoot the balls onto the field, would I create the ball at its start position and use phent_adforcelocal()? This command is difficult for me to understand ,so some light on how this could be made to work would be useful.





I'm going to assume that you launch the balls like in a pinball machine, spring loaded.

phent_addforcelocal takes two vectors. The first one tells you the direction you want to apply the force (up, down, left, right since this is local....n, s, e,w if this was addforceglobal). The second vector tells where to apply this force. For our purposes, leave this as a nullvector since we want to apply the force dead center to the ball. HOwever, putting a off center value to the second vector will lead to spin, which is not an entirely bad thing!

Ok now, put your ball in it's chute. The player can select to stretch the spring back to 5 diffrent positions (this discritization makes it easier on us to code and easier on the animations). 1 is a slight pull back. 5 is a pulled back all the way.
the only diffrence between these setting is the amount of TIME you apply addforcelocal
Thus, you would constantly apply (through a loop...won't do it automatically) a addforcelocal for say 1 sec up to 5 secs. Naturally, the 5 sec ball has had more momentum imparted on it and thus shoots off fast. The 1 sec ball hasn't had as much time to gain momentum and thus comes out slower.

Quote:

I have no idea what the mass of a pachinko ball would be. I'll try and ask someone.






I would guess it at under 50 grams. Maybe under 20 grams.
BUT, like my gravity advice, don't be ruled by physical numbers. The player will have NO idea what the gravity setting is nor what the mass settings are..they will equate bigger with heavier and things of the same volumen and material as being the same mass and that's enough for player immerssion! Look up the mass, but honestly, just manually tweak it till it looks good.

Quote:

There are spinners in the machine too. I haven't got to thinking about how they would be made to act.




Digest the above and then we'll move to contraints. A spinner will not be difficult at all.


(PS: lose the yellow virtual world...one can harldly read it and yellow is a HEADACHE color in my book.... )

Re: Newbie Question [Re: fastlane69] #27630
06/03/04 00:10
06/03/04 00:10
Joined: Mar 2003
Posts: 4,427
Japan
A
A.Russell Offline OP
Expert
A.Russell  Offline OP
Expert
A

Joined: Mar 2003
Posts: 4,427
Japan
This physics thing is fun


Thanks Fastlane. I threw a level together today. As you suggested I used a very small scale of 1 quant=0.1mm.

However, I've run into a couple of problems.

The collision detection is terrible. Even though the walls are at least ten quants thick, the ball often goes through them. It doesn't even seem to matter what speed the ball is travelling at.

The ball performs better when I use a spherical model. When I try using a sprite, even though I have set it to behave like a sphere, it doesn't. Also, when it gets in a narrow place, it sometimes slows down then speeds up again -not very realistic.

I have another problem with the GSjanFX plugin, but that is a different story, and I'll post elsewhere.

in the meantime here is the code I threw together for testing:

Code:
// pachinko2.wdl



path "C:\\Program Files\\GStudio6\\template"; // Path to WDL templates subdirectory

include <GSjanFX.wdl>;

var ball_pos[3];


//function declarations
function create_ball();
function init_sphere();
function init_pin();
function set_pins();





//string pachinko2_wmb = <pachinko2.wmb>;


function main()
{
level_load ("pachinko2.wmb");
wait(3);


camera.x = 0;
camera.y = -6500;
camera.z = 1500;
camera.pan = 90;
ball_pos.x = 900; // initial value, ranges from -95 to 105
ball_pos.y = 0;
ball_pos.z = -750;

// set_pins();
create_ball();
}





//entity* ball_ptr;


function create_ball()
{

ent_create("pachi_ball.mdl", ball_pos, init_sphere);



}

function init_sphere()
{
my.scale_x=2.5;
my.scale_y=2.5;
my.scale_z=2.5;
my.pan=90;

phent_settype(my, ph_rigid, ph_sphere);
// Enable physics for this ball; it will behave like a sphere when it comes to collisions

phent_setmass(my, 0.05, ph_sphere);


phent_setfriction(my, 30);
// Friction = 30 (could be 0...100)

phent_setelasticity(my, 60, 0);
// Bounce a little (value = 30, could be 0...100)

temp.x = 0;
temp.y = 0;
temp.z = -360;
ph_SetGravity(temp);
// Set gravity for the sphere (temp.z = -380 corresponds to the earth gravity factor, g = 9.81 m/s2)

//punch ball out shoot
phent_addforcelocal(my,vector(0,20000,0),nullvector);

while (my.z > -1000) {wait (1);}
// Wait until the ball has fallen off playing field

phent_settype(my, 0, 0);
// Now stop the ball; A6 commercial allows us to use one object (ball) at a time

wait(1);
ent_remove(me);
}

function init_pin()
{
phent_settype(my,ph_rigid,ph_cylinder);
}




function set_pins()
{

//this doesn't work properly yet





Last edited by A.Russell; 06/03/04 00:20.
Re: Newbie Question [Re: A.Russell] #27631
06/03/04 08:26
06/03/04 08:26
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
Quote:

The collision detection is terrible. Even though the walls are at least ten quants thick, the ball often goes through them. It doesn't even seem to matter what speed the ball is travelling at.





ROFL. Sorry, not laughing at you, but this is a "classic" 3DGS PE bug/problem. The solution for the time being is to, well, make sure you're balls aren't going fast enough to go through the walls. Also, one thing I found helped me alot was to set the friction of the walls to 0% and elasticity to 100 as well. These "smooth" and "perfectly elastic" walls are less likely to have objects go through them.

Also, I notice you have a 50 "gram" mass(my.mass =.05) for your balls. Again, this is a realistic number, but realistic don't fly to well yet with the PE. Again, to minimize "punching through" a wall, set this mass to at least 10 or 100. Changing your mass won't affect your falling rate as long as you have no drag, so play with that number.(well, rather it shouldn't...i've noticed some discrepancies in this area)

Quote:

The ball performs better when I use a spherical model. When I try using a sprite, even though I have set it to behave like a sphere, it doesn't. Also, when it gets in a narrow place, it sometimes slows down then speeds up again -not very realistic.




I wouldn't mix 2D and 3D objects for collions. STick to the sphere definitly. The slow down in narrow places may be realistic if you consider that your entity was most likely rubbing up against the walls. Set your wall (or ball. the way the PE does friciton, wont' matter) friction to 0 and see if this still happens.


3DGS PE programming IS fun. It gives you almost immediate results and feedback to your works. Once it's stabilized (ie problems you addresses are taken care of), it will be a singular JOY to work with!

Re: Newbie Question [Re: fastlane69] #27632
06/03/04 22:34
06/03/04 22:34
Joined: Mar 2003
Posts: 4,427
Japan
A
A.Russell Offline OP
Expert
A.Russell  Offline OP
Expert
A

Joined: Mar 2003
Posts: 4,427
Japan


Thanks for that advice Fastlane, I'll save my level as a map entity and set those characteristics.

The problem with using a 3d ball is that they require a lot of polygons, and to make the light spot on them stay in the right place would no doubt require some kind of shader as well (one I don't even know exists). The pachinko machine requires lots of balls. The bare minimum to be playable is 400, and I want to be able to show the balls in catch basin. A sprite that behaves like a ball is the obvious first choice.

The biggest problem is, the ball isn't even going especaially fast yet, and it can't handle collision. Certainly not as fast as they move in the real machines.

I'm going to try making smaller blocks for the invisible front ofthe machine as well, since that is where the balls most often exit the machine. Perhaps big blocks don't detect collision as well?


@ Marco: What's the story with collision detection? Should it be able to handle fast moving pinballs?

Re: Newbie Question [Re: A.Russell] #27633
06/03/04 23:14
06/03/04 23:14
Joined: Mar 2003
Posts: 5,377
USofA
fastlane69 Offline
Senior Expert
fastlane69  Offline
Senior Expert

Joined: Mar 2003
Posts: 5,377
USofA
FYI, I've only ever had 120 physics objects max on the screen and I think I had the physics clock running in the hundreds of ms; needless to say, the simulation gound to a halt.

400 registered physical objects is, IMO, a bit too much.
I can safely vouch for 100 registered physical ents on screen.
Don't know about the rest of the users.

Re: Newbie Question [Re: fastlane69] #27634
06/04/04 02:00
06/04/04 02:00
Joined: Mar 2003
Posts: 4,427
Japan
A
A.Russell Offline OP
Expert
A.Russell  Offline OP
Expert
A

Joined: Mar 2003
Posts: 4,427
Japan


How about if they are just being used for their collision hull (cylindrical pins)? or their elastic, friction-free surface (the level itself)? For the balls that aren't in the playing field, perhaps I could use "Fake Fizziks"?

Anyway, it's all for naught if the collision system can't handle small steel balls wizzing around hitting pins and other small objects (ramps, spinners, rails). At any scale the pins have to be small in comparison to the balls. No pinball simulation is possible without that.

Though I haven't tried scaling the larger sized blocks down yet. Notably the invisable "glass" front.

I have some time tomorrow to test this again.

Re: Newbie Question [Re: A.Russell] #27635
06/04/04 08:03
06/04/04 08:03
Joined: Sep 2003
Posts: 3,236
San Diego, CA
M
Marco_Grubert Offline
Expert
Marco_Grubert  Offline
Expert
M

Joined: Sep 2003
Posts: 3,236
San Diego, CA
Quote:


How about if they are just being used for their collision hull (cylindrical pins)? or their elastic, friction-free surface (the level itself)? For the balls that aren't in the playing field, perhaps I could use "Fake Fizziks"?



For the balls outside the field just disable physics again: phent_settype(my,0,0); will make my an obstacle for other balls but not move my anymore.

Quote:

Anyway, it's all for naught if the collision system can't handle small steel balls wizzing around hitting pins and other small objects (ramps, spinners, rails). At any scale the pins have to be small in comparison to the balls. No pinball simulation is possible without that.



I think fastlane pointed that out before, you should scale up the whole design for better collision detection, e.g. 10 quants per inch as opposed to the standard 1 quant per inch.

Do the balls penetrate geometry when on their own (e.g. single ball in the machine) or only when pushed there by dozens of other balls?

Quote:

Though I haven't tried scaling the larger sized blocks down yet. Notably the invisable "glass" front.


Use an MDL block set to appropriate scale in WED with visible=off.

If it gets to frustrating just send me a mail with your level and I'll take a look at what is going wrong.

Re: Newbie Question [Re: Marco_Grubert] #27636
06/05/04 03:41
06/05/04 03:41
Joined: Mar 2003
Posts: 4,427
Japan
A
A.Russell Offline OP
Expert
A.Russell  Offline OP
Expert
A

Joined: Mar 2003
Posts: 4,427
Japan

Thanks Marco, it did get frustrating, and I have mailed the level.

The most frustrating problem is that the ball always exits the front as if there were no block in the way. The narrow looking chute walls are fine (they are actually ten quants thick in any case). No matter how thick or thin, whatever size, if visible is set or not, if I move it around, it makes no difference. The front block/blocks is always passable (of course I didn't set it passable, it just is).

It also didn't matter if it was a regular level or a map entity. So I think I've exhausted every test before giving in and sending it to you.

I couldn't get the scale much bigger if I wanted to either. It is already at ten quants to a millimeter. I tried making it even bigger, but all it did was make for a much longer build time, and the ball didn't move as naturally anymore with the increased forces I needed to use on it.

Quote:

For the balls outside the field just disable physics again: phent_settype(my,0,0); will make my an obstacle for other balls but not move my anymore.





That's what I was thinking of doing. I see there is a bitmask for enabling and dissabling whole groups of physics entities. I was thinking of putting the balls in the basin in a priority queue depending on how close they are to where they enter the machine, and enabling maybe twenty or thirty at a frame from closest to farthest. That way even there are hundreds in the basin they should all keep moving through.

Last edited by A.Russell; 06/05/04 03:43.
Re: Newbie Question [Re: A.Russell] #27637
06/05/04 07:07
06/05/04 07:07
Joined: Sep 2003
Posts: 3,236
San Diego, CA
M
Marco_Grubert Offline
Expert
Marco_Grubert  Offline
Expert
M

Joined: Sep 2003
Posts: 3,236
San Diego, CA
You are running into an issue with the current collision detection. Invisible blocks are not considered obstacles at all. Remove the invisible blocks in your WMP and replace them with a single large MDL cube set to invisible. While you are at it you might also want to change the machine backdrop into an MDL which will increase compile time and FPS, i.e. only leave the slopes and ramps as blocks.

The pins should not be physics entities, since they won't be moving anyway lots of CPU time would be wasted. Instead use regular MDL or WMB entities for them. Looking at the large number of pins you are likely to run into performance problems, using a sprite for the spheres might indeed be a good idea. Try playing with that scale, while larger scale makes collision detection more reliable it also makes it slower due to increased tesselation of level blocks.

Page 2 of 5 1 2 3 4 5

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1