Search Unity

Engine 4 - Four dimensional gameplay in Unity

Discussion in 'Assets and Asset Store' started by WillNode, Apr 21, 2015.

  1. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    That's a very ambitious project.

    Sorry but I still didn't understand which part is "flaky"? Everything is working fine and smooth at my end. Maybe post GIF if that's help.

    Engine4 does not support multi viewers at this point. Internally those generated mesh are renderer using their own MeshFilter, and because one GameObject cannot have multiple MeshFilter, you can't create multi Viewers by that way.

    However I think I can lift the limitation by using Graphics.DrawMesh instead. I'll make a note.

    Engine4 uses its own rigidbody, named Rigidbody4. You can't mix regular Rigidbody with Rigidbody4. The physics system is broken when any of those objects has its transform (not Transform4) modified.

    Cylinder4 transforms any Mesh into 4D objects by extruding them like circle into flat cylinder. That's only one useful mesh generator that I can think of.
     
  2. Chunkboi

    Chunkboi

    Joined:
    Jun 11, 2018
    Posts:
    3
    Okay. My 4d FPS concept requires that I pass a conventional control input to the player character. So far, my plan is that the player can only move in 3 dimensions at a time, but they can alter which 3 dimensions they interact with. The control inputs boil down to a couple of vector 2's, one for linear motion (like the keyboard) and one for angular motion (like the mouse), which are then passed to the player motion script for translation into the appropriate motion.

    Can I remove the regular Rigidbody and only use Rigidbody4 for motion in this case?

    Can I get Transform4 to override regular Transform?

    Another question: I've been trying to set the viewer from within the game during test plays. I found a set of commands that work, and using the arrow keys, I can choose X, Y, Z, or W like I would from clicking the buttons on the Viewer4 panel in the Scene window:

    public static void AxisChange (Axis4 dimSel) {
    viewer = GameObject.Find("Main Viewer"); // object must be initialized at the start of the AxisChange subroutine
    switch (dimSel) // set the viewer's 4d orientation in euler angles based on the player input
    {
    case Axis4.W:
    {
    viewer.GetComponent<Transform4>().eulerAngles = new Euler4(0f, 0f, 0f, 0f, 0f, 0f);
    break;
    }
    case Axis4.X:
    {
    viewer.GetComponent<Transform4>().eulerAngles = new Euler4(0f, 180f, 0f, 90f, 0f, 180f);
    break;
    }
    case Axis4.Y:
    {
    viewer.GetComponent<Transform4>().eulerAngles = new Euler4(180f, 0f, 0f, 0f, 90f, 180f);
    break;
    }
    case Axis4.Z:
    {
    viewer.GetComponent<Transform4>().eulerAngles = new Euler4(0f, 0f, 0f, 0f, 0f, 90f);
    break;
    }
    }

    }

    Now this seems to work as expected, except that the transitions are instantaneous and quite jarring. I was trying to make the engine transition smoothly from one dimensional orientation to another, like it appears to do when I click one of the buttons on the scene window instead of executing this part of the script. Is there a way to do that, or will I need to write something to handle incremental transition of each number? What happens when I click the button versus when I just execute the command as I wrote it above?
     
  3. Chunkboi

    Chunkboi

    Joined:
    Jun 11, 2018
    Posts:
    3
    Addendum: I'm having trouble getting the scene to render. I used to be able to have solids, now I can't see anything when I run the game or editor in cross-section view mode. My viewer is set to W (viewing X, Y, Z space) with an R of 0, and the transform4 of all objects shows the W displacement and T, U, V rotations all at 0, so I should be seeing objects as if they were 3 dimensional. The objects are still there, as I can switch into Frustum view and still find them, but cross-sectional view shows nothing.

    Also: there's an error that keeps popping up in the console:

    SendMessage cannot be called during Awake, CheckConsistency, or OnValidate
    UnityEngine.GameObject:AddComponent()
    Engine4.Physics.Physics4:get_main() (at Assets/Plugins/Engine4/Components/Runtime/Physics4.cs:61)
    Engine4.Physics.Rigidbody4:Synchronize() (at Assets/Plugins/Engine4/Components/Runtime/Physics/Rigidbody4.cs:68)
    Engine4.Physics.Rigidbody4:get_body() (at Assets/Plugins/Engine4/Components/Runtime/Physics/Rigidbody4.cs:46)
    Engine4.Physics.Collider4:Synchronize() (at Assets/Plugins/Engine4/Components/Runtime/Abstract/Collider4.cs:71)
    Engine4.Physics.BoxCollider4:Synchronize() (at Assets/Plugins/Engine4/Components/Runtime/Physics/BoxCollider4.cs:23)
    Engine4.Physics.Collider4:OnValidate() (at Assets/Plugins/Engine4/Components/Runtime/Abstract/Collider4.cs:86)​

    The code it refers to is in Physics4.cs:

    public static Physics4 main
    {
    get
    {
    return _main ? _main : ((_main = Viewer4.main.GetComponent<Physics4>())
    ? _main : (_main = Viewer4.main.gameObject.AddComponent<Physics4>()));
    }
    }​

    Is this going to get addressed in the next update?
     
    Last edited: Oct 31, 2018
  4. SentrySlime

    SentrySlime

    Joined:
    Nov 23, 2018
    Posts:
    1
    I'm having trouble with the editor script buttons not showing up, (the S4 view shortcuts) a lot of the content in your video is fairly outdated so it's hard to understand what everything does even with the documentation and manual although it defiantly helps. Perhaps you could upload another video where you go trough some of the different scripts.
    Other than that it's a great tool!
     
  5. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Heyo. Long time no see.

    It's been around 4 years or more since I run and develop this asset.

    If you wonder why I haven't push new version lately, today I want to give you a good news.

    I'm taking a brave decision to move out entirely from Unity Engine. This means I'm switching focus on purely native (C++) form out of this asset. This solves a primary problem of this asset currently encounter: performance and portability.

    I believe this movement also benefits to us on creating more innovative games, as it will scales well on larger project too. By the time of this writing I have been succesfully converted all C# rendering and physics code to C++ even creating some demo examples out of it.

    And also, because C++ gives me low level operations, I can think some algorithms for next features, like UV textures, particle system, GPU accelerated projection, etc.. All core features that defines a Game Engine.

    I aware that this is one of my ambitious project I ever working on. So what are the good news?

    First. The library is open sourced - https://github.com/forth-engine/forth-library

    It's currently licensed as GPL but later I will dual-license the library when most features get complete. And for this asset? I will drop most the code and instead, provide a wrapper for the C++ engine. If you have already bought this asset previously, it's mean that you've bought the wrapper code including the commercial license of the library. I think that's a win-win solution for all of us.

    Stay tuned for updates!
     
  6. Alex_Sour

    Alex_Sour

    Joined:
    Feb 2, 2018
    Posts:
    5
    Hello! I'm wondering, will the Unity asset continue being updated even with Fourth Engine?
     
  7. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    My Answer is I don't know. Both development currently inactive due of lack resource from my side. Other than that I always keep tracking my assets to make it works with latest release from unity.
     
  8. Alex_Sour

    Alex_Sour

    Joined:
    Feb 2, 2018
    Posts:
    5
    K, that's good. I was thinking of buying the asset soon.
     
  9. BantamJoe

    BantamJoe

    Joined:
    Aug 18, 2013
    Posts:
    1
    I spent $35 on this asset yesterday and now I'm worried that I may have wasted my money if there are no more upgrades. I think this is a great product and would love to see it mature more. Please let me know if I have to sign up with you so that I can get your C++ wrappers for people like myself that just bought the product. Thank you.
     
  10. MonkeyKasai

    MonkeyKasai

    Joined:
    Jan 4, 2014
    Posts:
    40
    Hi there,

    Was wondering if there was an easy way to edit a single value of the rotation values in the Transform 4 script through another script. I'm currently struggling to find a way as I can't seem to find a way to convert Euler4 values to Matrix4
     
  11. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Hey,

    This project have been quite inactive for a while. But I just decided that it back on the roadmap. If you want to use this Asset in Latest version of Unity, get the copy from GitLab repo (grant access here).
     
  12. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Okay I just aware of how Engine4 being far from production ready despite it's development time. Sorry folks. More fixes delivering soon.
     
  13. Odminnimda

    Odminnimda

    Joined:
    May 7, 2020
    Posts:
    4
    I just came across this discussion. interestingly, I do almost the same.

    what do you use to display the 3D slice? I am using hyperplane section. also for the model I use a set of tetraetdra.
     
  14. Odminnimda

    Odminnimda

    Joined:
    May 7, 2020
    Posts:
    4
    in general, I see that you are using a projection to create a 3D slice
     
  15. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    Look like you're new here. I use regular unity camera to display it. Engine4 projects 4D objects to regular 3D unity object.
     
  16. Odminnimda

    Odminnimda

    Joined:
    May 7, 2020
    Posts:
    4
    this is understandable, I use the same. I rather asked about the work of Engine4 itself
    for example, are files used with 4d models?
     
  17. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    No, they're fully procedural, and it has no depedency with Unity itself. Theoretically I can move out the engine to C++ OpenGL (which I did some time ago, for fun). Unless your question can be specific, you might need to take a look at the documentation? It's covering some basic information you might want to look for.
     
  18. robson0z

    robson0z

    Joined:
    Sep 5, 2018
    Posts:
    1
    Hi, great work, I just came again across it. I will use it for scientific visualization, please don't remove it out of Unity :) it's not only about rendering, Unity has these tools (UI, Sound, Logic, Input) which makes life easier and will do also in 4D ;)
    It's the only tool where you can see how stacked 4D cubes will look like... and not to forget the wonderful 3-sphere. Thank you for that.
    As part-time programmer, I'm asking myself how much effort it would make to implement an Oblique Projection. I've found the Frustum and CrossSection scripts and it seems as one could just plugin another one into...
     
  19. Crlosunity

    Crlosunity

    Joined:
    Apr 15, 2018
    Posts:
    1
    Hi the documentation is not possible to acces the offline version seems to be broken as well , i cant find any pdf or readme file in there with the whole docuemntation, can you please help?
     
  20. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
  21. BriaKatrina

    BriaKatrina

    Joined:
    Jan 23, 2021
    Posts:
    1
    Upon downloading the Offline Documentation and testing it, the problem appears to be the way the index.html file links to the manual file. The documentation is all online and there, but routes incorrectly. I was able to access the manual at https://willnode.github.io/engine4-doc/manual (where currently in the index file, it routes to /manual instead of engine4-doc/manual )

    I just want to say though, skimming through all this I want to say thank you for all the work put into this! I've recently purchased it and am excited to try things out.
     
    Williander and WillNode like this.
  22. Dev-4U

    Dev-4U

    Joined:
    Nov 2, 2021
    Posts:
    23
    I understand the basics of four-dimensions having at least scrapped the surface of quantum physics, string theory and related matters at the core of our physical universe.

    I'm also a game developers since well over 20 years.

    Still, I can't wrap my head around what kind of games one would be able to make with this engine? I see the value of being able to visualize 4-dimensional objects in realtime for academics. But as far as games are concerned I simply come out empty. Perhaps a puzzle game like an M.C. Escher might be possible but I think not even his drawings can be related to 4-dimensional space since they are playing tricks on your mind.

    I've seen the screenshots on the asset store page but static images are not doing anything to illustrate what the 4th dimension does. So, are there any game example videos or demos I can have a look at to understand the value of the 4th dimension for games? It doesn't matter if its this engine, any other 4D visualization game would help me understand what this might bring to the table.
     
    zeropointblack likes this.
  23. WillNode

    WillNode

    Joined:
    Nov 28, 2013
    Posts:
    423
    It's mostly a puzzle or adventure game. Have you heard of a game named Miegakure? Honestly, I was motivated to create this package by that game. Four dimension games is basically an almost untouched game business. Someone can (hypothetically) create a new market of games around this concept if one is willing to make it smooth as possible.
     
    ina likes this.
  24. Dev-4U

    Dev-4U

    Joined:
    Nov 2, 2021
    Posts:
    23
    Would be a very niche business though. ;)

    Due to the fact that it gets harder and harder to sell games that are not based on real-world concepts or events. I mean this in the sense how we perceive the real world not how it is scientifically/mathematically constructed.

    I had a look at Miegakure and the explanation video. I'm not entirely convinced this is actually a 4th dimensional renderer. It's switching between connected levels, in the order of: original scene, switch to travel scene (the purposed 4th dimension), switch to alternate scene representation of the original one. Then there's some blending of meshes applied though it's hard to say whether this actually renders 4D meshes as the camera moves along, it could also be a fancy morph that makes it look like a 4D blend. In any case, for the players it simply doesn't matter because whenever the game is interactive, it is entirely rendered in 3D and movement is always 3D either (notice the pause during morphs). Meaning the game would still work and wouldn't take any information away from the player if all it did would be a simple fade-to-black between scenes.

    There's a couple games like this I've seen in the past, Only Fez comes to mind right now. It does apply this concept to "only" 2D/3D switching which I think works well because I can relate to both 2D and 3D rendering of a world and wrap my head around switching from 2D to 3D - but it's still enough to confuse and frustrate players that are ... erm, dimensionally challenged. :) (starting with 2D: left vs right).

    Btw I found this video that explains how (and why) 4D objects look like in a 3D renderer:
    4D Toys: a box of four-dimensional toys, and how objects bounce and roll in 4D - Bing video
     
    ina and WillNode like this.
  25. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,084
  26. Plimpton

    Plimpton

    Joined:
    Jan 31, 2019
    Posts:
    6
    Hello!
    I am trying to click on a 4D object at runtime using a raycast from the camera, but it keeps giving me an "index out of bounds" exception. Here is my code :


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Engine4;
    5. using Vector4 = Engine4.Vector4;
    6. using Engine4.Physics;
    7.  
    8. public class TestClick : MonoBehaviour4
    9. {
    10.     void Update()
    11.     {
    12.         if (Input.GetMouseButtonDown(0)) // Left mouse button clicked
    13.         {
    14.             Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    15.             Vector4 origin4 = new Vector4(ray.origin.x, ray.origin.y, ray.origin.z, 0);
    16.             Vector4 direction4 = new Vector4(ray.direction.x, ray.direction.y, ray.direction.z, 0);
    17.  
    18.             Ray4 ray4 = new Ray4(origin4, direction4);
    19.             RaycastHit4 hit = Physics4.Raycast(ray4);
    20.  
    21.             if (hit.hit)
    22.                 print("Object hit: " + hit.collider);
    23.             else
    24.                 print("no hit");
    25.         }
    26.     }
    27. }
    28.  
    And here is the error I get when I click an object (It doesn't show when I click somewhere else):


    ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <8f06425e63004caf99a79845675f751e>:0)
    Engine4.Internal.Set`1[T].get_Item (System.Int32 index) (at Assets/Plugins/Engine4/Internal/Common/Memory.cs:20)
    Engine4.Physics.RaycastHit4.get_collider () (at Assets/Plugins/Engine4/Components/Datatypes/RaycastHit4.cs:65)
    TestClick.Update () (at Assets/TestClick.cs:35)


    Thank you for the help!