Compatability between 3D rendering and basic rendering
While trying out the new 3D graphics APIs (mainly M3D) I discovered that the screen object was completely replaced and had lost all of it's previous functions. I was concerned because I wanted to be able to make a UI for a 3D game that I am planning, but cannot do so if there is only 3D functionality. It would make me unable to create a UI or other things that I had planned. My suggestion is that the screen object retain it's basic rendering functions when using another rendering engine (especially a 3D one).
//this is impossible because the rendering engine removes all other screen functions except for screen.render()
draw = function()
drawUI() //function for drawing the user interface
screen.render(scene, camera)
end
This is an interesting idea.
The preferred way to build an UI would be to allow drawing offscreen images and use them as sprites in M3D / Babylon. You could render your 3D scene, and then create a 2D scene for the UI that could be rendered on top of it ; all through the 3D API. This is probably the best in terms of performance.
Your solution seems much easier for someone who is already familiar with the standard microStudio 2D API. It would involve creating a drawing canvas on top of the canvas used for 3D rendering. I will think about it!
Just a thought, but a mode where 2D and 3D can coexist freely can result in some creative ideas, as well. If it's not hard to implement (I have no idea), it might be a nice thing to have.
For example, there was some game back in the 90s (I totally forgot what game it was), where the game was all in 2D, but when you inspected items in your inventory, there was a window where you could see them in 3D and you could rotate them around. I always thought that was pretty cool.
I once played around a bit in Godot with an idea I had for a shmup in space, where the game was all 2D as usual, but the background (with planets, space facilities, etc) was all 3D. I never got far with it, but the idea was the background would rotate/move as the player progressed, to give the player a sense of not always going in a straight line.
My workaround for drawing 2D in a 3D game was to use system.javascript()
to render HTML elements with CSS position: fixed;
. Sadly, there is no way that I know of to use 2D MicroScript APIs in a 3D game.