Snooker Table... - SLUniverse Forums


Project Development Discuss projects you are working on

Reply
 
LinkBack Thread Tools Display Modes
Old 02-06-2018, 07:42 PM   #1 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Snooker Table...

I've seen a lot of snooker and pool tables in SL but they are all static models with maybe a pose engine (well, all the ones I've been able to find in searching anyway). I was playing a couple of frames of snooker at my local club and I wondered was it possible to use Havoc physics to make a table actually playable in SL?

After checking out exactly what it's possible to do physics-wise with LSL I decided the answer was 'maybe" and started working up a set of scripts to find out. Now that they are slowly coming together it was time to start on the models I'd actually use them with....



It's not optimized for upload yet, that's a blender render, but all the pieces that should have different physics properties are made as separate meshes and the model itself is at 1:1 scale for a full size 12-foot table.
Da5id Weatherwax is offline   Reply With Quote
Old 02-07-2018, 01:14 AM   #2 (permalink)
I don't do stupid.
 
Lance Corrimal's Avatar
mean old man
 
Join Date: Feb 2010
Posts: 2,426
My Mood:
SL Join Date: 2006-06-09
Business: My!
Client: Dolphin Viewer 3
Send a message via Yahoo to Lance Corrimal
I have the pool tables from ramos, their game engine is brilliant... maybe the guy's open for a collab? I'veen pestering the guy about a playable snooker table for years...
__________________
Lance Corrimal is offline   Reply With Quote
Old 02-07-2018, 07:47 AM   #3 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Quote:
Originally Posted by Lance Corrimal View Post
I have the pool tables from ramos, their game engine is brilliant... maybe the guy's open for a collab? I'veen pestering the guy about a playable snooker table for years...
I think I might just give him a shout... I suspect the reason he might not have been too responsive to your pestering is the logic around respotting the color balls, detecting if the spot is free etc but I've cracked that.
Da5id Weatherwax is offline   Reply With Quote
Old 02-08-2018, 06:39 AM   #4 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
first in-world view on the beta grid...


It looks ok, physical balls roll properly on the table, bounce off what they are supposed to bounce off etc.. Only "quirk" in the build that I encountered was that I had to break apart a few of the meshes that needed accurate physics shapes rather than approximations. For example - I originally modeled all 6 cushions as a single mesh but the uploader objected to the curves and undercuts in the physics shape as degenerate triangles. Without changing the models or physics mesh at all, separating the six cushions into separate models they uploaded fine. The triangles the uploader objected to the first time were still the same size but the model bounding box was smaller so the uploader no longer considered them degenerate.

Now on to the long slow process of messing with test scripts to empirically determine the "correct" physics params (friction, restitution etc) for each component so they collide and bounce in a way that looks "real" from a RL players perspective....

Along the way I'll do some more tweaking of the model and see if I can get its LI down a bit, but even after that I'm thinking the table will end up as around 30 LI, with 22 more (for the balls) required to play. That's not too high a total for the end result I'm aiming for but if I can get it lower I will.

vram-wise it's very efficient. The table-bed uses the only actual texture, which is a 512x1024 for the table markings. The current version of it pixellates unacceptably at lower resolutions when viewed from the close cam positions that will be used in lining up a shot, but I think I can remake it and come up with a version which I can make work at 256x512. Everything else is blank textures and advanced lighting.
Da5id Weatherwax is offline   Reply With Quote
2 Users Like This:
Old 02-08-2018, 07:34 AM   #5 (permalink)
Ginger Supremacist
 
Ramen Jedburgh's Avatar
Heya ^_^
 
Join Date: Apr 2010
Location: Illinois, USA
Posts: 6,854
My Mood:
SL Join Date: 3/9/2006
Client: Firestorm
Man, thats really cool.

I wouldn't even know where to start on something like this.
__________________
--
Ramen Jedburgh

http://allaroundthegrid.blogspot.com/
Ramen Jedburgh is offline   Reply With Quote
1 User Said Thanks:
2 Users Agreed:
Old 02-08-2018, 09:28 AM   #6 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Quote:
Originally Posted by Ramen Jedburgh View Post
Man, thats really cool.

I wouldn't even know where to start on something like this.
well, to be honest, I'm hoping a lot of the hard work around "where to start" has already been done for me by the guys who coded the Havok physics engine. They've put in the hard work making objects collide and roll across surfaces, added the features that lets those collisions be modified by specifying how heavy, springy and elastic the objects are and the means to give an object a precisely defined push in a given direction... The goal here is to make the table playable with only SLs built-in physics, although I am pretty certain I'll have to cheat a bit when it comes to putting spin on the cue ball. My current testing is at the stage of "grabbing" the cue ball with the cursor and rolling it across the table with the only scripts involved being quick and dirty testers that let me give chat commands to change the physics params of the balls, the cushions and the table bed. I'll make a game HUD that allows precise cueing after I know the table mechanics can be made to work
Da5id Weatherwax is offline   Reply With Quote
Old 02-08-2018, 09:39 AM   #7 (permalink)
Ginger Supremacist
 
Ramen Jedburgh's Avatar
Heya ^_^
 
Join Date: Apr 2010
Location: Illinois, USA
Posts: 6,854
My Mood:
SL Join Date: 3/9/2006
Client: Firestorm
So is there a way to do things like, keep the balls on the table?

I sometimes play with the SL physics, but it often ends up with bits flying off into space after the whole thing mysteriously vibrates itself violently.
Ramen Jedburgh is offline   Reply With Quote
Old 02-08-2018, 11:08 AM   #8 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Quote:
Originally Posted by Ramen Jedburgh View Post
So is there a way to do things like, keep the balls on the table?

I sometimes play with the SL physics, but it often ends up with bits flying off into space after the whole thing mysteriously vibrates itself violently.
So far, once the ball is actually resting on the table surface, that hasn't been an issue in my testing. The balls are all the same size, regulation 2 and 1/16 inches, so when they contact the vector of any rebounding force will be horizontal. Similarly the cushion noses are at regulation height from the table bed and so will not produce an upward collision vector from any contact. These factors on their own should keep the balls on the table. However, as a safety factor, I will be building in code to the scripts in the balls to detect any +z component of their velocity vector and both zero it out and return the ball to resting on the table bed. The scripts monitoring of this will be cycling faster than the sims "physics frames" and so should preempt any balls bouncing off the table.

ETA: Oh, and... the table will "know" where its boundaries are. Any ball going beyond those will get a RegionSay command to die and the logic will score a ball leaving the table accordingly, a foul, and if the ball that "bounced off" is not a red, respot (re-rez) it.

Last edited by Da5id Weatherwax; 02-08-2018 at 11:25 AM.
Da5id Weatherwax is offline   Reply With Quote
1 User Said Thanks:
Old 02-08-2018, 02:05 PM   #9 (permalink)
I don't do stupid.
 
Lance Corrimal's Avatar
mean old man
 
Join Date: Feb 2010
Posts: 2,426
My Mood:
SL Join Date: 2006-06-09
Business: My!
Client: Dolphin Viewer 3
Send a message via Yahoo to Lance Corrimal
I'll take one.
Lance Corrimal is offline   Reply With Quote
3 Users Agreed:
Old 02-08-2018, 02:27 PM   #10 (permalink)
Cookie stealer
 
Ranae Quinn's Avatar
Echo Amarante
 
Join Date: Aug 2014
Location: Nottingham, England
Posts: 347
My Mood:
SL Join Date: 06/09/2005
Client: Firestorm
i want the balls to be able to leave the table..... spot a blingy person dancing on the dance floor take aim with the pool cue and take them out with the 8 ball to the forehead
Ranae Quinn is offline   Reply With Quote
2 Users Laughed:
Old 02-08-2018, 02:34 PM   #11 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
I thought folks might be a little leery from me saying this....

