Unity Game Dev.

Posted 4 years ago2020-10-15 16:23:54 UTC
After mapping for Goldsource for 16+ years, it's time for something different.

I've been messing with Unity and learning C# in my spare time.

I want to make very simple 2D games and have already started a simple platformer.

So far i've programmed my character to respond to the arrow keys and move side to side and jump. He also plays his idle and walk animations. I did so by following along tutorials on YouTube but took a step back to run through tutorials on C# in general. It's a huge beast to understand for someone like me but i'm very slowly beginning to understand the fundamentals.

Does anyone here have experience in Unity?

13 Comments

Commented 4 years ago2020-10-15 17:00:20 UTC Comment #102955
While I don't have any significant experience with Unity (not to say I didn't try it out), I can tell you about modern engines in general:
  • map geometry is all made of models; although some engines like Godot and Unity have decent CSG plugins
  • as you've already witnessed, you start from scratch; you must invent your own movement physics or use a physics engine, you must invent your own system for this and that, specific to your game, basically everything is from scratch and all the engine does is handle the lower-level stuff like allocating memory for entities & components, render stuff and stuff like that
  • as you might've also noticed, asset importing is much easier; you can just drag'n'drop stuff, either into the editor's asset explorer or into some folder in your project
I think you made a nice choice if you haven't messed with programming before. C# is easier and forgiving compared to C++.
At some point, you might also wanna try out Godot which also supports C# (alternatively, it offers its own scripting language GDScript), and there's a TrenchBroom plugin for it to directly import TrenchBroom maps or something.

I, personally, occasionally experiment with Unigine 2 and CryEngine 5, which are big behemoths (but still perform better and run better than UE4 AHAHAHA), and otherwise I work with idTech 3 (Quake 3 engine) and idTech 4 (Doom 3 engine), with which I've done some more significant progress.
Though, I'm also planning to do some stuff in Unity and Godot.
Commented 4 years ago2020-10-15 17:10:07 UTC Comment #102956
Thanks for the insight Admer.

As far as i've seen, map geometry for me at least with 2d design is based on simple 2d collider boxes defined by the user that use pre built in physics in the unity engine. It's pretty easy to manipulate and from the small amount of 3d that i've seen, you can use the existing model geometry/ mesh to create colliders for 3d geometry as well.

This sounds great however if my character jumps from high enough above a 2d platform, he goes straight through the geometry. I guess it's kinda buggy.
Commented 4 years ago2020-10-15 18:16:36 UTC Comment #102957
Oh right, I was talking about 3D when I mentioned map geometry, lol.

The reason behind going straight through geometry is that triangles are infinitely thin. The physics engine isn't aware of the "volume" of the mesh, so of course it's gonna screw up the collision at high velocities. You can think of it like treating each triangle as a separate physics object, completely disregarding the big picture. If it worked flawlessly, taking into account the volume of a concave mesh, it'd be very slow. xD

Generally, what people do in that situation is make a dedicated group of convex collision meshes (e.g. a table would have 1 wide rectangular prism, and 4 thin cylinders for collision), in which case it's easier for the physics engine to process it and it's aware of the volume. Dunno how that one works in Unity, but at least you can use a bunch of box & cylinder colliders to approximate the mesh.
Commented 4 years ago2020-10-16 15:50:20 UTC Comment #102958
First dev log
Commented 4 years ago2020-10-16 19:52:54 UTC Comment #102959
Why did you disable embedding? <w<
But anyway, that looks cute.

My only complaint would be the very noticeable usage of FL Slayer in that song, assuming you made the song. I'd recommend getting some clean electric guitar samples (actually, FL Slayer without any post-processing will do) and Guitar Rig 5. Guitar Rig 5's demo has enough functionality to distort a guitar sound real good.
Commented 4 years ago2020-10-17 16:02:18 UTC Comment #102961
Allowed embedding.

Thanks. I agree, the music needs to be more subtle. For now it's just a place holder though along with all the backgrounds graphics. The only thing I like from this so far is Spike's graphics and animations. Pixel art is so fun. :) The huge learning curve for me is learning C#. On to the tuts. :/

Also, the camera I used that follows the player is a pre built script/ tool. It works great however it distorts the pixel art so I will have to find out how to script my own from scratch.
Commented 4 years ago2020-10-17 19:34:52 UTC Comment #102962
Well, you could freely contact me if you want C# mentoring in general, I'd say I'm good enough at it lol.

Cameras are, really, just points in space with some extra properties (FOV, far clipping plane, near clipping plane). In the case of 2D, they just have an XY position, a zoom factor, and a single angle. So, if you'd like the camera to follow Spike, you'd do something like this:
// Somewhere in some Initialize method: (assuming your player entity contains a Camera component and a Player component of some sorts)
playerComponent = GetParent().GetComponent<PlayerComponent>();

// Somewhere in some OnUpdate method:
cameraPosition = playerComponent.GetTransform().GetPosition();
So what's gonna happen is, the camera grabs a reference to your current player, and tracks the position. So wherever the player moves to, the camera follows along. The real fun happens when you start experimenting.
cameraPosition.x = playerComponent.GetTransform().GetPosition().x;
This will make the camera never move up'n'down, only left-right following the player, just like Super Mario Bros. for the NES. xD

Keep in mind that I got no Unity scripting experience so this code won't apply, it's more like pseudocode to get the idea across. :D
Commented 4 years ago2020-10-18 22:49:37 UTC Comment #102975
Interesting, thanks for the ideas on the camera.

Messing with some other ideas:
Game Dev 2
Commented 4 years ago2020-10-21 19:35:31 UTC Comment #102985
Tom Francis from PC Gamer (of Gunpoint & Heat Signature fame) has a wonderful tutorial series on Unity development for beginners.
Commented 4 years ago2020-10-23 18:39:38 UTC Comment #102990
Cool, thanks Archie. I'll be sure to check that out next time i'm working with Unity.
Commented 4 years ago2020-10-26 19:57:58 UTC Comment #102992
Unity is awesome!

I like they Brackeys Tutorials on youtube, though the dude resigned so his content is no longer being updated, but his existing tutorials are pretty awesome.

I started making a randomly generated FPS roguelike..
Got way too in the weeds on level generation lol
Commented 4 years ago2020-11-09 20:27:26 UTC Comment #103027
Hi, just happen to be reading this today it might help fix your pixel distortion.
https://blogs.unity3d.com/2019/03/13/2d-pixel-perfect-how-to-set-up-your-unity-project-for-retro-8-bits-games/
Commented 4 years ago2020-12-02 08:50:50 UTC Comment #103102
Hello,
After making a couple of games with Unity myself, I would highly recommend this guy: Jason Weimann. His videos contain a lot of good practices in a very understandable manner. He has videos on full 2D games and 3D with networking (very recent).
And also check out this channel: Infallible Code, it is more talk oriented than code, but can give you a lot of insight about Unity.
There are a lot of good talks about Unity, here are two of my favorite ones: Unite Austin 2017 - Game Architecture with Scriptable Objects, Unite Europe 2017 - Squeezing Unity: Tips for raising performance

You must log in to post a comment. You can login or register a new account.