Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

2d fps

Discussion in '2D' started by philiptm93dk, Feb 14, 2020.

  1. philiptm93dk

    philiptm93dk

    Joined:
    Dec 27, 2018
    Posts:
    2
    hi all I have be wondering if it’s possible to create an fps entirely through 2d in unity ?
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,013
    @philiptm93dk

    You mean like old school fake 3d Wolfenstein kind of game or something else?
     
  3. philiptm93dk

    philiptm93dk

    Joined:
    Dec 27, 2018
    Posts:
    2
    yes that is exactly what i mean. no 3d models just good old 2d
     
  4. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,013
    @philiptm93dk

    I'm not sure if that is doable in practice, maybe someone who knows better can answer?

    But in general you can draw to textures (Texture2D) pixel by pixel (SetPixels for example).

    That retro one point perspective can be done with some sort of ray casting / ray tracing, which I don't know about anything else...

    Maybe it could be doable in low resolution?

    But like I said - I have no idea if that would really work or would it be way too slow, I've only use textures for creating bitmap based tile map editor, which worked just fine, as the resolution wasn't too high.
     
  5. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,768
    Whether or not Wolfenstein or Doom used "true" 3D doesn't really matter in my opinion. They can be considered 3D in that they have 3 perceived dimensions of movement and visuals. Back then, they may have been severely limited by technology, having to emulate 3D to the best of their ability with a 2D game engine.

    But with Unity, there's no reason to impose those limits on yourself (unless you like a challenge?). You can make the same looking game way more easily with a fully 3D environment, and then use 2D sprites rotated to face the camera for characters/enemies.

    You would create a sprite for each direction the enemy will appear to be facing (probably 8 directions as per the old games). The actual enemy gameobject can rotate around while it moves, but the sprite as a child object will always face the camera. Then you swap the sprite based on the angle to the camera & the direction the enemy is facing, so if viewing the enemy from the back, it uses the back sprite, etc. That involves a little bit of math, using the Dot Product to compare two directions.

    So to answer your question, yes it's possible, but you can get the same result using 3D in far less time.
     
    Last edited: Feb 14, 2020
    MelvMay and Chris-Trueman like this.
  6. Chris-Trueman

    Chris-Trueman

    Joined:
    Oct 10, 2014
    Posts:
    694
    This was my thoughts, but I like to have a challenge as well. Just because its easier or faster doesn't mean you "should" do it that way. Good explanation for how it would be done.

    @philiptm93dk You can do anything any old game has done in any modern engine. Probably not the same way, but it can all be done. And in any case trying to copy it you may find out something new and interesting.
     
    LiterallyJeff and MelvMay like this.
unityunity