Heya, looking for a little advice on which way to go for an idea I’d like to implement.
It’ll be a top-down procedurally generated dungeon crawler. Probably real-time, single-PC with multiple NPC henchmen. The pace would be closer to something like Dark Souls than Diablo.
I’m pretty certain I want to use Unity for this. Not certain whether to go 2D or 3D. 3D has a distinct disadvantage for me – I’m much more comfortable creating assets for 2D. I know Unity 4.3 has some nice 2D support, including physics, but I’m not sure how easy it would be to work into a top-down perspective. Gravity, for instance – rather than objects falling from top to bottom they’d essentially get smaller in place (if something fell into a pit, for example). Also, will I be fighting Unity every step of the way doing procedural generation? I’ll want to be able to place tiles that have collision boundaries, for instance.
Finally, imagine a top-down fighter swinging a sword. I’d like to detect a collision with an adjoining wall and stop the swing with a clang – doable with a collision box on the tip of the sword and sinking an event when it collides with the wall’s collision boundary, right? Now imagine the sword connects with a critter’s elbow – is it possible (easy-ish) to actually remove the forearm of the critter from the sprite? Like have the sprite be a combination of multiple limbs with some kind of primitive skeleton, detect the collision with the joint, and at run-time remove the limb at the joint?
Anyway, sorry for the ramble, just trying to figure out if Unity (and more specifically 2D and box physics) is a decent fit for what I’d like to do.
It sounds like you prefer 2D. Unity’s new 2D support will probably work for you. You can set the direction of gravity in the Physics2D settings from the menu, so even if you work in side view, with graphics that happen to look like they’re top-down, you can then set gravity to point along the Z axis. Or whatever direction you want.
To do procedural content, in terms of meshes and such, you’ll generate then in script and upload the mesh data. The upload bit is a bit slow but there’s plenty of flexibility to do pretty much whatever you want including creating physics colliders (2d or 3d). Or you could use your own collision detection algorithm. The thing about the sword/forearm, you just need one parent sprite and various child sprites in a hierarchy/nesting and then hide/remove the bits you want. There are various bone-based animation tools available, smooth moves for example, that help with joints and limbs and such.
Thanks a ton, imaginaryhuman, that pointed me in several interesting directions. Watched all of the physics tutorials last night and I see what you mean about gravity and just setting it along Z. As for removing limbs, I see what you mean about having a parent sprite and everything underneath – then could just remove the forearm sub-sprite (and modify the collider to not include it as well).
I may try and mix 2D and 3D a bit – I’m guessing it is pretty easy to do so since the 2D aspect of Unity is still really 3D just fixing the camera (and of course providing a lot of workflow efficiencies, sprite tools, etc.). Maybe do the physics in 3D but the rendering with 2D sprites. Thinking of something like an opposing warrior – though top-down I’d want a force applied near the legs (say from a rolling log or a kick) to knock him down but a force near the torso to just push him back. Have the colliders be 3D but use the orientation / position of the rigid body to determine an appropriate animation / render state for the warrior. If that makes sense (and is feasible)?
To me it is a question of how good/fast you are at creating the 2d art and what camera perspective you mean when you say top down. Pure top-down(ie. you see characters head and shoulders) is easy with 2D.
Where I get frustrated is the more typical 3/4 view top down where you need to create 2d art for 8 different directions, and matching animations. For this it is easier(for me) to just do 3D and not have to worry about multiple sprites for every direction and multiple animations for the same action.
You know, I think you are right… I was thinking of a case that the 2D physics wouldn’t handle. Imagine a birdbath type shape, with a narrow base and a large bowl on top. A top-down rendering would be of just the top, but I was thinking I needed to handle the collision of something lower than the bowl part but with the narrower base. However, that’d be unfair to the player as they expect the physics to follow what they can see – so yeah I was over-thinking things I think. =)
Yeah, I was thinking true top-down (head and shoulders) – not isometric or anything – if I did that you are right, maybe just better to go 3D time-wise.
Stuff with limbs flying off is probs going to be tricky anyways if you’re having this level of unreadiness regarding quite a large part of the creation already. However i think there’s some asset, URG ragdoll or something in the asset store that can figure out limbs falling off i think, plus ragdolling in general which might be fun. The new 2D stuff is definitely a good shout though, it may as well get put through its paces, and it’s a tad easier to put stuff together ad-hoc using sprites for bits than making anything the-last-decade looking in 3D, without a lot of thinks and trickery.
As for your clanging sword thing, mecanim is perfect for the logic and animation behind it so long as you can produce the animation. Might keep you busy for a few years figuring all that out (Not being sarcastic, you’re just crossing a lot of disciplines, each of which can take a long time to get handy with, even if you have a lot of free time)
So yes i’d go with 2D, and if creating a lot of content feels a problem, go for a stylised look which can both give the game an identity and cut down on the amount of stuff you have to make. Some of the best games ever made have benefited from that approach