Feasibilty/efficieny of using 3D models for a 2D game - unity3d

I've been using Unity3D for a while now and I've also had experience coding 2D games using LibGdx.
In the past, I used to get my sprites off the net or make my own however that wasn't really the best way to do things since I'm more of a programmer and would sometimes need very specific things and so I've started to learn blender and I'm actually enjoying it atm.
What I want to know is how much of an overhead is it if you're using 3D models for a 2D game? Especially if you want to port it to mobile?

The overhead is significant for rendering since with a basic sprite, you have 6 vertices (2 tris to make a quad) while a 3d model can have hundreds of thousands of vertices.
The advantage on the other hand is that animations are made of sprites, so your texture amount and size may increase. In 3D, an animation is a text file so fairly light.
The physics is simplified in 2D since you can do surface collision while 3D requires volume collision and obviously checking an extra dimension is more expensive.
There are probably other considerations but those are the first coming in mind.
Now, the choice of 3D over 2D should be simply based on what you are trying to achieve. Side scrolling games like Angry Birds do not need 3D. Games like Taichi Panda are better with 3D despite being a 2D game (only x and z camera movement I think).
A FPS game should only be done in 3D or it will look like Duke Nukem.

Related

Voxel Water in unity engine

I am trying to create a voxel style RPG like the one shown in Cube world. And I am trying to get an efficient low-GPU-intensive way to create Voxel water; like the water shown in these
https://www.youtube.com/watch?v=ZCFIchEZk2s
https://www.youtube.com/watch?v=qJa2w-7edKA
However instead of Blender in unity. I feel it would be good to use a procedual shader (for foam, and waves, and adapting to players jumping in it) of somesort to be efficient for my uses (Ocean, rivers, lakes etc...). though I cannot think of a way to create this kind of shader. I have attempted to throw toghether a shader however I am not the most experienced in the non-programming field.
Any help would be greatly appreciated. Thanks!
A shader will not be a good idea for water simulation. I would recommend you use cellular automata to get these water voxel some realistic movement.
Cellular automata works when you divide your world into a grid of cells and every update you change the cell state or position depending on its cell neighbours. There are some good examples of this in games like Conway's game of life and Noita:
Conway's game of life Wiki
Noita trailer
But I will guess that you are going for more of a 3D
style. There is this voxel game which does water simulations very nice:
John Lin's voxel engine

2D Sprites in Isometric 3D Unity Project