Quote:
Originally Posted by Da5id Weatherwax View Post
...vram-wise it's very efficient. The table-bed uses the only actual texture, which is a 512x1024 for the table markings ... Everything else is blank textures and advanced lighting.
So... To demo how it looks at different graphics presets with such a "minimalist plus code", here's an ani-gif composed of snapshots from the official viewer at different graphics presets.

Da5id Weatherwax is offline   Reply With Quote
1 User Likes This:
Old 02-08-2018, 02:44 PM   #12 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Quote:
Originally Posted by Ranae Quinn View Post
i want the balls to be able to leave the table..... spot a blingy person dancing on the dance floor take aim with the pool cue and take them out with the 8 ball to the forehead
*adopts snooty viewpoint, aiming the nostrils at Ranae* Trick shots are not employed by gentlemen, Madam!
Da5id Weatherwax is offline   Reply With Quote
2 Users Said Awww!:
1 User Laughed:
Old 02-08-2018, 03:00 PM   #13 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Quote:
1 User Said Awww: Ranae Quinn
I know, I'm sorry.. but since the balls are physical you can always pick it up and throw it to bean the blingtard.. you just have to take the 4 (or more) points penalty for the foul
Da5id Weatherwax is offline   Reply With Quote
1 User Laughed:
Old 02-08-2018, 03:13 PM   #14 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Grrrr.. There is still a "collision gap" on the cushions. It's small, but it's still enough to close off the mouth of pockets and make a ball not go in. I wish I could visualize it somehow, rendering physics metadata just shows the prim surfaces, the broader "collision zone" doesn't show. Hackage will now ensue. Please avoid the mesh sandbox that I play in on the beta grid unless you are comfortable with your face melting
Da5id Weatherwax is offline   Reply With Quote
Old 02-08-2018, 03:15 PM   #15 (permalink)
Senior Member
 
Wanda Belinda's Avatar
 
Join Date: Oct 2016
Posts: 3,421
Quote:
Originally Posted by Ranae Quinn View Post
i want the balls to be able to leave the table..... spot a blingy person dancing on the dance floor take aim with the pool cue and take them out with the 8 ball to the forehead
I want it to be able to amazing pool shots like this one.

Wanda Belinda is offline   Reply With Quote
2 Users Laughed:
Old 02-14-2018, 06:52 AM   #16 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Well, I got the LI (not including balls) down to 15, the size of its single texture down to 256x512. I'm encountering some testing issues that suggest I'm going to need to do a few further tweaks to the "bits that can collide" - they need to be "physically thick" enough that a moving ball can't pass completely through them between physics frames while moving at 12m/sec, which is roughly the speed of a firmly-struck billiard ball (and therefore tentatively set as the max possible speed of the cue ball when you take a shot - Havok's internal damping will ensure that no ball ever moves faster than the cue ball's initial velocity) - Which means I need to make sure that there is no horizontal path through the physics of those table components less than 26 cm in length, since at zero time dilation the physics engine cycles at 45 frames/sec.

I've also determined that if this "just to see if I can" project ever ends up on the MP, I'll be putting two versions of the table in the box. One as it is now, exactly 1:1 scale for a regulation 12-foot table - table dimensions, ball size, pocket profile, everything. The second will be identical but everything scaled up by the same factor as applies between "shape editor height" and "height measured by prims" - I WONT be making a version that "fits" the misproportioned default giants, but with one version or another, any av that has a "realistic" height by either method will find one version to be roughly in proportion to them. It will be mod-perm, of course, but since any resizing will profoundly break it (the positions at which to rez balls will no longer match the values stored in the scripts) and the doco will seriously emphasize that, putting these two versions in where I've done the resizing and adjusted the scripts accordingly seems like a fair compromise. If used in a faithfully prim-scale build the 1:1 one will fit exactly and the other one will work well for slightly larger-scale builds which still at least give a nod to realistic dimensions while being large enough to not look ridiculously tiny in "stupid default scale" environments.
Da5id Weatherwax is offline   Reply With Quote
1 User Said Yay!:
Old 02-19-2018, 06:46 AM   #17 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
In between coding on the game HUD and working out various ways to present accurate cueing I've been doing a lot of testing on physics materials, building test rigs and bouncing billiard ball prims all over the beta grid sandboxes. Needless to say, as I probe deeper and deeper into the integrity of the physics simulation Havok can achieve I'm accumulating a lot of notes.

Perhaps the most serious thing I have to wrestle with, from a LSL perspective, is how Havok deals with sliding friction and rolling resistance. Havok objects have a single "friction" property and the example code in Havok's own documentation shows that it is expected to be dynamically set to represent both sliding friction when an object either wouldn't roll or is close to at rest or rolling resistance when it can roll and is in motion. Theoretically this is quite possible to achieve in LSL with a llSetPhysicsMaterial() call but I've discovered that it errors out when called from members of a linkset. This is probably from the same root cause that results in changes to the physics properties of a child prim using the in-world editor with "edit linked" set silently failing. Oddly enough, the LL presets, "wood", "metal", "stone" etc. do seem to work exactly as documented. They obviously received greater testing, earlier in development, than the lower level manipulation method. This has caused me to suspect that the numbers reported for child prims which were set *before* being added to the linkset may not be reliable or may not properly persist. I'm devising a set of tests that will demonstrate conclusively whether or not this is as broken as it could be, or if it's not quite that bad how I need to work around it.

I'm running into issues with the built in damping of collisions in Havok too. With real-world numbers the cushions just aren't "springy" enough, which is annoying and another indication that something isn't quite right under the hood since ball-on-ball collisions work very well and realistically with real-world numbers for their properties.

If the worst comes to the worst, I can probably make the table rez "differently physical bits" invisibly where it needs them as separate objects not as members of the linkset but that will start pushing the LI up again. It's also got the whole can of worms about making sure the invisible-and-unlinked parts don't end up left behind if the table is moved or deleted but I've got that to deal with anyway for the ball-detector prims lurking in the pockets - those have to use volumeDetect, which is an object property not a prim property so they have to be rezzed by the table as a separate object
Da5id Weatherwax is offline   Reply With Quote
Old 02-27-2018, 01:26 PM   #18 (permalink)
Senior Member
 
Nika Talaj's Avatar
 
Join Date: Sep 2007
Posts: 3,536
Of course you want to keep LI down, but if there are any tradeoffs between LI and better physics, I'd prefer better physics. 30-50 LI for me is fine for this. I recognize, though, that your customer base gets more limited the higher the LI.

/me begins to plan a futuristic bar. Dim lights, wild music, pole dancing dragons.



Keep at it, Da5id!
Nika Talaj is offline   Reply With Quote
Old 03-01-2018, 06:14 PM   #19 (permalink)
Senior Member
 
Da5id Weatherwax's Avatar
I have no status
 
Join Date: Aug 2010
Location: Edinburgh
Posts: 1,425
Business: No Escape
Client: Official, Various RCs, Marines,Firestorm - for testing stuff. BlackDragon - For everything else.
Quote:
Originally Posted by Nika Talaj View Post
Keep at it, Da5id!
I am keeping at it. Although recently I've built a lot more test jigs than anything else. Assorted bits and pieces of various shapes populated with the kind of hideous quick and dirty scripting I'd be ashamed to let within a mile of anything labeled "production."

All for the archaeologist-like patient process of brushing away the layers of dust to reveal exactly how far towards realism I can get before either Havok or LSL shits itself

ETA: I also totally take your point about "acceptable LI" but I do have to be aggressive where the table is concerned, because I've got to keep in mind that in order to play a game 22 extra will be required for the balls and obviously that number can't be reduced at all, so the only place I can save any is in the table itself and any hidden "just to make it work right" bits it rezzes. So if I set an upper limit of "50" I've got to keep the table's LI down below 28...

Last edited by Da5id Weatherwax; 03-01-2018 at 06:26 PM.
Da5id Weatherwax is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On




SEO by vBSEO