VizionEck

Gaming => Gaming Community => Topic started by: Legend on Feb 27, 2018, 04:58 AM

Title: A 4D video game?
Post by: Legend on Feb 27, 2018, 04:58 AM
For the longest time I've wanted to make a true 4D video game. Sure lots involve higher dimensions and some have really well done 4D elements, but there are no games that really take this to the next level.

I want a game that doesn't treat the 4th physical dimention as different from the first 3. It would be just like how in Mario 64 you can't think of it as 2D mario with depth, since it's a true 3D game.


So how would this be possible?

No clue. What way would you do it?

The big hurdle imo is graphics. 4D objects are hard to display on 2D screens. The common method is to use wireframe 4d objects and cast them into physical 3D shadows and then render the shadows like standard 3D objects onto the screen. I don't like this because it makes the scene feel 3D not 4D, and the graphics are limited to just lines.

I'd prefer to project the 4D scene into a 3D volume exactly like how a camera works. This volume would be thick and could maybe be viewed in VR if it was slightly transparent. Another, stranger, method would be to somehow map this 3D volume to a 2D space that would then just act as an image on the screen. Could mayber use a hilbert curve to map the 3D volume to a line and then another hilbert curve to map it into a 2D picture.

This resulting image would look like a random mess of colors. My hope would be that it'd visually give enough feedback though for the brain to figure things out. Not a "good" solution but would be cool.
Title: Re: A 4D video game?
Post by: darkknightkryta on Feb 27, 2018, 06:37 PM
If there was a true 4D game, we would have played it in the past, but it wouldn't have been made yet :O

Though there is that 4D rubiks cube.
Title: Re: A 4D video game?
Post by: Legend on Feb 27, 2018, 07:00 PM
If there was a true 4D game, we would have played it in the past, but it wouldn't have been made yet :O

Though there is that 4D rubiks cube.
4D rubiks cubes are probably the closest thing to what I'm wanting since they def have 4D gameplay, but they still aren't that good at rendering them or treating the 4th dimension as identical to the other 3. (Fun fact, 4D 2x2x2x2 puzzles can be played with as physical 3D objects. I guess it could happen for any nD puzzle, but 2x2x2x2 is common)

