Suggestions Sought on Die/Dice Problem
|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
07-30-2008 08:01
I have a game in which the players take turns to roll a Die or Dice then act upon the resulting value/s. I need suggestions as to how to present the event to the player/s and what visible presentation should be made of the Die or Dice rolling. It has been suggested that a Die or Dice in the form of cubes above the playing area should when clicked spin/rotate/or whatever and then stop on the resulting face. The problem then is that different faces will be seen by different players. How do you suggest I do this.
|
Pedro McMillan
SLOODLE Developer
Join date: 28 Jul 2007
Posts: 231
|
07-30-2008 08:35
In theory, it should be possible to script physical cubes to act like dice, so that they can actually be rolled, and when they come to rest, they notify the rest of the game which side is facing up. To avoid problems, it might be best to have a kind of 'auto-roll' feature, so you just touch the cube, it makes itself temporarily physical, and applies a random impulse to itself. When it stops, it disables the physical attribute to prevent accidental nudges.
I imagine it would be prone to bugs, and you'd have to program it against rolling too far away, but it would be very cool if it worked.
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
07-30-2008 08:38
From: Gregory McLeod It has been suggested that a Die or Dice in the form of cubes above the playing area should when clicked spin/rotate/or whatever and then stop on the resulting face. The problem then is that different faces will be seen by different players. As with RL dice, hence only the "top" faces, visible to all players, are considered to be the selected value. However, you could do it with flat panels and apply an animated texture which, each time triggered, would run at a randomly-selected rate for a randomly-selected interval (both within specified boundaries) to determine the randomized value(s).
|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
07-30-2008 14:40
From: Deanna Trollop As with RL dice, hence only the "top" faces, visible to all players, are considered to be the selected value.
However, you could do it with flat panels and apply an animated texture which, each time triggered, would run at a randomly-selected rate for a randomly-selected interval (both within specified boundaries) to determine the randomized value(s). I am interested in your **animated texture** comment. Can you explain a little more I have never heard of animation applied to textures.
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
07-30-2008 21:51
its just a texture with all the frames of the animation on it, like a spritesheet you can just make the 6 die faces and slide tru them all, and stop the animation on the predetermined result (kinda like slingo) http://cheesefactory.us/lslwm/llSetTextureAnim.htm
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
07-30-2008 22:03
An animated texture in SL is simply a texture which consists of the "frames" of an animation, so many wide by so many high, which are "played" sequentially my manipulating the repeats and offsets of a prim face. The advantage of this method is that the effect is entirely client-side. The server (sim) sends a command to the clients to begin the animation and the server is done communicating updates. The disadvantage of this method is that it is entirely client-side, so guaranteeing synchronicity from one client to the next is a bit tricky. If we're talking about a game where all players will remain in one place for the duration, then it shouldn't be a problem, as they should all reiceve animation commands at roughly the same time, as opposed to avs wandering in and out of draw distance of the object in question randomly. See  for details.
|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
07-31-2008 01:19
From: Osgeld Barmy its just a texture with all the frames of the animation on it, like a spritesheet you can just make the 6 die faces and slide tru them all, and stop the animation on the predetermined result (kinda like slingo) http://cheesefactory.us/lslwm/llSetTextureAnim.htmThanks for that pointer to yet another LSLWiki. What is a spritesheet? and see below. From: Deanna Trollop An animated texture in SL is simply a texture which consists of the "frames" of an animation, so many wide by so many high, which are "played" sequentially my manipulating the repeats and offsets of a prim face. The advantage of this method is that the effect is entirely client-side. The server (sim) sends a command to the clients to begin the animation and the server is done communicating updates. The disadvantage of this method is that it is entirely client-side, so guaranteeing synchronicity from one client to the next is a bit tricky. If we're talking about a game where all players will remain in one place for the duration, then it shouldn't be a problem, as they should all reiceve animation commands at roughly the same time, as opposed to avs wandering in and out of draw distance of the object in question randomly. See  for details. Thanks for the information. What is as yet unclear to me is how the texture frames are constructed. How do you get them in to the format required? I can make the faces as individual textures in PSP but what format should they be in six cubes adjacent 1 2 3 4 5 6 or in the unfolded shape of a cube. 2 3 1 5 6 4 where can I get details of this?
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
07-31-2008 09:02
From: Gregory McLeod what format should they be in six cubes adjacent 1 2 3 4 5 6 That would work, as would 1 2 3 4 5 6 or 1 2 3 4 5 6 or even 1 2 3 4 5 6 Since you pass the number of frames wide and tall the texture is, which frame to start on and how many total frames to play to llSetTextureAnim, you can arrange them in any raster layout (rows read left-to-right, top-to-bottom) you'd like.
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-31-2008 12:12
From: Pedro McMillan In theory, it should be possible to script physical cubes to act like dice, so that they can actually be rolled, and when they come to rest, they notify the rest of the game which side is facing up. To avoid problems, it might be best to have a kind of 'auto-roll' feature, so you just touch the cube, it makes itself temporarily physical, and applies a random impulse to itself. When it stops, it disables the physical attribute to prevent accidental nudges.
I imagine it would be prone to bugs, and you'd have to program it against rolling too far away, but it would be very cool if it worked. I did dice like that a long time ago. Unfortunately it didn't work so well, so what I wound up doing was giving the random rotational impulse, but also generating a random face number and setting the rotation so that face was up once the dice landed, which was both functionally and visually fine. It might work better now that we have Havok 4, or maybe with larger dice (mine were just a centimeter or two across, similar in scale to most real dice).
|
Gregory McLeod
Registered User
Join date: 21 Oct 2006
Posts: 278
|
07-31-2008 13:20
Thanks for your input the more suggestions I get the better chance I have of getting it right. I don't want to put a lot of effort into it and end up with something naff. The suggestion above about the animated textures is interesting mainly because I have never done it before but the caveat about it being client side is a draw back.
|