1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

OFFICIAL Guest Blog: Utilizing 3D Cameras in 2D Games

Discussion in 'Announcements' started by rmanthorp, Jan 31, 2020.

  1. rmanthorp

    rmanthorp YoYo Games Staff Admin YYG Staff

    Joined:
    Apr 15, 2016
    Posts:
    313
    Matharoo makes games, tutorials and courses using GameMaker. He has joined us on the blog to share the following quick and exciting use of cameras in GMS2.

    https://www.yoyogames.com/blog/552/utilizing-3d-cameras-in-2d-games
     
    Xor, Cpaz and JeffJ like this.
  2. Cpaz

    Cpaz Member

    Joined:
    Jun 20, 2016
    Posts:
    347
    I'll have to keep this bookmarked for when I get back to my platforming project.

    Great stuff!

    Edit:
    Shoot, I also got spritestack the other day, now I need to know of I can use that with any of these methods...
     
    Last edited: Jan 31, 2020
    matharoo likes this.
  3. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,870
    If there's anything this article should be teaching YoYo, it's to stop drawing a line in the sand saying "GMS 2 is a 2D engine, we won't facilitate integration with 3D because of that". There are plenty of elements and concepts in 3D graphics that also make sense in 2D. For example, fleshing out built-in support for matrix, vector and quaternion math would be a step in the right direction.
     
    gnysek, squircle and Cpaz like this.
  4. gnysek

    gnysek Member

    Joined:
    Jun 20, 2016
    Posts:
    1,381
    I would really appreciate some tutorial for matrix-noobs (I mean showing and explaining every array element with examples). I've done many things in GMS during my life, but that's the thing I don't understand in fact.
     
  5. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,870
    I would really appreciate it if GM users (particularly rookies and so-called "intermediates") would start realizing the universality of mathematical and logical competencies in programming, and stop discounting third-party resources like this one just because the language is marginally different.
     
  6. drandula

    drandula Member

    Joined:
    Jun 22, 2016
    Posts:
    21
    I would like to have ds_grids more Matrix-like behavior capalities. They can already look a bit like Matrix.

    Edit. Blog was good, I was going to make parallax with calculations on global game jam, but this saved my time from it remainding 3D possiblity. Own camera code already supported zooming on Z axis, just had to change ortho to perspective
     
    Last edited: Feb 1, 2020
  7. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,870
    Looking like a matrix is only half the deal. Being optimized and convenient at runtime is another.

    As an emulation for a matrix, grids score horribly at both optimization and convenience. They are CPU-bound on the most part, not GPU-bound the way actual matrices are, so they suck at high usage. They also need to be manually cleaned after.

    While it would be best if YoYo could expand and better formalize their offerings for hardware-accelerated matrix and vector routines, if it had to be GML-emulated I'd sooner pick arrays over any ds_ data structure. They are garbage-collected, have built-in visual syntax since GMS 2, and their status in GML is not fuzzy. And I walk the talk.

    Most sensible people with more than a month's of experience can emulate matrix and vector arithmetic with arrays and the like themselves, and like I demonstrated, there are already stock GML solutions. The problem with GML in particular is how flimsily its built-in hardware-accelerated matrix and vector routines integrate into the GMS 2 engine. Its return values are all over the place, have no formal integration into the language (compare Unity or Godot), and there are no pathways into the built-in vector types without resorting to shader uniforms. It is by far the worst integration I've seen among game engines. If YoYo could address that, it could pave the way for better 2D graphics and less flimsy plane geometry (e.g. fewer problems asking about rotating off-origin or gun/arm placements), and indirectly help 3D integration down the road via community and/or company initiative.
     
  8. Joe Ellis

    Joe Ellis Member

    Joined:
    Aug 30, 2016
    Posts:
    1,106
    The depth of each sprite is using the Z axis, and rendered with a shader using directx11, the ONLY key difference is that the projection matrix has no perspective to divide with (its 1) So it still sorts things behind other things, which is 3d, it just doesn't make things smaller the more depth they have.

    So following that idea, you can use a 3d camera, all it does is enable perspective so things get smaller\bigger.
     
    matharoo likes this.
  9. drandula

    drandula Member

    Joined:
    Jun 22, 2016
    Posts:
    21
    I know. Writing multilayer neural network with correct backpropagation was a pain, and as there are lot of computations, even slight improvements would do wonders. Mostly those calculations would be done with matrices, but I had to improvise.
     
  10. drandula

    drandula Member

    Joined:
    Jun 22, 2016
    Posts:
    21
    Here is our short video of our Global Game Jam game, which also showcases the use of 3D camera and Room layers


    Zooming looks just great, wouldn't have been same with just calculating parallax. This blog was just in good time remainding you could do it this way.
     
    Last edited: Feb 3, 2020
  11. gnysek

    gnysek Member

    Joined:
    Jun 20, 2016
    Posts:
    1,381

    A W E S O M E !!!
     
    8BitWarrior and drandula like this.

Share This Page