4D Games: Dev-log Update 2
19 Nov 2022So... It's been a while...
Typical for me, but I kept putting off writing this dev log because the scope of the project has just been increasing. Originally I intended just to turn the challenges (matching games) from my Uni project into a more refined game. Whilst these modes will still be a part of the game, my focus over the last couple of months have been on a few new and fun other things:
- 4D Chess
- 4D Mazes
- Shader and UI improvements
- Improvements to rotation controls
Yes you read that correctly, upon release you can tell your friends that you actually play chess across the fourth dimension and have navigational skills beyond this three dimensional world!
4D Chess
To keep the game manageable the board spans 4 squares in all 4 dimensions. I considered having only a single 4\(\times\)4\(\times\)4 slice visible at a given time, grounding it in our 3 dimensional perception if a board was actually spanning the fourth dimension. However, remembering the location of every piece, and making strategic plays would be nigh impossible without being able to consistently see the board in it's entirety. Maybe I will add this in the future for you chess grand masters out there but we will have to wait and see!
In the mean time: Here is the design I settled on! What do you think?
Alongside the board, I also created some custom chess pieces. I am pretty happy with them, although I the textures need some work and I still need to tackle the knight.
4D Maze
Introducing 4D procedurally generated mazes. You can currently play mazes ranging from dimensions 3\(\times\)3\(\times\)3\(\times\)3 to 8\(\times\)8\(\times\)8\(\times\)8. The maze is restricted to \(8^8\) dimensions for performance reasons. The 4D shapes are rendered with ray marching, which at high resolutions and marching over hundreds to thousands of shapes, becomes quite expensive to compute. I am currently looking into optimisations to make this game more accessible to those of you with lower end hardware.
Here is a preview of how the maze is looking in it's current state:
You may notice the balls throughout the maze, these are visible parts of the paths traveling along the w axis. The paths along the w axis were originally the same width as all the other paths, but friends noted during some testing that they didn't like having to constantly scroll between slices of the maze to identify where they could go.
For a set of intuitive controls, I have added an interactive set of rotating axes to allow a player simple control to navigate through the maze
Main Menu Improvements
With the introduction of two new games, the main menu has been updated with a 4D pawn and a maze serving as part of the animated background for their respective games!
Arcball Rotation
It's a shock when all those papers you needed to cite for your university dissertation to fluff it up actually come in handy!
The match games and playground mode previously mapped the mouse being dragged along the screen to the X and Y axes. Makes sense right? But how to do a rotation focussed around the Z axis? Through this method you are limited to at most two degrees of rotation at a given time using a single input. I approached this originally by mapping the Z key to the XY plane of rotation, meaning you could only control this rotation by holding a key down, introducing complexity, by enforcing secondary inputs at a single time.
Arcball rotation essentially works by projecting the mouse position onto a sphere, and rotates from an initial position on the sphere to an end position on the sphere. If the mouse is outside of the bounds of the sphere, it is projected onto the rim of the sphere.
With the introduction of a 4D rotor-based version of the Arcball (Shoemake 1994), 3 degrees of freedom can be controlled at a time from a single input, making for a reportedly more intuitive experience. The game will still offer the old linear input system for those that prefer it.
Next Timeā¦
So that's everything for this update! There is a ton of other stuff going on behind the scenes but it is a bit less interesting. I am currently working on getting the match games up and running, as well as making improvements to the ray marching shaders. I also aiming to get the UI in a more polished prototype state, so look forward to that!