Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

atamocius

7
Posts
1
Topics
104
Following
A member registered Mar 31, 2016

Recent community posts

Thanks for clarifying!

This might sound like a "stupid question", but I can see that the requirement is to come up with a "Web game". So are tools like Unity, Defold, GopherJS, or WASM compilers allowed (or any tool that compiles to a web app)?

+1 for UniRx.

Based on the discussion, it is also a lib that does not add to the gameplay and is mainly for code architecture. However, a clarification from the mods/hosts would be nice.

(1 edit)

I have not tried this yet, but theoretically, if you are using pixel fonts and assuming that the camera that shows the render texture is orthographic, you can just "align" the pixels of the font to the render texture. Going with that, this can also work with any artwork. Doing so, the UI is in front of the render texture (assuming that the Canvas is set to "Screen Space - Camera")

EDIT: the other idea is if you are rendering your UI to the render texture as well, you could add trigger colliders to the render texture, but that can be tedious to setup especially if you have animated UI. A possible solution is to have static "hotspots" on the render texture, and just swap the UI that fits into those hotspots.

(1 edit)

While I was digging around looking for similar setups, I came across PixelCamera2D. The approach is somewhat similar, though it is already packaged as a prefab.

Regarding the fixed resolution, I tried out Packer's Auto Resolution script and it works great. I just made a few tweaks. In the Update method, I also call the AutoScreenSize if Screen.width != Screen.height, and I have an IsPowerOfTwo method instead of checking for each height value. You can take a look at the code here. The code ensures pixel perfection; it changes the resolution to the next power of 2 smaller than the chosen resolution. It works for both windowed and fullscreen modes.

(2 edits)

Regarding publishing, the only workaround I see so far is to target WebGL. You can use arbitrary resolutions for this.

EDIT: If deploying as Windows/Mac/Linux binary, you could just put some artwork on the extra spaces (this can be achieved as some background quad larger than the render quad). One could also use this area for on-screen controls if deploying to mobile devices. Perhaps making it look like the play area is inside an arcade cabinet?

(1 edit)

Just use Unity's RenderTexture. Take a look at the example in the manual (near the bottom of the page).

You can quickly build on that process by using a Quad (GameObject -> 3D Object -> Quad) instead of a cube.

  • Create a new RenderTexture asset
    • Set the resolution to 64x64
    • Set AA to none
    • Set Filter Mode to Point
  • Assign the RenderTexture to the "Target Texture" field of the Main Camera
  • Create a Quad (GameObject -> 3D Object -> Quad)
    • Turn off Cast & Receive shadows on the Mesh Renderer
  • Drag the RenderTexture asset onto the Quad to use the RT as its material
    • Change the shader on the Quad to use "Unlit/Texture"
  • Create a new Camera
    • Set this to Orthographic
    • Set Size to 0.5 (assuming that the Quad is of unit size)
  • Align the Camera to the Quad
  • Create a new Layer
  • Assign that new layer to the Quad
  • Set the new camera to only render that layer
  • Set the Main Camera to exclude rendering that layer

Tada! You got yourself a low res 64x64 setup in Unity. =D

Essentially the "Main Camera" captures all the gameplay, and the other camera will just render the Quad and nothing else. The only problem now is building a player with a 1:1 aspect resolution. I have not found an answer to that yet other than what nothke has said about Screen.SetResolution.