If you want to have the 4th dimension be time, I'm pretty sure every game ever would qualify ;)
Title: Re: A 4D video game?
Post by: the-pi-guy on Feb 27, 2018, 07:23 PM
4D Toys on Steam (http://store.steampowered.com/app/619210/4D_Toys/)
Title: Re: A 4D video game?
Post by: darkknightkryta on Feb 27, 2018, 07:40 PM
4D rubiks cubes are probably the closest thing to what I'm wanting since they def have 4D gameplay, but they still aren't that good at rendering them or treating the 4th dimension as identical to the other 3. (Fun fact, 4D 2x2x2x2 puzzles can be played with as physical 3D objects. I guess it could happen for any nD puzzle, but 2x2x2x2 is common)

If you want to have the 4th dimension be time, I'm pretty sure every game ever would qualify ;)
You can't play backwards in time in games!   Except those rewind games.
Title: Re: A 4D video game?
Post by: the-pi-guy on Feb 27, 2018, 07:53 PM
You can't play backwards in time in games!   Except those rewind games.
Braid.  
But besides that, just because you only go one direction in time, doesn't mean that it's not happening!  

Otherwise you could almost make an argument that the original super Mario  Bros is only like 1.5d because you cant move backwards.  
Title: Re: A 4D video game?
Post by: Legend on Feb 27, 2018, 08:28 PM
4D Toys on Steam (http://store.steampowered.com/app/619210/4D_Toys/)
Yeah I've seen that one but it's still presented as 3D+1D, not full 4D.

Imagine a table, a ball, a light, and a camera. This setup in 2D would look like a 1D line going color of table->color of shadow->color of ball with a bright spot from the light->color of table. IE:
(https://i.imgur.com/IRPtqLE.png)


In 3D this setup would look like this:
(https://i.imgur.com/uVWA66e.png)


In 4D, the image is a full 3D volume with every part colored in, the base color being the color of the table. Inside the cube is a 3D looking sphere. Next to that sphere is a stretched sphere with the color of the shadow. Inside the first sphere, the colors get brighter the closer they are to a point away from the shadow sphere. This point is the specular highlight from the light.


Games like the 4D toy box you posted are only showing a 3D slice of the 4D world. The physics behind it are definitely 4D, but it's rendered and interacted with as 3D+1D. It's comparable to a side scrolling platformer that allows you to move in and out. I'd love something like my ball+table example above where it's actually attempting to show you a 4D world.
Title: Re: A 4D video game?
Post by: the-pi-guy on Feb 27, 2018, 10:19 PM
Something I was thinking about earlier, was having a game use both analog sticks for the camera.  Each dimension is important just like all the others.  

On your 2d tv, you'd get your 3d representation of a 4d space.  
Title: Re: A 4D video game?
Post by: Legend on Feb 28, 2018, 01:27 AM
Something I was thinking about earlier, was having a game use both analog sticks for the camera.  Each dimension is important just like all the others.  

On your 2d tv, you'd get your 3d representation of a 4d space.  
Yes exactly.

It could probably work somewhat decently in VR. Put you in a virtual "control" room with a volumetric 3D display ie:
(https://i.pinimg.com/736x/b0/63/e3/b063e313aab851e7f8e32d98dc8fb15e--the-movie-image-archive.jpg)

Then you'd also be able to use the VR controllers to each act like a 3D analogue stick and control the game in a "relatively" easy to understand way.


Hmm I like this idea a bit too much. After cube royale I might try making a prototype and see how realistic it is for me to make. 4D graphics could be done with raycasting and signed distance fields. Adding another dimension would only be a minor change. Getting it running at a smooth 60fps would be the hard part. Could either make the volumetric display only 124*124*124 voxels or try to do something dynamic based off camera position.
Title: Re: A 4D video game?
Post by: Legend on Feb 28, 2018, 06:28 PM
Something I was thinking about earlier, was having a game use both analog sticks for the camera.  Each dimension is important just like all the others.  

On your 2d tv, you'd get your 3d representation of a 4d space.  
Thinking about this more, a Doom style game in 4D could map to a regular controller.

Left joystick left/right would move you left/right. Up/down would move you 4D+/4D-. R2/L2 would move you forward/backward. You move along 3 dimensions just like how in Doom you move along 2 dimensions. Moving up and down would just use a jump button.

I like this setup because it'd work well with the 3D picture of the 4D world. Left joystick would push all objects in the 3D image the opposite direction, with closer objects moving faster. Moving forward/backward would be look zooming in and out from the center of the 3D image. Pressing jump would move things in the 3D image down and then back up.

Camera would just be the right joystick. Since it's Doom like and you can't look up or down, it restricts the camera to spinning around the axis perpendicular to ground. In 4D an axis can spin in 2 different ways (pretty sure just 2) so that fits the joystick. Left/right would turn left/right and up/down would turn 4D+/4D-.

How would this game feel to play? The 3D picture of the 4D world would be positioned right in front of the player. Up would be up, left would be left, and forward away from the player's position would be 4D+.

If the game was set on an infinite plane with the camera looking at the horizon (but in 4D), the resulting 3D image would be divided in half. Top half has the sky color, bottom has the ground color. If you had a slow moving hypersphere bullet and fired from the center directly forward, the 3D image would get a sphere put in the center but large enough to fill the volume. Everywhere the sphere is, it cuts away at the sky and ground color. (A spot in the 3D picture can only belong to one solid object). As the bullet flys forward, this sphere in the image would get smaller and smaller. Eventually it'll get so small that it can't be seen any more (it's really far away in 4D). If the bullet fired fast, it'd only be visible in the 3D image for a few frames.

Now imagine there is a target. This will also be a hypersphere to make things easy. The hypersphere will be twice as tall as you and resting on the ground, so in the 3D image it looks like a sphere positioned right between the sky and ground. If it is close to the player it is large and if it is far away it is small. It can be at any point along the sky/ground boundry in the 3D image, just like how an enemy in doom can be at any point to the left or right in the screen. This hypersphere could be outside the edge of the 3D image and be behind you.

If the hypersphere is moving, you'd want to keep it visible within the 3D image. This would mean rotating the 4D camera. If in the 3D image the sphere image of the hypersphere is to the left of center, pushing the right joystick left would bring it back to center. If the sphere in the image is forward of the center, pushing the right joystick forward would bring it back.

This on its own could be the basis of a 4D game. Shoot hyperspheres at moving targets and rotate your camera to aim at them. Would probably need a high field of view and/or a tracking system since finding enemies off screen would be hard. A normal 3D game just has you swing the camera around to see everything yet here that method would miss a lot of area. Also having objects within the scene would really help to keep the player from losing track of their direction.

The graphics would be really important. With a 2D image of a 3D scene we understand size and distance but with a 3D image of a 4D scene this would be very hard. Is a hypersphere large or is it close? A checkerboard like pattern on objects would help with this. If you always know the pattern is the same size, then 3D images with small patterns would be far away. Shadows and lighting would also really help with this.

On the other hand, the 3D image itself will be hard to understand if there's too much detail. A dot like texture for all objects could work really well both for understanding the scene and understanding the 3D image. Would make it more abstract though.
Title: Re: A 4D video game?
Post by: Legend on Mar 01, 2018, 01:32 AM
A rasterization like method might be a smarter approach. Break the scene down into tetrahedrons and rasterize them one at a time onto a 3D pixel grid. Originally I dismissed this idea because I was thinking of rasterizing them into vector like 3D graphics to then be rendered again by the final regular camera, because such a method would involve costly boolean operations.

However if it's done as a true analogue to rasterization onto a 2D screen, then that'd be avoided. The 512x512x512 or so grid would have a color value and a depth value for each voxel. When rasterizing a new tetrahedron onto the grid, it'd do a depth check per voxel and only change the color if the new object is in front of the old object.

This method would be relatively fast for simple scenes and I imagine the resolution would be limited more by memory than processing power.


A hybrid approach could potentially work even better. Drop the grid's resolution compared to the previous method and don't record color per pixel. Instead record object ID per pixel. Then only when the final 2D image of the 3D image is being calculated would the textures and lighting be calculated. That way it's a per pixel effect on the final TV image and the initial grid's resolution would only matter for depth testing. Changing its resolution would only affect the borders between the 3D images of the 4D objects which while important, isn't that important.



This hypothetical 4D game is coming along nicely!  ::)

On paper it does seem like something I could potentially manage, so maybe I should figure out the 4D gameplay possibilities? Would this just be a little sandbox for the player to explore and observe a truly 4D world, or could it offer fun gameplay that isn't just mimicking what players are already used to?

The above example about a Doom style shooter would be almost like a isometric top down game in its basic form. Without motion it'd literally feel like playing a game where you're a satellite or something moving to chase people down. The world looping back around on itself like if it was a super small planet wouldn't really bring much to the table either. With motion and a maze like setting it could be really weird. Occlusion would probably become the big game element as it'd look like enemies disappearing into other objects. You would have to move to make them reappear again. Maybe some sort of x ray vision might help with this to stop it from being too confusing.

From a mechanics point of view, on the 3D image of the 4D scene you'd see the shape representing the cover/wall and the sphere representing the enemy moving towards that first shape. When it gets there if it is closer to you (is less dense with its texture than the other shape's texture) then it cuts into the other shape and stays visible. However if it is farther away from you in 4D, then the other shape cuts into it and the sphere stops being visible once it's fully inside. To make it come outside and thus become visible again, you'd push the left joystick in the opposite direction of where the wall shape is compared to the center of the 3D image. This would move the camera in 4D which would result in pushing everything on the 3D image screen in the opposite direction of the joystick. However, the 3D representations of 4D objects would move faster the closer they are to the camera, so the wall obstructing the enemy would have its 3D image move out of the way revealing the image of the enemy again. You'd also want to push the right joystick in the opposite direction so that the enemy and wall's images stay centered on the 3D screen.

So that gameplay wouldn't be too bad. Sure it'd be a simple 4D shooter but it'd be a good way to push the player to move about the world.

How about a race game? The track would be 3D in the 4D world. If we have the same camera setup as before with the infinite ground and leveled camera, that'd look like the 3D image box with the top half sky color, the bottom half ground color, and a pyramid rising from the bottom through the ground color to the exact center, assuming the camera was aligned with the track. Going forward more or less means expanding the 3D image as if you were zooming in on it. The 4D car could turn left/right and 4D +/- and so the racetrack could as well. In the 3D image the track turning left would look like the pyramid twisting its top left and then extending it off the image. Turning the camera/car left would just drag the whole 3D image right (some distortion but not based off 4D distance). Keeping the car on the road would just mean keeping the center bottom of the 3D image within the base of the road's pyramid. Doesn't sound that fun to me and would be pretty comparable to just flying in a 3D game. Sure you could spice it up with visuals along the track, other cars, and maybe even some jumps, but that wouldn't have a large impact on how it actually plays.

What about a 4D platformer? Again using the example scene of infinite flat ground, but this time with a pit right in front of the camera. The 3D image of the 4D scene would be the color of sky for the top half and color of ground for the bottom half, but within the ground would be an image of a shape for the pit. It'd be kinda hard to tell it's a pit and not some other object on the ground unless it was fully shaded in. If the player jumps, the entire 3D image moves down with closer objects moving faster, and then moves back up as the player lands. Moving forward makes the whole 3D image expand from the center with closer objects expanding faster. So if you moved forward without jumping, the image of the pit would just move down and off the screen as you reach it. If you jump and move forward, the pit also moves down off the screen but doesn't return when you land. A player avatar doesn't really simplify this since without shadows and a solid understanding of 4D depth, it's just as abstract. IE the 3D image of the player could be right next to the 3D image of the pit yet in the 4D space could be very far apart.

Also a 4D platformer would be really hard to design. In 2D, a hole/death zone must be jumped over no matter what since by default the hole blocks player progression. In 3D, the player can walk around the hole. This is why 3D platformers can't really do holes and instead focus on the platform itself being a safe space. In 4D it'd be even more extreme where you essentially have to make everywhere a kill zone and just a few dots of safe space. Would be very hard to design without it just feeling like jumping from one safe space to another. Plus it wouldn't feel that unique? Sure it'd require setting up the correct camera angle, but once that's done it'd just be a linear jump.


So a simple shooting game seems like it might actually be the best option. First level could just be a big empty plane, while additional levels would put more and more around you until you're inside a 4D building.
Title: Re: A 4D video game?
Post by: Legend on Mar 03, 2018, 06:01 AM
Ok we've figured out potential ways to render the graphics. How would the game engine side of things work?

For starters I'd have to essentially create my own game engine. Unity is very customizable but none of its default things could be modified to 4D. Instead I'd need to build absolutely everything myself through scripts.

Some of these things would be pretty easy. I understand vector math and position/scale are simple to expand to 4D. Rotations however would suck. I barely understand how quaternions work, much less the math behind them, so building my own 4D versions would be hard. 4D objects have 6 degrees of freedom for rotation so I'd need two quaternions to define 1 rotation or use some other way to sort it out. A good solution is important since rotation will be used for graphics and physics too.

Speaking of physics, I'd need to program my own methods from scratch. I've already done this for VizionEck with some things but I'd need to heavily optimize it and add standard functions like raycasting and spherecasting. 4D objects are very "dense" so I might need to fake a lot of things to make it run reasonably fast. Would definitely help if I built the scene out of primitives instead of tetrahedron meshes.

Designing and building the game would require overhauling the unity editor window and making it run in 4D as well. Again I have a little bit of experience with modifying it so this won't be easy but should be doable. Could sync the editor with my custom list of objects and just make it an inactive view of what's really happening since during runtime the unity scene would be empty.


Programing an engine from scratch would probably be more efficient but I think it'd be smarter to start with Unity as a framework. I'd want to get this to a prototype state as fast as possible so I can really assess the idea.
Title: Re: A 4D video game?
Post by: the-pi-guy on Mar 04, 2018, 12:29 AM
With how fast you seem to be putting this together, one would think VizionEck would've released months ago at least.

Spoiler for Hidden:
<br>Jk I know you haven&#39;t done that much. &nbsp;<br>
Title: Re: A 4D video game?
Post by: Legend on Mar 04, 2018, 02:23 AM
With how fast you seem to be putting this together, one would think VizionEck would've released months ago at least.

Spoiler for Hidden:

Jk I know you haven't done that much.  

Haha the early stages of game dev are the best.

Yeah the only actual work I've done was last night. 4D rotations are core to practically everything so I was trying to sort the details out.

Still not sure when I'll actually start a prototype. I really don't want to spend much time on this since it's not that interesting from a gameplay perspective. Might even just release it as a tech demo only.
Title: Re: A 4D video game?
Post by: Legend on Mar 18, 2018, 06:03 PM
We play games on TVs with controllers and don't need an explanation for that, so maybe there shouldn't be an explanation for viewing the 3D volumetric display. It'd just be a mechanic.

The game would be exclusively 4D with only lore/worldbuilding relating to whatever story I want to tell in that 4D world. You wouldn't play as a person controlling a 4D object, you'd be playing directly as a 4D being. Would be cooler and also decrease rendering complexity.
Title: Re: A 4D video game?
Post by: Legend on Mar 19, 2018, 05:10 PM
Hmmmm, I'm not sure if a rasterizor or a signed distance fields approach would work better for 4D geometry.

The equivalent of a triangle in 4D is a tetrahedron. Defining the world out of thousands/millions of tetrahedrons would work but 4D objects just have so much surface area. Take for example a cube in 3D. We can represent it with 12 triangles. Now look at a 4D hypercube. It needs 40 tetrahedrons to define its shape. This increased complexity is even more pronounced on other shapes. A sphere for example in 3D could have 320 triangles to make it look somewhat smooth while a hypershpere would need ~3,370 tetrahedrons to look as smooth. Ignoring the performance hit of needing to use a custom tetrahedron rasterizer, the geometry itself would be a huge resource hog.

Signed distance fields wouldn't have to deal with this. SDFs only use "linear" math so they work in any dimension and simple objects like hypercubes or hyperspheres would work as primitives. The hard part becomes optimizing the number of render voxels, not optimizing the scene.



So I think I'll start out with an SDF approach since it seems more likely to succeed. Plus it'd be simpler for me to program.
Title: Re: A 4D video game?
Post by: Legend on Mar 20, 2018, 03:55 AM
(http://media.vizioneck.com/images/4dgame/4dhypercube.png)

Spent my break today working on this. That's a render of a 4D hypercube!!!

No shading atm and needs a lot of work to look better as a 3D image, but it's fully functional (as long as you don't rotate anything). The image above is a hypercube a few meters from the camera and a bit to the left. This makes the side face exposed, producing that partial pyramid extrusion on the right of the image. Thought it was a glitch when it first appeared.
Title: Re: A 4D video game?
Post by: Legend on Mar 20, 2018, 05:31 AM
(http://media.vizioneck.com/images/4dgame/4dhyperspherewithshadow2.png)

The framerate is close to single digits but here's shading and a shadow. It's a hypersphere on top of a hypercube table. The image of the hypersphere dips into the image of the table because it's closer to the camera for that area. The image of the shadow is inside the table's image and is 3D, not a flat ellipse.
Title: Re: A 4D video game?
Post by: Legend on Mar 24, 2018, 03:14 PM
Worked on this again last night, but i think it's time to put it on the shelf until I'm ready to dedicate a lot of time with it. The 4D engine is all set up and is ready to have a game built using it.


Graphics are currently way too slow and my test scene runs at 20 fps (without shadows). I'll need to really optimize the shader and use some hacks to get it running faster. Also playing the game in VR or at the very least in 3D is pretty important so increasing performance is my number 1 concern.

Rotations are working too. 4D is hard to think about because there are just so many ways to rotate and so few online articles giving specifics. I found a method to rotate a point by a 4D rotation and used that to engineer all the other functions a game needs.

With that I also set up a very basic physics engine. It is not even close to being capable of calculating true physics, but it's enough to keep objects from falling through the ground. All of my functions are set up using double precision floats since 4D geometry has more room for errors to build up.

Playing in 4D is interesting. Left right, up down, and forward backward quickly map to your brain. Ana and kata kinda map too, but it's just a game mechanic you get used to. Rotations are similar but take more time to adjust to. Ana and kata rotations are really confusing and hard to understand. Things move around the screen in a predictable way but the shape objects make as they rotate feels random.


So the short of it is that I'm really excited by this and it's definitly possible, both to create and to play. I'm suprised how quickly my brain was adapting to 4D geometry so maybe I'll need a more complex game to go with it.
Title: Re: A 4D video game?
Post by: the-pi-guy on Mar 25, 2018, 12:53 AM
(https://i.redd.it/y9p3r9i8srn01.jpg)
Title: Re: A 4D video game?
Post by: Legend on Mar 25, 2018, 04:57 AM
(https://i.redd.it/y9p3r9i8srn01.jpg)
Haha I'm not sure that'd actually work.

4D stuff is so cool to think about though since it just goes against everything you know about the world. Like it's impossible to tie a string into a knot in 4D since circular tubes don't fully constrict motion to 1 vector. Or that beings living in 4D space would almost always have circular symmetry since left/right and ana/kata are intermixable.
Title: Re: A 4D video game?
Post by: Legend on Jul 09, 2018, 06:16 AM
(https://i.imgur.com/tehAgeV.png)

I'm prototyping a different rendering engine based off tetrahedron rasterization. Still a ways to go before it can visually compare to the SDF renderer but it'll hopefully be a lot faster.

I'm targeting a 256*256*256 or higher pixel render image. Unlike the SDF renderer, the 4D image will be rendered into a static cube instead of a dynamic one oriented with the camera. Disadvantage is that depth resolution will be over sampled compared to x and y, but the advantage is that every pixel sampled is important, the framerate is not affected by zooming in or moving the camera, and the block grid can be viewed multiple times without needing to refresh it (ie in VR the 4D scene doesn't have to be rendered separately for each camera and camera refresh could happen at 120fps even if the game is 30fps).

The screenshot above is of a 32*32*32 grid. Once finished it should not look blocky. The colors are to distinguish separate tetrahedrons. One hypercube needs 40 tetrahedrons to fully cover its surface. This sample scene has 13 tetrahedrons for a total of 520 tetrahedrons, but backface culling alone can bring that down to 125.
Title: Re: A 4D video game?
Post by: darkknightkryta on Jul 09, 2018, 06:35 AM
(https://i.redd.it/y9p3r9i8srn01.jpg)
"cut if access to 4th dimension is unavailable"
Title: Re: A 4D video game?
Post by: Legend on Jul 09, 2018, 09:25 PM
(https://i.imgur.com/wehzS3h.png)

Now it's starting to resemble the previous engine ::)

I have 4D depth testing implemented and could now render accurate depth buffers of any 4D scene. Still a lot to go before I have materials and lighting, but it's a nice start. Currently it's rendering at 64*64*64 voxels and I'll stick with that for a while probable. One of these days I'll also need to work on visibility issues with this final "ghosty" look, but right now I'm focusing on the 4D side of the engine.
Title: Re: A 4D video game?
Post by: Legend on Jul 10, 2018, 01:02 AM
(https://i.imgur.com/OSbEiTS.png)

The beginnings of a forest.

The four trees are all identical in shape and size within the 4D world. Their images look different depending on position and distance from the camera. Each is made up of 4 hypercubes since I'm not ready to attempt curves.


On thing I absolutely love is that natural objects in the 4D world are intuitive. Only a mathematician could see the shadow of a hypercube and recognize the shape, but most players will be able to recognize mountains, rivers, trees, clouds, humanoids, etc. just by exploring the world.

These little blocky trees look more or less like 3D trees, but at a higher resolution you'd notice some big differences. For example the 3D image of the tree would have branches randomly juke back in towards the trunk instead of primarily extending outward. Also every area of the top of the tree's image would be covered in leaves, even with some appearing inside wood. This is just an illusion of course: the tree in 4D is solid and can't have parts overlap.

Title: Re: A 4D video game?
Post by: Legend on Jul 10, 2018, 04:31 PM
The graphics engine is good enough for this prototype. Still need to add 3D textures, lighting, shadows, etc. but those will come once I've built the rest of the engine.

Right now I'm building my own 4D version of Unity's scene view. This will allow me to see what I'm working on and set up levels a lot faster. Also I'll need to build a 4D mesh editor into this since that's pretty important. Would be really awesome if I got this working in VR/3D.

Physics will be interesting. The old engine could do raycasting using sdf but this new engine will not be as simple. Maybe I could copy over VizionEck's physics engine and convert it to 4D. Could also modifiy it to support raycasting. I don't plan to need any detailed physics but basic stuff is crucial just to even select objects by clicking on them.

Title: Re: A 4D video game?
Post by: Legend on Jul 11, 2018, 04:16 PM
(https://i.imgur.com/iI6iIBN.png)

Rest of the engine is coming along nicely.

I added a quick simple outline effect so that it's easy to see the bounds of the 4D rendered image. Also it's really really cool to move around the 4D world and treat it like a tv screen. The mouse wheel allows you to zoom in and out of the 4D world. Holding the scroll wheel down and dragging around allows you to pan the 4D camera left/right and ana/kata. With alt held down, it switches to pivot mode. Clicking and dragging with the left mouse button rotates the 4D camera around a point in the left/right and ana/kata directions. When doing left/right it feels kinda like normal rotating, but it's very weird when doing ana/kata.
(https://i.imgur.com/dnjK3t4.gif)

I have a lot of my game engine classes partially set up. My 4D mesh class can calculate surface normals, so pretty soon I'm going to have to start messing with lighting in the graphics engine. First I'm going to get the renderer working with the data in the scene and get mesh editing working in the editor.

Also optimization wise I'm feeling pretty good about hitting my performance target. A lot of this code is quickly thrown together yet I'm still getting great framerates. Biggest slowdown is from tetrahedrons getting too close to the 4D camera and covering up a lot of voxels. This stops the GPU from running in parallel since currently voxels per tetrahedron are operated on in sequence. At the moment I can literally increase performance by adding more tetrahedrons to an object's mesh.
Title: Re: A 4D video game?
Post by: Legend on Jul 12, 2018, 12:57 AM
Rendered around a million tetrahedrons without destroying the framerate too much, so that's nice.

I really do need to learn more about the rendering pipeline though. 98% of the slowdown with that many tetrahedrons was from the CPU trying to pass them off to the GPU. Also the GPU could probably handle 100 million tetrahedrons as long as they were small. My big resource hog on that front is the pixel size of tetrahedrons.
Title: Re: A 4D video game?
Post by: Legend on Jul 13, 2018, 02:02 AM
Viewing the 3D rendering is still an unsolved problem.

I don't like that smaller images are darker. It's like if the game was played in fog.


I essentially have a minecraft map with 256x256x256 voxels and I need some way to let the player see every voxel. Like seeing every single underground block in minecraft.

1 option is to break up the data and not present it as a regular image. This would be stuff like showing it as a bunch of side by side slices or using a space filling curve to map every voxel to a screen pixel.
Pros:
No loss of information
All data easily visible

Cons:
Requires teaching the brain how to use
Not natural or intuitive

2 option is to make all the voxels transparent and slightly glowing so that you can just look at them.
Pros:
Makes 4D really simple to understand
Cons:
Screen can become a useless mess of color
Needs to be in VR/3D or else you can't judge depth/ana and kata location


Essentially it seems the 2nd option is great if you want to pause the game and move the 3D camera to check out the scene but both options are poor if you're only moving the 4D camera.

I really hope I can figure out something better. Both can be supported but I think an enhanced version of option 2 might be possible. Make it have "solid" pixels for specific objects. Would be less information but would make it even more intuitive and simple to understand.
Title: Re: A 4D video game?
Post by: Legend on Jul 14, 2018, 04:11 AM
I figure I'll just keep posting these mini updates to help with activity.

I have a "Find closest point on mesh" function set up which could be the backbone of my physics engine. It's slow and doesn't work on every mesh atm but it's a great start. Still haven't started on raycasting but I now have a better understanding of how it will work.

I've also started to really think about 4D modeling. I need my own mesh editing software but just even the geometry is interesting and needs to be sorted out.
Title: Re: A 4D video game?
Post by: Legend on Jul 15, 2018, 05:23 AM
Hyperspheres made up of tetrahedrons are difficult...

So far I can either represent a hypersphere with 5 tetrahedron cells (4d version of face) or represent one with 600 tetrahedron cells. I do not know of any convex shape between the two with only tetrahedron shaped cells and all points equally distanced from the center. I tried making a "subdivide" function and using it on the 5 cell shape and then stretching points to be equally distanced from the center, but it becomes convex. Only way to fix it is to shorten 5 vertices until those cells form an octahedron. Pretty nonoptimal since that's 40 cells wasting rendering resources!

A problem is that traditional subdividing is impossible in 4D. A regular triangle can be cleanly subdivided into 4 identical smaller triangles, but a tetrahedron cannot be subdivided into identical tetrahedron. My solution was to divide it into 4 identical smaller tetrahedrons and 8 additional tetrahedrons of similar size but it was less than ideal with the above example. Similarly that makes LOD generation really really difficult.


On the positive side of things, I think I've figured out the best approach for having a terrain feature in my engine. Instead of modeling the terrain by hand, it'd be generated during runtime by a 3D texture acting as a heightmap. This would save a ton of memory, be easy to stream in chunks, and solve the LOD problem. Close terrain could be generated at max resolution while distant hills and mountains could be generated using a lower resolution version of the texture. It could use the texture for physics too which would save a lot of performance.
Title: Re: A 4D video game?
Post by: Legend on Jul 15, 2018, 06:04 PM
(https://i.imgur.com/taEhoY6.png)

600 cell is in!

Definitely looks like what I'll be using for hyperspheres. It's fairly smooth and should work well.

EDT:

(https://i.imgur.com/hQCi4QA.png)


Here's the 600 cell subdivided into a 7,200 cell and rendered at 128*128*128.

It's way smoother but annoyingly so, it's actually spikey. The shape isn't convex.
Title: Re: A 4D video game?
Post by: Legend on Jul 15, 2018, 07:48 PM
(https://i.imgur.com/5xSIQpF.png)

I embraced the spikeyness.
Title: Re: A 4D video game?
Post by: Xevross on Jul 15, 2018, 09:32 PM
Is Vizioneck 4D now?
Title: Re: A 4D video game?
Post by: Legend on Jul 15, 2018, 09:45 PM
Is Vizioneck 4D now?
Seems you missed a thread

http://vizioneck.com/forum/index.php?topic=6141 (http://vizioneck.com/forum/index.php?topic=6141)
Title: Re: A 4D video game?
Post by: Xevross on Jul 15, 2018, 10:05 PM
Seems you missed a thread

http://vizioneck.com/forum/index.php?topic=6141 (http://vizioneck.com/forum/index.php?topic=6141)
Oh yeah I forgot about that. So is this work going into Cube Royale or is it a side project?
Title: Re: A 4D video game?
Post by: Legend on Jul 15, 2018, 10:30 PM
Oh yeah I forgot about that. So is this work going into Cube Royale or is it a side project?
Check the date on that post  ::)

This is a fully separate thing. Due to some scheduling stuff I couldn't really be that productive with Cube Royale so instead I'm working on this atm.


It's a 4D game engine. In the future I might use it to make a game, but right now I'm just making sure the concept is viable. I don't know of anyone attempting to display a full 4D world before.
Title: Re: A 4D video game?
Post by: Legend on Jul 17, 2018, 03:54 AM
(https://i.imgur.com/5iT5t8f.png)

Alternative display method.

This is an image of the entire rendered image, including voxels on the inside. It takes the 3D volume and maps the colors to a 1 dimensional line, and then maps that line to the 2 dimensional display. It's using a hilbert curve if you're interested in the math.

No way would I expect most people to bother with a display like this, but I wanted to revisit it since it might make for a good dev tool.

(not like anyone would notice but a few pixels are in the wrong spot. This is using a 1024*1024 lookup texture which obviously isn't a pixel perfect match)
Title: Re: A 4D video game?
Post by: Legend on Jul 18, 2018, 05:38 AM
(https://i.imgur.com/SERMWDu.png)
(https://i.imgur.com/V7wZot0.png)
(https://i.imgur.com/0ZlVefP.png)

At the very least, it makes insanely cool patterns.

Example in motion:


This shows the 4D camera moving to the right.
Title: Re: A 4D video game?
Post by: Legend on Jul 18, 2018, 06:02 PM
(https://i.imgur.com/xX8Ef9S.png)


It's fun how ghosty it looks.
Title: Re: A 4D video game?
Post by: Legend on Jan 11, 2019, 08:57 PM
A 4D video game.

Imagine a beautiful and surreal 4D island that you are free to explore at your own pace. Things aren't always peaceful though, as the island is inhabited by ~12 legendary beasts. Embrace your destiny and use swords, shields, and arrows to defeat them.



Not sure about a lot of things at this stage, but this is something I'm moving forward with. The main reason I'm going with this game concept is that it allows the game to be incredibly accessible for players that don't understand the fourth dimension while also still being an interesting game for players that do. Also it's a perfect setting for showing off interesting 4D geometry. Swords are really crazy in 4D and natural objects are also really crazy in 4D.
Title: Re: A 4D video game?
Post by: Legend on Jan 12, 2019, 11:11 PM
Moving and rotating the camera at the same time is too complicated. Instead I think I might set it up like metroid prime where you can only do one of them at a time.

Left stick moves you left when pressed left, ana when pressed up, right when pressed right, and kata when pressed down. Right stick moves you forward when you press up and backward when you press down. Movement is relative to the 4D camera.

In free look mode, it is essentially the same. Left stick has left/right and ana/kata panning while right stick has up/down panning. Tilting the right stick to the left or right would spin the camera although this is only a comfort option.

During gameplay, the camera would lock on to the beast. During regular movement, the camera would either stay static or follow the player depending on how well the player understands 4D.

As an option, I'll set it up so players can change the controls and manage player position and camera direction at the same time. It's a bit awkward moving forward using shoulder buttons but it'd be nice for players that want that.

Title: Re: A 4D video game?
Post by: Legend on Jan 16, 2019, 12:38 AM
I might add a horse type creature to the game. That way I can have a full mountain range. I also might scale up the beasts too.


Now I just need to call the game Shadow of the 4D colossus.
Title: Re: A 4D video game?
Post by: the-pi-guy on Jan 16, 2019, 12:44 AM
Now I just need to call the game Shadow of the 4D colossus.
Ha, I get it.  
Spoiler for Hidden:
<br><div style="margin:20px; margin-top:5px"><div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b> for <i>Hidden</i>: <input type="button" value="Show" style="width:60px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Show'; }"></div><div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;"><div style="display: none;"><br>Because a shadow of 4D objects is 3D! &nbsp;<br></div></div></div><br><br>Jk
Title: Re: A 4D video game?
Post by: Legend on Jan 16, 2019, 12:58 AM
Ha, I get it.  
Spoiler for Hidden:

Spoiler for Hidden:

Because a shadow of 4D objects is 3D!  


Jk
Ding Ding ding!

Right now sotc is pretty much what I'm going for. The game started out as 4D botw but I scaled everything back to keep things workable.


I'm worried about how empty the game is though. I want it to be large enough to have different biomes and feel like a place that is fun to explore. 4D trees and objects are cool but most areas would just be big and only interesting from a distance.

Sotc worked because it never expected the player to go off script and explore on their own.
Title: Re: A 4D video game?
Post by: Legend on Jan 16, 2019, 02:10 AM
I think I've figured it out. Remove unguided exploration and replace it with guided exploration. Instead of the player traveling the world and expecting to find interesting things wherever they go, the player has a specific list of things and a specific way to find them.

One method will probably be pictures like the ones taken by Zelda in botw. The player sees these 3D screenshots from the menu and then tries to find where they were taken in the world. Another method will probably be geometry based. Have a statue that points to a treasure, have a sphere of rocks with a treasure at the center, etc. The player knows from the menu exactly where the clue is and exactly what the clue means, but they have to demonstrate an understanding of the fourth dimension in order to find the reward.

These methods should be far better since the world can stay fairly sparse while still pushing players to visit more places than just the beast locations.
Title: Re: A 4D video game?
Post by: Legend on Jan 17, 2019, 09:38 PM
The biggest question now is modeling. Using 3D textures for the terrain will work great. That still leaves me needing to model rocks, trees, and beasts.
Title: Re: A 4D video game?
Post by: Legend on Jan 19, 2019, 05:23 AM
@the-Pi-guy

Do you have any experience making game engines? I'm starting to think it might be wise for me to make my own engine instead of using Unity. Currently I'm only using Unity for the most basic things since obviously the engine isn't designed for 4D.

If I make my own engine the only extra work is additional memory management, input/output, supporting consoles directly, and the general requirements of making a seperate application that runs as the editor (but I have to make my own editor either way). Overall this could potentially save time since I wouldn't have to fight Unity to make it do what I want. It also could give the game a huge performance boost and give me valuable experience.


I'm tepid though since I don't know C++ yet and I don't have experience creating programs.
Title: Re: A 4D video game?
Post by: the-pi-guy on Jan 19, 2019, 05:48 AM
@the-Pi-guy

Do you have any experience making game engines? I'm starting to think it might be wise for me to make my own engine instead of using Unity. Currently I'm only using Unity for the most basic things since obviously the engine isn't designed for 4D.

If I make my own engine the only extra work is additional memory management, input/output, supporting consoles directly, and the general requirements of making a seperate application that runs as the editor (but I have to make my own editor either way). Overall this could potentially save time since I wouldn't have to fight Unity to make it do what I want. It also could give the game a huge performance boost and give me valuable experience.


I'm tepid though since I don't know C++ yet and I don't have experience creating programs.
I haven't yet.  

I've got the book on it though.  

If you have specific questions, I'm sure I can find the answer somewhere in there.  

I'm hoping to make some kind of engine for the experience after I'm done with school.
Title: Re: A 4D video game?
Post by: Legend on Jan 21, 2019, 05:24 PM
I haven't yet.  

I've got the book on it though.  

If you have specific questions, I'm sure I can find the answer somewhere in there.  

I'm hoping to make some kind of engine for the experience after I'm done with school.

I have a lot of programing experience but mostly it has all been inside of Unity. What do I need to do to get started?
Title: Re: A 4D video game?
Post by: the-pi-guy on Jan 21, 2019, 07:15 PM
I have a lot of programing experience but mostly it has all been inside of Unity. What do I need to do to get started?
Get started with what, exactly?  
Title: Re: A 4D video game?
Post by: Legend on Jan 21, 2019, 07:46 PM
Get started with what, exactly?  
Exactly.

I guess I should just hit the ground running and try out a lot of different things.
Title: Re: A 4D video game?
Post by: the-pi-guy on Jan 21, 2019, 08:45 PM
This is basically the main order for start up:

Memorymanager
Filesystem manager
Video manager
Texture manager
Render manager
Animation manager
Physics manager

In the generic order the text has.
Title: Re: A 4D video game?
Post by: Legend on Jan 22, 2019, 12:00 AM
This is basically the main order for start up:

Memorymanager
Filesystem manager
Video manager
Texture manager
Render manager
Animation manager
Physics manager

In the generic order the text has.
I'm prepared to make those things. It's more of a question of how custom do I go (and I don't know enough yet to know how to phrase the question).

There is a range to how custom I go. On the simple end is Unity and I just make it work. On the extreme end, I'd make my own programing language like Jonathan Blow is doing and then make an engine. Where do I go in between the two?

Is it necessary to make my own compiler? Do I need an SDK like SFML (https://www.sfml-dev.org?) It's probably a really basic thing but none of the "build a game engine" results online seem to lay out the options for how the first step should be taken.
Title: Re: A 4D video game?
Post by: the-pi-guy on Jan 22, 2019, 12:15 AM
Edit: ignore.
Title: Re: A 4D video game?
Post by: the-pi-guy on Jan 22, 2019, 12:19 AM
Never mind, I get your question. 

I don't see there being an immense amount of benefit to making a compiler like that.  It might be fun and good to know exactly what your engine would be doing. 

But simply going with C++, there's going to be a lot of resources already available to you.

Whereas if you are starting with a compiler, you might find that there are simple instructions that you didn't include. 

It's also another layer youd have to do bug checking for. 
Sometimes bug checking can be tricky even with tools.  Especially at that level where you might find out that your grammar just doesn't work.  You could have a case that doesn't parse the way you intend, or something that should be parseable isn't even parseable at all. 

I think the middle ground makes the most sense with the costs/benefits. 

But if you really wanted to make a compiler, I could give advice!