Cube puzzle integration.

Help bring our custom Ages to life! Share tips and tricks, as well as code samples with other developers.

Cube puzzle integration.

Postby Grogyan » Wed Jan 09, 2008 10:15 pm

I have an idea, not sure if i'll implement it when animations are implemented.

The idea is a simple Rubiks cube puzzle, and seen a physical puzzle available in shops, we all know the famous 3 x 3 puzzle cube, but I have never been able to solve it, but I could solve a 2 x 2 puzzle.

Using this idea as an example, how would one attempt to code it?

I know its an XY type puzzle with UV axes for rotating the whole cube.


I don't know much about Python, but I do have a book on learning it, but as with everything, I need a real world reason to make/code it, a puzzle like this is a good starting point for all I think.
Last edited by Grogyan on Sun Jan 13, 2008 9:45 pm, edited 1 time in total.
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Simple puzzle integration.

Postby belford » Thu Jan 10, 2008 12:21 pm

You could actually implement it without animations. Animations are going to be icing on the cake here, because what you really want to do is implement a cube with faces that change color. And then write code that changes the face colors according to the rules of Rubik cube rotation.

Then, when animations work, you'd have an animation that rotates a slice of the cube by 90 degrees... and then *snaps it back* at the same time that the face colors change. So it would *look* like a smooth rotation.

(I think this snapping-back idea is the way to go. Accumulating rotations might be possible, but I don't recommend it, because it would be very hard for the code -- the Age -- to decide when the puzzle is solved. If you base the puzzle on changing face colors, you can pretty easily write a test to determine if each face is a constant color.)

I'm not going to try to give you code, because I haven't sat down to work through the Plasma world-state system. But you'd basically have an object with 24 fields, corresponding to the 24 tiles of a 2x2x2 cube. Each one would control the texture of one polygon of the cube.
belford
 
Posts: 344
Joined: Sat Sep 29, 2007 7:18 pm

Re: Simple puzzle integration.

Postby Aloys » Thu Jan 10, 2008 2:55 pm

Personally I'd just simplify the problem and make the cube 1x1. :D
User avatar
Aloys
 
Posts: 1968
Joined: Sun Oct 21, 2007 7:57 pm
Location: France (GMT +1)

Re: Simple puzzle integration.

Postby Goofy » Fri Jan 11, 2008 8:36 am

heh I was thinking the same thing grogyan at one time, but with my time constraints I kinda didn't get far. I did do a google search about it and found this though.

http://www.youtube.com/watch?v=ITxSBc3apKc

And this is him explaining how he did it in 3dsmax.

http://www.youtube.com/watch?v=L7o_RRC4mqU&feature=user


and this one as well. http://www.youtube.com/watch?v=qgf_iy38Q0w&feature=related

Was rather simple when he explained it and I was think within the same idea, but I'm not sure if it can be done with blender like he did it in max. There is a algorithm that can be used to solve a rubix cube.
We keep moving forward,
openning up new doors and doing new things,
Because we're curious... and curiosity keeps
leading us down new paths

Walt Disney

Keep moving forward
Goofy
 
Posts: 162
Joined: Mon Oct 01, 2007 8:51 pm

Re: Simple puzzle integration.

Postby Grogyan » Sat Jan 12, 2008 3:37 am

Thats neat, but useless unfortunately, its based on 3D Max.

I can make a set of cubes like they suggested, thats easy, but assigning them as moveable/rotating objects within the scope of Uru as a puzzle, that I don't know, nor is there any tutorial to follow, puzzle, gui's.
What side of the cube to show as front, what the expected condition is and so on.

To my knowledge the only person to have a functioning puzzle is RtR in his Shell, and I doubt Rob will tell us how he did it.
Better to have loved and lost than never to have loved at all
User avatar
Grogyan
 
Posts: 1203
Joined: Thu Oct 11, 2007 1:27 am

Re: Simple puzzle integration.

Postby D'Lanor » Sat Jan 12, 2008 5:46 am

Grogyan wrote:To my knowledge the only person to have a functioning puzzle is RtR in his Shell, and I doubt Rob will tell us how he did it.

I guess you must not have played many user ages because quite a few of them have puzzles. The german team has made several advanced puzzles. And there was MercAngel's Maze which would create different mazes by the press of a button.

IMO the best way to make this type of puzzle is using conditional objects. You could make different objects representing different rotation states of the cubes and show/hide them as needed. That will be a lot of objects (but not nearly as many as the maze had).

Using SDL variables also has the advantage that the current puzzle state will be immediately saved to the age state. So you will not have to restart the puzzle each time you return and in a multiplayer environment new arrivals can receive the current state as they link in.

And as belford said, animations could be the icing on the cake which can be added later once PyPRP supports them. btw, Robert must have used a Python animation using a timer.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Simple puzzle integration.

Postby Trylon » Sat Jan 12, 2008 6:04 am

The new interface should support any type of SDL cyan has implemented btw.
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: Simple puzzle integration.

Postby D'Lanor » Sat Jan 12, 2008 6:32 am

Trylon wrote:The new interface should support any type of SDL cyan has implemented btw.

Ok, thanks. But let it be noted that we can do that already without PyPRP.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Simple puzzle integration.

Postby Trylon » Sat Jan 12, 2008 6:36 am

Knew that. :P
One day I ran through the cleft for the fiftieth time, and found that uru held no peace for me anymore.
User avatar
Trylon
 
Posts: 1446
Joined: Fri Sep 28, 2007 11:08 pm
Location: Gone from Uru

Re: Simple puzzle integration.

Postby belford » Sat Jan 12, 2008 9:59 am

Unfortunately the number of rotational states of a cube -- even 2x2x2 -- is kind of enormous. Maybe 120960? Probably some of those are unreachable, so it might be a third or a sixth of that, but it's still too big to create one of each.

You *could* create 24 face squares, each in six colors, which is 144 square objects, which is within reason. But I still think you'll be happier if you create 24 objects and then figure out how to change the displayed texture of each one.
belford
 
Posts: 344
Joined: Sat Sep 29, 2007 7:18 pm

Next

Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests