Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is DivineVoxelEngine support android and ios #1

Open
codingwatching opened this issue Feb 28, 2022 · 8 comments
Open

is DivineVoxelEngine support android and ios #1

codingwatching opened this issue Feb 28, 2022 · 8 comments

Comments

@codingwatching
Copy link

Hi there! @lucasdamianjohnson
Thank you so much for creating DivineVoxelEngine, it is an awesome project!
Could you please support it to run on mobile devices (android first) so we can make some small games on it
Thank you so much!

@lucasdamianjohnson
Copy link
Member

@codingwatching
Hi, thank you for being interested in the project.
I guess that is something I could try to do.
I am just curious if you tried to make a mobile app with it and what your experience was.
Cause I have not tried and just have been developing it inside an electron environment. So, I am uncertain what I would exactly have to do. But I am implementing ways to make it more mobile-friendly such as turning off the shader effects. Though the engine absolutely needs full WebGL 2 support as well as the Web Worker API.

Either way, right now I am implementing the rest of the features and making it more efficient. The project is still somewhat in its infancy. If it can be done in a way such that it will not fundamentally change the underlying engine then I will do it.

@lucasdamianjohnson lucasdamianjohnson added the enhancement New feature or request label Feb 28, 2022
@lucasdamianjohnson
Copy link
Member

So, I just did a little bit more looking. Here are the support tables for the needed features:

For the most part, all of the key components are supported.
I think it is just a matter of setting up the app to support all of them properly.
Since shared array buffers have to set a content security policy on the headers.

@lucasdamianjohnson
Copy link
Member

lucasdamianjohnson commented Feb 28, 2022

Alright, so here is my plan of action.

  • Create a directory in the main project that is the electron directory.
  • Use either Cardova, ionic, or react-native.
  • Try to use babylon.js react native
  • Create example worlds like the electron example.

This will be the course of action to reach full mobile support.
But I will need a month or two before I do this. Because I need to finish transitioning away from 3d arrays to flat arrays and finish implementing some of the engine settings.

However, more research will have to be done.
For instance, if Babylon.Js Native does not support 2d Texture Arrays then the engine will not work.

@lucasdamianjohnson lucasdamianjohnson added feature request and removed enhancement New feature or request labels Feb 28, 2022
@codingwatching
Copy link
Author

Thank you so much @lucasdamianjohnson
I think the link of babylon.js native should point to https://github.com/BabylonJS/BabylonNative
(Not Babylon react-native)

@lucasdamianjohnson
Copy link
Member

@codingwatching
You're right I did mislabel that link. Should be fixed.
But Babylon.Js Native is only right now for windows and macOS.

I asked for help on the babylon.js forum:
Any Advice for Porting Babylon.Js Project to Mobile

Maybe somebody will respond with an answer.
Also, I added a new research section to the wiki where I will keep track of my progress on my findings for finding the best method of making a mobile port.

My biggest concern with something like React Native is that it does not seem to support web workers out of the box.
So, maybe a Cardova approach would be better but there may be a more performant way such as directly supplying the app through the browser.
Cause the only reason the engine works as well as it does is because of the web worker API.

Luckily 90% of the engine does not exist in the main thread and is completely independent of Babylon.JS. All it does is hold the world data and generate raw mesh data which can be used by almost any rendering engine.

Also will be using this issue to track the progress for this feature request.

I may have to add some extra options to the engine options for mobile only.

@lucasdamianjohnson
Copy link
Member

lucasdamianjohnson commented Mar 2, 2022

So, some further research has been done.
It looks like currently there is no way to use a Shared Array Buffer inside a mobile app. I could not find any tech that supports it.
Also, all other options seem to lack the performance required.
I would have to practically re-write the whole engine for a different engine.
One option could be Godot and with this module, you can use TypeScript JavaScript language binding for Godot game engine.

So, until further notice, I will not pursue this and build the engine out for desktop only. I will keep an eye on what advancements are being made but until then there is no practical way to do so. I may in the future make a Divine Voxel Engine Native but that is far from now.

Minecraft bedrock edition is written all in C++ while the one for desktop is Java-based. They had to re-make the whole game.
So, I feel that this currently is beyond the scope of the project and something that would be a distraction from finishing it.

But let me be clear. I would love to eventually make a mobile version. But I feel at this exact moment the tech is nor my skill is there to do so. I am a one-man team and I am sharing this project simply because I love it. I would not like to stray from Babylon.Js cause it is my favorite game engine.

Let's say they somehow make an electron for mobile. Cause Chrome on mobile has all the features the engine needs but there is now a way to port that to its own app like an electron. So, you could still have a game and use the exact same engine but it would have to be on a website.

So, if and when I can easily port the engine to mobile I will do so.

As much as possible I want to preserve what makes the engine divine. That being its ease of use through techs like TypeScript and Babylon. As well as its simplicity and "straightforwardness". I put a lot of thought into the name of things and their organization.

@lucasdamianjohnson
Copy link
Member

Just making a note here. It looks like Safari on iOS has all the needed features to run the engine as of version 15.4.
So, theoretically, you should just be able to wrap into an app with Cordova or capacitor and use it on iOS.

Found some resources more about mobile dev with a framework that uses web view.

But still, I have read complaints of people using a framework like this to make a game and the FPS was terrible. But I don't know. Maybe on a more powerful phone it would be fine.

@lucasdamianjohnson
Copy link
Member

Currently working on releasing Alpha 1.0. The engine is now actually using Shared Array Buffers (Matrix/MatrixHub/Nexus).
But I am also working on a new part of the engine to run on a Node server.
Theoretically, when that is done you could have the game hosted on a server and just send over the raw data through web sockets.
I will post about it more once I have a full example working.
But that is another option to make the voxel engine more cross-platform.
I also realized that in the case of just a single-player game it does not make much sense but the engine is designed to be more general so you could make anything with it. Just the internals that you don't see will have to be changed to allow for inter-thread communication in Node rather than just the browser.
And with a WebSocket, you would only need one thread (the render process). So, it would make things a lot easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants