3-sphere explorer game

Discuss interdimensional programming, Java applets and so forth.

3-sphere explorer game

Postby filbs111 » Sun Jan 24, 2021 5:45 pm

Here's my webgl project https://filbs111.github.io/3sphere-explorer/

PC recommended. Controls don't work on mobile.

It's more a game "engine" than a game at the moment.

The main gimmick of the engine is that you fly around "inside" a 3-sphere. Basically it's similar to being constrained to a 2D world on the surface of a sphere, but +1 dimension. You're confined to a "3D" space consisting of the set of 4D points some fixed distance from a 4D origin. Because shaders as standard deal in 4-vectors, 4x4 matrices, implementation is quite neat - it's mainly just using 4-vectors for vertex properties and appropriate transformations in the vertex shader. If it runs slow on your machine it'll be because it's doing a lot more. The core rendering of this kind of space using GL doesn't require any heavy lifting.

Drawing of all regular polytopes is implemented. Currently it initially displays a 600-cell. You can toggle others. See "polytopes" menu. To see these better, you may wish to set atmosphere contrast to 0. menu: display->atmosContrast

The engine supports repeating rectangular terrains mapped onto duocylinders. This works out neatly - you don't have to worry about the player flying off the map, or invisible walls, and can use a simple tiles for map editing. Many older games have repeating square maps, that I remember fondly. For example Virus/Zarch, Zeewolf, V2000. The duocylinders can be spun, like an O'Neill cylinder, to create gravity. You can switch terrain options in menu: drawShapes:world0/1

The secondary gimmick is spherical portals, joining different 3-sphere worlds together. Currently engine only has one per world, so limit of 2 worlds, but plan to permit 3 portals per world so can have a web of worlds.

The player controls are probably too complicated at the moment. Click and drag on screen to rotate, or tap 'f' to go fullscreen so mouse rotates spaceship directly. WASD, \, space move spaceship. Or you can use a gamepad.

TODO list includes performance and graphics improvements, Collision, restitution mechanics, more vehicles, gameplay objectives. Improved terrain, map editor.

I should put together better instructions or tutorial video, but another day. Have a go if you want!
filbs111
Mononian
 
Posts: 6
Joined: Sun Jan 24, 2021 5:17 pm

Re: 3-sphere explorer game

Postby PatrickPowers » Wed Jul 21, 2021 4:06 am

Nicely done. The 600-cell looks dramatic. Though it took me a while to figure out what WASD was. The space bar makes the ship go kata/down. What makes it go ana/upward?

I couldn't figure out what the mist meant. If I'm traveling on geodesics of the surface a 4-sphere then doesn't the space look pretty much the same everywhere? Going around the sphere means you get back to where you were.

I have ideas on how to get all four dimensions into the display, but hesitate to suggest that much work.
PatrickPowers
Tetronian
 
Posts: 440
Joined: Wed Dec 02, 2015 1:36 am

Re: 3-sphere explorer game

Postby filbs111 » Fri Jul 30, 2021 12:32 pm

Thanks.

To fly up, press "\". (used to be CTRL, but CTRL+w typically is close window on browsers!). You can also use a game controller. You can also hit "F" for full screen so mouse movement is more "gamey" rather than click and drag.

The mist is the atmosphere in the game world, and is a function of height above/below the duocylinder surface. It can be made constant by in the options by setting display->atmosContrast to 0. FWIW, here's a video describing the duocylinder worlds etc odysee.com/@filbs111:5/output

You could make something "full 4d". Basically, in the same way you could present a camera in a 3D world as an image projected onto a 2D surface of a sphere, you could project a 4D world as a projection onto this 3-sphere surface. An extra control to move the projection point forward or backward along the pointing direction (current position "on" the 3-sphere surface).

Doing that is a long way down the TODO list though!
filbs111
Mononian
 
Posts: 6
Joined: Sun Jan 24, 2021 5:17 pm

Re: 3-sphere explorer game

Postby PatrickPowers » Mon Aug 02, 2021 12:45 pm

That video did the trick. The space ship is flying around a section of the 3D surface that is equidistant from those two circles. The two circles are embedded in a 4D space, are perpendicular, and have the same center. Min < w2 + x2 = y2 + z2 < Max. It's like the ship is flying in the atmosphere of a 4D planet while constrained to being above the equator.

I like the way that torus looks in the explanatory vid. It's a different point of view from what I'm used to. I'm not sure, but it seemed to me that things directly in front are drawn smaller than those to the side. Is that right?
PatrickPowers
Tetronian
 
Posts: 440
Joined: Wed Dec 02, 2015 1:36 am

Re: 3-sphere explorer game

Postby PatrickPowers » Tue Aug 03, 2021 8:09 am

The thing I like the most is the instructional video. It is truly 4D in a new way that I hadn't thought of. The problem is, how do you show two perpendicular circles that share the same center but don't intersect? You did it by arranging the display in such a way that only a portion of each circle may be seen. I dunno, 25% or so I guess. In this way the circles can always be seen as being distant from one another. We are never forced to show an intersection. The distant between them remains constant and looks that way. I don't know how this is done, but maybe could figure it out if I ever should have a mind to.

In this display we are moving freely at a fixed altitude above the surface of a 4D sphere. We can't go up or down and we can't see the surface, but that's OK with me. Since the physics of this package are almost surely 3D it seems likely that there is no easy way (or no way at all) to add the 4th D of up/down motion, but I'll take a shot regardless. You could have a second entirely separate display that shows nothing but the heights and how far apart the ships are. Then you will have cases where ships at different heights appear to occupy the same space in the first display.
PatrickPowers
Tetronian
 
Posts: 440
Joined: Wed Dec 02, 2015 1:36 am

Re: 3-sphere explorer game

Postby filbs111 » Thu Aug 05, 2021 8:12 pm

Thanks. The whole universe (ignoring the portal!) is indeed constrained to the "surface"(or volume? unsure if correct word) of a sphere in 4D (3-sphere)- ie the set of points x2 + y2 + z2 + w2 = 1 (or some constant). This includes the path of any light rays, and everything in the universe is constrained to this set of points - whether there is anything inside or outside this unit 3-sphere is undefined!

I'm also not sure it's strictly "4D", in the same way that i'm unsure whether a curved "flat land" world constrained to the surface of a normal sphere (2-sphere) can be considered to be 3D.

The surface of the grid object, and landscape (ignoring wobbles) is midway between two great circles: x2 + y2 = 1 (equivalent to w=z=0), and z2 + w2 = 1 (equivalent to x=y=0). Those great circles are illustrated by the lines of blue and yellow boxes in the video. The surface midway between these is x2+y2 = z2 + w2 = 0.5

Making a full-on 4D game would be fun. I fear players will be confused enough as it is though. As am I! Feel free to fork the code and have a bash!
filbs111
Mononian
 
Posts: 6
Joined: Sun Jan 24, 2021 5:17 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 12 guests