The project works under a isometric orthographic camera, in a 3d space using 2d sprites.
What we are using are billboarding sprites into 3D colliders to archieve the 3d feeling.
The problem is that we don't really believe the way we are doing it it's the most optimal. We are also having problems introducing high areas, because we need to reply the sprite form in isometric perspective as colliders.
Because we are using 3D world, the tilemaps tools conflicts with the other vertical sprites.
We can not use a entire 2d floor billboarding sprite because that suposes to have a huge vertical sprite in front of the camera, so we can not display the others.
We are just researching for a solution before to change to a 2D world.
If you plan on sticking with isometric in 3D, get rid of the tilemaps entirely. They are just going to give you a headache and make your game lag itself to death. If you want to convert to entirely 2D isometric, you can stick with them as they would work fine. Now, a few comparisons between the 2D and 3D approaches, and how best to approach them. This is a jumbled list of drawbacks/advantages to each type, so it's more of a ramble after this point than an answer, but I couldn't be more specific without knowing more about your project's overall requirements and specifications.
Unity recently added Isometric Tilemapping as a dedicated feature. So, if you choose to fake it with 2D, your life will be a lot easier.
Controls are a lot easier in 3D, as the physics won't ever have to be
faked.
3D allows foreground objects to automatically cover up background
objects without having to add an arbitrary system to achieve the same
effect.
2D is fundamentally faster than 3D, and if you're aiming for mobile,
that's going to be very important to your project's success.
3D allows you to rotate your camera if you design it right. (Check out Don't Starve Together for an example of this design).

Creating an explode particle system in SceneKit

I want to create an explosion particle system, but I'm not sure how can I do it. I was thinking create a fire particle system with emitter shape being an Sphere and after that just increasing sphere radius, but I don't know how can I animate it's size. Does anyone tell me how can I do that? Or does anyone have a better idea?
Emitter systems for particles are setting initial particle directions, and the rate they'll move at. That's generally how a visual representation of an explosion is created.
So rather than increasing the size of the emitter source to present an explosion, the dissemination of the particles in an outward direction creates the appearance of an explosion.
You're not limited to one batch of particles, nor one type of particles, nor just one emitter. The best explosions are a highly complex layering of different particle types with different textures, coming from different emitters at differing rates, with differing rates of decay, spin rates, colour changes and falloff in both transparency and movement speed.
Making a truly great looking explosion is a real art form and will often take a good designer days to do with a GUI and constant real time playback, especially when trying to minimise the use of textures, quads, blends, fillrate and physics.
Here's a video from Unreal Engine, wherein similar concepts and qualities as what's available in Scene Kit are used to teach the terminology. It's not a 1:1 parallel with the Scene Kit particle engine, but it's probably the best combination of visuals and simplistic explanations to help you rapidly understand what is possible and how to do it with particles.
//caveat: Unreal Engine probably has the best real time particle engine in the world at the moment, so it's a little more advanced than what's in Scene Kit.
But...the principles are essentially the same:
https://www.youtube.com/watch?v=OXK2Xbd7D9w

quartz 2d / openGl / cocos2d image distortion in iphone by moving vertices for 2.5d iphone game

We are trying to achieve the following in an iphone game:
Using 2d png files, set-up a scene that seems 3d. As the user moves the device, the individual png files would warp/distort accordingly to give the effect of depth.
example of a scene: an empty room, 5 walls and a chair in the middle. = 6 png files layered.
We have successfully accomplished this using native functions like skew and scale. By applying transformations to the various walls and the chair, as the device is tilted moved, the walls would skew/scale/translate . However, the problem is since we are using 6 png files, the edges dont meet as we move the device. We need a new solution using a real engine.
Question:
we are thinking of instead of applying skew/scale transformations, that if given the freedom to move the vertices of the rectangular images, we could precisly distort images and keep all the edges 100% aligned.
What is the best framework to do this in the LEAST amount of time? Are we going about this the correct way?
You should be able to achieve this effect (at least in regards to the perspective being applied to the walls) using Core Animation layers and appropriate 3-D transforms.
A good example of constructing a scene like this can be found in the example John Blackburn provides here. He shows how to set up layers to represent the walls in a maze by applying the appropriate rotation and translation to them, then gives the scene perspective by using the trick of altering the m34 component of the CATransform3D for the scene.
I'm not sure how well your flat chair would look using something like this, but certainly you can get your walls to have a nice perspective to them. Using layers and Core Animation would let you pull off what you want using far less code than implementing this using OpenGL ES.
Altering the camera angle is as simple as rotating the scene in response to shifts in the orientation of the device.
If you're going to the effort of warping textures as they would be warped in a 3D scene, then why not let the graphics hardware do the hard work for you by mapping the textures to 3D polygons, then changing your projection or moving polygons around?
I doubt you could do it faster by restricting yourself to 2D transformations --- the hardware is geared up to do 3x3 (well, 4x4 homogenous) matrix multiplication.

How to create wolf 3D kind of basic 3D walls in openGL

I was trying to figure out how I can create simple 3D walls like this in openGL. I dont want to create any fancy stuff just a basic 3D wall where i can move fwd and backwards imagine it as Wolf 3D game with only map no killing etc.
Is there any framework which I can use to do this?? I want to do it in openGL so that I can create/render this thing on my iphone.
Thanks
Pranay
If any body can point me to some sample source code it will be helpful.
As a non-OpenGL alternative, you can construct such a maze and move through it using only Core Animation. The textured wall segments would be CALayers containing images that had been transformed in 3-D to face the appropriate directions. The maze could be translated relative to the camera to cause the user to move through the area. The code for this would be significantly simpler than an equivalent OpenGL ES implementation written from scratch.
An example of this is presented by John Blackburn in his article here.
If you want to use OpenGL, then you have to create everything yourself. But there are several nice 3D engines.
Free:
oolongengine,
Ogre iPhone
Payed (but very powerful):
Shiva3D,
Unity3D
Creating a walk-throug in a 3D space from scratch, isn't basic stuff. It's actually a lot of math.
You will start with the 3D model of the world and in order to put yourself in the perspective of the viewer you have to transform this 3D model with a series of transformations:
The World transformation - Moves the world map
The View transformation - Transforms vertices into camera space
Perspective transformation - Maps 3D space into 2D
Each of those transformations will be defined as a 4x4 matrix. Hope this helps you for a start.