|
-
Senior Member
Ideas for animated dice in CS4?
I'm looking to animate a dice roll of an 8 sided die with custom faces on it. Would it be insane to think this could be pulled off with 8 triangular movieclips being moved and rotated together?
I have not even installed CS4 on my machine yet, but am in the planning stages of a game that uses dice and would love to have the roll animated.
If I could come up with 1 canned animation using 8 movieclips then I could preset the roll outcome by setting the faces to the right frames. Multiple dice could be done by starting them with different timings and keeping them from looking like they would 'collide'. 1 canned animation might be too repetitive, but 1 has to be feasible before I even think of making multiple.
Just wondering if this was even possible, getting multiple movieclips positioned properly and then having them all rotate/move as a group around a common center point.
As a second thought, is there some relatively easy to use free 3d flash plugins that could pull something like this off, or would a plugin just to roll dice be incredibly bloated. The game will be pretty sizable graphically already...
Has anyone tried something like this?
Thanks for any help/suggestions.
-
ism
don't do it that way. it will just chew up cpu you could use for something more important. just pre-render it.
http://users.nlc.net.au/oceana/games/m1.swf
http://www.nlc.net.au/~oceana/games/m1.zip
(click on the dice)
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
Senior Member
So pre-render 1 movie for each result of each custom die?
I will have at least 3 custom 8 sided dice, so that would be 24 little movieclips.
Found a place that showed I can for sure get the movieclips moving in concert, but it also showed that occlusion / layering will be a pain in the posterior. (and probably cpu intensive as you mentioned)
http://www.layersmagazine.com/flash-...lded-book.html
I'll have to give this some thought as to how important those animated dice are to me.
-
ism
if you look at the example the dice rolls and i just change the dots when it lands. don't get all caught up in the details you can make my dice work in about 5 seconds. get on with making a game
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
Did this in AS2 last year ... its the collisions that are difficult. Not using Flash at the moment but will try to find the movie clip.
this[MCr.i + 'm_not_ok']._lyric = "you sing the words but you don't know what they mean";
-
Senior Member
It's the details I enjoy though, I rarely get around to finishing a game, heh.
The details are also what set a good game apart from the 95% crap that gives flash a bad name.
I have flash cs4 installed now and the 3d is annoying me for sure, heh. The angles don't work out right. I am putting the parts at the right mathematical angles and they don't fit correctly. Driving me nuts. Shaping 4 equilateral triangles into a pyramid should not be hard, but 30 degree tilt from vertical does not put the points in contact. very annoying.
I've always wanted to learn some more 3d modeling since I dabbled in college, maybe this is the excuse I need.
In the meantime, Yeah, I think I will get on with the game, heh.
-
Senior Member
Heh,well helps if I use the correct angles for a triangle with equilateral faces. Maybe I'll give this another try.
-
Senior Member
I just wrote a nice dice class a couple weeks ago that rolls them with random force and random spin to predetermined numbers (this was for a Craps casino game). Unfortunately, I'm not at liberty to share the source; but I'll tell you I brought in the dice .swf by itself at 12k compiled.
Originally I was going to use away3d, but as alluded to in this thread there's a lot of CPU overhead rendering with a package like that. I opted for a semi-abandoned face-based package called Five3d (you can get it at http://five3d.mathieu-badimon.com/ ) which is not extremely fast, but is very, very lightweight. From there I wrote a piece of code that created the die faces by drawing dots in the right patterns, and placed them on simple square plane objects, set their rotations, and then made the faces child to a single centered object. The bounces were tough, and I had to get into gravity, surface bounce, air resistance and friction; and of course calculate how they were going to have to spin to land in the right place.
What I'll say is that it's possible, and you'll get much better results if you don't pre-render...
J
-
Hype over content...
Great example Blink, as always.
Alluvian take the big guys advice mate, his dice example works a treat. By the getting caught up in the details thing, it's such a valid thing to say ( Hmmm, I'm starting to sound like I want us to get a room ).
In terms of development do you think it's better to have a working game you can then apply the love to after really tightening up the gameplay, or to make your life harder right at the start and still not have a working game ?
It's common practice to build up a list of "nice to haves" during a games development that you then review at the end and add the ones that are still practical to add.
At the end of the day it's all about the game, then the love 
Squize.
-
Senior Member
The shadows do look pretty nice on Blink's example. It's a different effect.
-
n00b
Hi, I did something like this a few years a go for a boardgame-like game(GetTheGlass it was called). Was a lot of work to get it to look somewhat realistic. Here´s a not final example: http://oos.moxiecode.com/flash8/dice_test.html
But I would take Blinks and Squizes advice and keep it "simple" to begin with. "Nice to have"-lists is something I´m also used to working with...
-
Hype over content...
You worked on Get The Glass ? That's such a stunning game, the presentation is unreal.
You're one of the few devs who make me go all fan boy 
Squize.
-
Senior Member
Thanks for all the info and suggestions. I am actually messing with it mostly to play with the new CS4 features, and this is my first time touching as3 as well (not that this uses any as3).
So annoying to get so close and just NOT have it, lol.
Pretty easy to make the die, but I don't know how to solve the problem with the layering.
Tried looking at the faces (named instances face1 to face8) .z property to see which was on top and use that to re-order things, but the .z is relative to the movieclip with the geometry in it, not the movieclip where I am rotating the die.
If anyone felt like goofing off with it (which is really what I am doing) here are the files.
http://www.thebrasse.com/flash/dice experiments.swf
http://www.thebrasse.com/flash/dice experiments.fla
Last edited by Alluvian; 05-20-2009 at 09:33 PM.
-
Hey there - another noob question, I guess, and I'm really sorry, if this is considered hijacking a post, but after looking at BlinkOK's example - I'm more lost now than ever before.
I understand that he's pre-rendered the dots and that they come up in the final frame in the animation, but I just can't see how he calls the frame he needs from the dice face onto the dice. Would you mind filling me in?
-
ism
it's a bit convoluted;
in the actions for frame one of the main timeline the function rollDice() sets the variables left and right (within the dice mc) to the number of each dice. (lines 9 and 10)
then in frame 16 of the dice mc the code tells mc's l and r to gotoAndStop to frames left and right (lines 1 and 2)
does that make sense
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
So, let me get this straight (just to be sure)
your variables "l" and "r" get their values from the random numbers (I figured that out no problem).
your frames are displayed by looking at the l and r values and going to the appropriate frame in the "dice face" timeline, layer 2...
What I'm not seeing -and please forgive my naivete - is what tells the dice, layer 3, frame 16 script to look at dice face, layer 2, frame (whichever frame is called)
I'm looking for anything pointing to the "dice face" symbol, or am I wrong in looking for it in the 1st place?
btw: thanks for the quick response
-
ism
this is what the code looks like in the rollDice function;
Code:
function rollDice(d) {
var r, l, m;
r = random(6)+1;
l = random(6)+1;
dice._rotation = (currentPlayer - 1) * 90;
dice.right = r; <-----------------------------
dice.left = l; <-----------------------------
m = "p"+currentPlayer;
the lines marked with the arrow set the variables left & right, inside the dice clip, to the faces that need to be shown.
this is the code on frame 16 of the dice clip;
Code:
r.gotoAndStop(right);
l.gotoAndStop(left);
see how it is using the left and right variables to tell the l & r clips (which are the dice faces) what frame to goto.
(if you trace the left and right variables at this point you'll see that they contain the frame numbers to goto)
Graphics Attract, Motion Engages, Gameplay Addicts
XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro
-
aha! got it! you've been a real help - thanks tons!
-
 Originally Posted by BlinkOk
This is what I'm searching for. Can you please tell me if you have this or something like this in AS3?
I'm preparing my Flash game for my Practical project for Faculty.
Thank you.
-
I tried pre-rendering the dice and then using AS to just randomly select one of the pre-rendered movieclips, which was assigned to a frame number and it worked a treat. It was also very easy to do and looks pretty good IMO.
I unfortunately don't have anywhere that I can upload the file to, but if you want, I can send the file to you via e-mail or messenger to take a look at, and go through the process I used to get it to where it is.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|