File Size: 1.87 MB
Downloads: 238
Rating: (1 votes)
Description
I stopped to wonder one day, "Can I make a Rubik's Cube in Portal 2?". I soon decided that yes, yes I could, and after a great deal of logic work, here I am. The level's a bit crude but after all this isn't about the level, it's a about a fully functioning, fully solvable Rubik's Cube in Portal 2. Let me know what you think!
Comments
Sign in to comment.
nice work, awesome to see that you got it working!
for you!
I did miss move-all-except-for-one-layer; moving the other layer is indeed pretty much the same, but I just like to keep one face at one side of the cube
. But yea, amazing work!
Nice job!
Maybe this could be used in a map with two different solutions some day. One would be the hardcore way: Solving the cube. The other way would lead through a lot of other puzzles, maybe less brain- but fling-reflex-related, allowing the player to start a machine that auto-solves the cube for him.
I'm obviously mentioning the second way because I fear I would never ever finish that thing on my own. 
that would be a really neat way of doing it, the only problem with the cube is that to make it usable as a "solution" would take another 5 or 600 more logics than I've already used in making it initially.
These are the logics that were required to get the cube working, over 1000 logics with over 6000 commands. This was no simple task.
Jexim wrote:
that would be a really neat way of doing it, the only problem with the cube is that to make it usable as a "solution" would take another 5 or 600 more logics than I've already used in making it initially.These are the logics that were required to get the cube working, over 1000 logics with over 6000 commands. This was no simple task.

Jexim wrote:
that would be a really neat way of doing it, the only problem with the cube is that to make it usable as a "solution" would take another 5 or 600 more logics than I've already used in making it initially.These are the logics that were required to get the cube working, over 1000 logics with over 6000 commands. This was no simple task.

I don't know how to solve a Rubiks cube. But it looked really good. I would need a solve for me button right in the middle under the cube.
I was just jumping around and I fell in the goo/water. No kill trigger or a way out unless you noclip just in case you didn't know. Nice job though!
Yea, that was actually intended, I was gonna put one in, then thought, the main reason anyone would jump into the water here would be a frustrated suicide, so I just left it out as a joke on them, lol.
I made a rubiks cube in HL2 Deathmatch once. It looked like this:
rubiks1.jpg
Where's all the logic? Triggers and brushes my friend.
I'd be interested in a quick explanation on how it's done with them, I sat and thought for awhile before deciding on using logics, I couldn't think of another way.
I also thought about if for a while:
1) Since you cannot rotate the cube itself the centers are in a fixed position.
2) Since the centers are in the middle the solution is fixed. (because you already know where each piece has to be.
3) Since you already know where all the pieces have to be you only need to check 17 positions: Front plane (9) Back plane (9) and 5 for the pieces in between. MINUS the 6 centers that are in a fixed position. I just realized.
4) you also need to keep track of the orientation of course. I'd probably use two math counters for it: turn forward +1; turn backwards:-1 min -4; max 4 onhitmax !self setvalue 0. So now I'm at 17+34=51 logics.
4) Then I would have a math_counter that's called ?ber counter that is the sum of the absolute value of all math_counters. TBH I don't know if absolute values are supported in default logic; it could be possible a custom logic needs to be written for this. If that is the case we have two add 2 logics; otherwise we'd add 1.
It needs to be absolute values so fake 0's: a point where there are as much +'s as -'s don't trigger the solution. If they do that and the pieces are on the correct location a messed up orientation will still count as solved.
5) Finally I'd add a relay that is fired when all ?ber_counter hits 0 to check the positions. That'd be around 55 entities
EDIT: Fixed a couple small errors and explained it a bit more.
I had considered it that way too, problem is, when the cube rotates a face AWAY from it's original side the math counters would be thrown off, and then, the only way to keep track of the faces and to maintain a logic branch of true and false for EACH position it COULD be in, While maintaining a set of logics for the solution would be a math counter, it would still require a set of logics (24, for the number of different positions they could possibly be in) for each of those 20 (I could do 8 front, 8 back, and 4 for the edges inbetween) which is a result of 480, just to monitor position, double that to account for clockwise/counterclockwise turns, and add in the actual solution logics, it's about 1000, is the lowest number I can come up with for an actual solution trigger.
I could be going about this all wrong, and if I am, I'd love to know it, cuz that's just way too much work to go through again any time soon, lol
lpfreaky90 wrote:
Insert long and smart explanation here
![]()
I hate to say it, but there is a much easier way than to rack your mind full of maths. When I was trying to make one, at first I thought I had to create a million different entities for every possible solution, the I realised that individual cube can be dynamic, so the RedYellowBlue side once turned downwards one (Red top side, blue Right) will then become the OrangeYellowBlue piece. When turned again the original RedYellowBlue is now BlueOrangeWhite.
rubiksness.jpg /rubiksCubeNerdSpeech EDIT: Of course this would be much easier with scripting, but the only scripts then was .lua. And I was no expert.ok, so I get how you made it now, and agree that this is a MUCH simpler way of making a cube in general, but my problem is that I want the cube to be a solution to a puzzle, I want a door to open when I finish the cube, and with your method, the cube just thinks it's in position A after every turn, which, again is a MUCH easier way to make a cube for us to play with, but my method would be required in order for a door to open on completion, correct? or am I still over complicating things?
Jexim wrote:
ok, so I get how you made it now, and agree that this is a MUCH simpler way of making a cube in general, but my problem is that I want the cube to be a solution to a puzzle, I want a door to open when I finish the cube, and with your method, the cube just thinks it's in position A after every turn, which, again is a MUCH easier way to make a cube for us to play with, but my method would be required in order for a door to open on completion, correct? or am I still over complicating things?
This makes complete sense, however 99% of the population do not know how to solve a rubiks cube. I suggest making a 2x2 cube as the puzzle instead of a 3x3 one.
For making this happen, try creating a move-check system, where (again) you will have brushes parented to the main cube which will have filters which will only activate when the original cube is in its' proximity. Using a number of logic_branches and a logic_branch listener (or a math_counter), when all cubes are in correct place it will finish.
Only problem:
The cube can be in the correct place but the faces can be rotated in the wrong position. Therefore I suggest having 3 brushes* which interact with triggers to determine whether or not it is in the correct position AND correct rotation.
chickenmobile wrote:
lpfreaky90 wrote:
Insert long and smart explanation here
![]()
I hate to say it, but there is a much easier way than to rack your mind full of maths.
Yes, usually the easiest solution is the best but I'm too much poisoned with math I'm afraid 
Jexim wrote:
I had considered it that way too, problem is, when the cube rotates a face AWAY from it's original side the math counters would be thrown off
Hmz...
chickenmobile wrote:
I am really curious at how to do it now and I feel like making it... :S
Same 
I liked the idea that someone gave me earlier about having it be a, SOLVE THIS CUBE... OR go do this long string of somethings that would take an equivalent amount of time in order to open the same door instead, something I'm probably gonna use in an upcoming map pack I'm working on now.
and chicken, what you're describing is very similar to my current method, just docking it down to a 2x2, which would involve a great number less logics, I could, in theory, create a 2x2 by simply stealing all my corner logics from what I have now and voila, 2x2, and again logics for atleas 8 of the faces would be necesary in order to keep track of where they're at at any given time.
and btw, I LOVE your drawings, lol
Edit: I finally added a vid of my solve of my rubik's cube to the original post, it's super fast or anything but I'd been meaning to make it.
Two? I can't tell if you're serious or trolling... I could make two pretty quickly now that I have the ground work laid...
I would like to point out that I actually make a working rubiks cube (2x2) that wins when the faces are in the right places.
I want to add more buttons now so you can actually turn the whole cube around. Will upload soon (prehaps as an instance?)
cool, how many total logics did you end up having to use? and what kind of textures did you use for the faces?
Jexim wrote:
cool, how many total logics did you end up having to use? and what kind of textures did you use for the faces?
'Logics' = script. There is one branch and filter per cube. (for each checking thing). I'm going to send it through pm once I'm done fiddling.
.
this is great you should be able to turn the middle slices cuz thats in some of my algorthms but good job since i know how to solve the rubik's cube not sure about anyone else here but its good to have a real cuber respond am i right? and you should add 3 things
1. reset button
2. congratulations at the end
3. MORE CUBES such as 2x2x2 4x4x4 5x5x5 6x6x6 7x7x7 and maybe even something like a 3x4x5 but those will be hard if the 3x3 was hard to make so its a suggestion not really an ADD
chickenmobile wrote:
Jexim wrote:cool, how many total logics did you end up having to use? and what kind of textures did you use for the faces?
'Logics' = script. There is one branch and filter per cube. (for each checking thing). I'm going to send it through pm once I'm done fiddling.
.
If it works, would you post it publicly? Please?
I couldn't solve the top layer.
I had to use Noclip to avoid the boringness of moving from button to button via portals.
I got motionsick.
I need a life.
That is all.
Insert long and smart explanation here
I stopped to wonder one day, "Can I make a Rubik's Cube in Portal 2?". I soon decided that yes, yes I could, and after a great deal of logic work, here I am. The level's a bit crude but after all this isn't about the level, it's a about a fully functioning, fully solvable Rubik's Cube in Portal 2. Let me know what you think!
File Name: rubiks_cube.rar
File Size: 1.87?MiB
Portal 2 - Rubik's Cube
My Solve of the Rubik's Cube in Portal 2
http://www.youtube.com/watch?v=adeTOL2WNCs