Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
We have a matrix (3) - how about Matrix4 ? — Gideros Forum

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# We have a matrix (3) - how about Matrix4 ?

Maintainer
edited January 2013
We have a matrix (3) - a native Matrix4 would be great for 3D manipulation of 2D objects.

Having it native would keep the speed up. It would allow faster proper 3D manipulation of points.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com

• Guru
100% agree - it'd also be great for those demo scene effects they used to call VectorBob's - just like the opening screen to AfterBurner!

On a post whoring mission - nothing to see here (It's not my fault! )

Likes: SinisterSoft

WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
+1 -1 (+1 / -0 )Share on Facebook
• Maintainer
In other words "why can't Gideros do 3D?". There is no particular reason why not! OpenGL is 3D to its core and Lua is a general purpose language. Box2D is certainly 2D of course, though you could map 2D physics based movement onto 3D in certain ways. (Cordy is a good example) So what might a 3-D enabled Gideros look like?

1) Need 3 coordinates for position, 3 rotations, 3 scale factors for each sprite.

2) Sprites would automatically be sorted into order according to z coordinate not based on order added. OpenGL has routines to do this with a single call -- and much faster than any Lua program could do it. This means the order of children of a parent would not be important, so no need for addChildAt etc

3) We need 3D shapes: make a polygon face out of lines, then stick several faces together to make a solid (eg cube). You can then texture each face. Having constructed the 3-D shape, you can translate, rotate and scale.

4) It might be good to have two separate display trees: one for 3-D objects and another for 2D. The 2D objects would be used for head up display and touch controls and would be drawn after all 3D objects are drawn.

5) It's hard to tell when a 3D object is being touched by user so either don't bother sending touch events to 3D objects at all or else prepare a sophisticated hitTestPoint replacement! For example in your asteroid game its not necessary for touch events to reach the asteroids.

6) You would also need a facility to move the camera so that we can view the scene from different angles.

Likes: SinisterSoft

+1 -1 (+1 / -0 )Share on Facebook
• Maintainer
In other words "why can't Gideros do 3D?".
Well @john26 you just listed 6 reasons why not

But seriously as I'm not opposing this, but there still many core features missing that everyone's like to see much before other specific cases and plugins, that I think the Gideros time has no time to concentrate on other options and possibilities for the engine.

• Maintainer
@john26 +10! As a layer of sprites - drawn before the first it world be great to have 3D.

@ar2rsawseen For the present though a quick add of Matrix4 would make 3D with 2D objects possible and thus many more types of games and effects available.
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com
• Guru
there is some good reference for anyone to create a plug-in or own specific OpenGL stuff, https://github.com/TwoLivesLeft/Codea-Runtime

However there are a couple of things required with Gideros and @Atilim has a list of them, it is all about the order of these which get done first. I might require masking, some 3D and some other developer Shaders and so on. It would be nice to have all of them as soon as possible. Including some other specific things that we all need for our projects.
twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
Cool Vizify Profile at https://www.vizify.com/oz-apps
• Member
even without plugin, with meshes you could emulate 3d - that's what i do in a basic way in a game i'm working on. you can even write your own 4d matrix class and your own 3d sprite class (which is a mesh with 2 triangles forming a rectangle). of course intersecting 3d sprites etc. would be a problem, but for basic things it is fairly simple to do such classes probably.
• Maintainer
Yes, but native Matrix4 would be quite a bit faster (c) than Lua...
Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
https://deluxepixel.com
• Member
@SinisterSoft .. surely. and it would be useful indeed, but i agree with the others that there are many more important features that are not yet part of gideros.
• Maintainer
@ar2rsawseen. Sure I understand. Wasn't expecting this to be implemented soon. Just musing on possibilities...

@kezegh: I think meshes are the way to go if Gideros wants to give 3D support. Meshes basically bypass the normal drawing system and allow direct access to OpenGL. It would be quite easy to offer a mesh3d object as well. You need an extra dimension for each vertex and to automatically sort by z-coordinate. I would suggest just having one 3D mesh which is drawn before everything else. It should be possible to translate, rotate and scale in 3 directions.

A 3D mesh like this would be a simple but powerful way for Gideros to support 3D. (hint!)

Likes: SinisterSoft

+1 -1 (+1 / -0 )Share on Facebook
• Guru
Native Matrix4 support would make stuff like this easy.

Although as the link is native Javascript it shouldn't be too hard to port anyway
WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
#MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill