I am not asking for someone to program this for me, I still would like to do all the programming, however I need some additional mathematical programming background for this kind of stuff because I haven't really dabbled into 3D spaces much and I am thinking lots of potential if-thens and switches could be simplified way down if I think of this concept the right way. I will be using a programming language that supports 2D tiled or text screen  output (think Java). I want to know if there are simple ways to program in the viewing, orienting and moving about this virtual space I am about to describe without resorting to lots of switch statements to control i.e. what the screen will be displaying depending on the PC's location, facing direction and rotation.Okay so far I am working out concepts of a way to explore a 3D top-down maze type environment with a procedurally generated voxel landscape and a 1x1x1 player character which can view only the eye level plane and the plane 1 unit below it. the PC can move in the following ways; Please note I intend whichever way the PC considers down to be which direction gravity is acting upon it, (unrealistic):Walk forward to another square unobstructed by a wall or cliffTurn the face another direction, in which case a different direction becomes the PC's forward face (visually). The PC will always appear to be facing up for the user.Start scaling a wall, in which case the previously upward direction (out of the screen, towards the user) becomes forward.Climb down and scale the wall of a pit below, in which case the previously down direction become forward.Flip upside down and tether off the now ceiling, scaling up or down the tether until the PC hits a floor. in which case it can choose other transportation modes again.Each time the PC moves, all other entities get their chance to move in a turn based fashion.This won't be like a Minecraft-esque sandbox, so editing the landscape after generation won't be likely necessary. I will have a screen that views 16x16x2 voxels at a time. I do however like the idea of dynamically allocated chunks. I plan on generating or loading previously generated 16x16x16 chunks of voxels and the adjacent 26 chunks as needed. while unloading out of range chunks and saving them to a file. I want to know the mathematical/conceptual ideas behind generating these chunks and loading already generated chunks. Note I still use the term voxel even though I will only view them as squares on a text screen, because the game space is a 3D grid.
3D tiled space viewed one plane at a time; general concepts to understand while programming this?
design
There will be 24 different orientations for your character. So you definitely don't want to go with if/then/else statements. If you describe your character orientation as a 3x3 matrix (consisting of 0, 1 and -1) then each type of turn is achieved by multiplying that matrix by a rotation matrix (also 0,1&-1).The orientation matrixConsider a positive orthonormal axis system X'Y'Z', describing the orientation of your character in your 3D world. Typically, X' would point to the characters right. Y' would point upwards (from the characters perspective) and Z' would point backwards. (forward would seem more logical, but that would not be a right-handed system.) These 3 vectors make up the columns of the 3x3 orientation matrix.Note that you still have to keep track of the characters position separately.RotationsWhenever the character makes a turn, its orientation matrix changes. This can be achieved through rotation matrices. To perform the rotation, you multiply the rotation matrix it with a vector, or in this case with the entire orientation matrix:NewOrientationMatrix = RotationMatrix * OldOrientationMatrixTo describe all possible 90 degree rotations around main axes X, Y and Z, you need 6 rotation matrices.eg. A 90 degree rotation around the Z axis, clockwise when looking against the positive Z direction, would be:0 -1  01  0  00  0  1Note that these rotation matrices are specified in absolute space (XYZ), not in X'Y'Z'.Transform to the Characters ViewpointSuppose you have a point in 3D space, and you want to know where this point lies, relative to your character:First you subtract the characters position:point - charactersPositionNow, you want to decompose this vector to X', Y' and Z' components. For that you multiply with the inverse (which is in this case the transpose) of your orientation matrix:relativePoint = Transpose(OrientationMatrix) * (point - charactersPosition)Eg. If the result is (3,0,-1) then this point lies 3 units to the characters right, one unit forward and same height.