Just getting ....

Started by Alienhead, January 09, 2024, 04:56:42

Previous topic - Next topic

Alienhead

Just getting started with Unity, I wanted to do some webGL stuff and the engines I use don't support it, so after experimenting with godot and unity for a few weeks I've decided Unity is what I will use.  Heh, lesser of two evils?

Whoa, what an ecosystem Unity has though, I've been working with game engines all my life, but this Unity seems like it's going to be challenging.

More later !

3DzForMe

Had a dabble with Unity a while back, hows it going?
BLitz3D, IDEal, AGK Studio, BMax, Java Code, Cerberus
Recent Hardware: Dell Laptop
Oldest Hardware: Commodore Amiga 1200 with 1084S Monitor & Blitz Basic 2.1

Kronos

I must be getting old because I just can't get my head round these modern engines like Unity, Godot, Flax Engine etc. So many controls for everything.

Alienhead

Quote from: 3DzForMe on January 13, 2024, 03:57:40Had a dabble with Unity a while back, hows it going?
It's a lot different from engines I have used in the past.  I really hate a game engine that tries to do everything for you. It ultimately just gets in the way. But I'm getting along with it, making a few components which i will need later on.  The coding side of things is a breeze with unity, c# isn't hard to pick up if you know any other language whatsoever.  The hardest part has been getting my head around their graphical workflow, but even that is starting to make sense to me now..  not sure if thats good or bad hehe.

Alienhead

Quote from: Kronos on January 13, 2024, 12:27:15I must be getting old because I just can't get my head round these modern engines like Unity, Godot, Flax Engine etc. So many controls for everything.
Flax Engine is very very nice.  I would had picked it over Unity if it weren't for me needing some WebGL support. Flax engine seemed superior to me over Unity in nearly every aspect. 

Alienhead

#5
Day 7, I've actually got a third person controller made, and I got the basis of a map working, really just learning the API thus far. I fear the 'Unity' way is starting to make sense to me now. Not saying that I like their approach but if that's what Unity offers and if I want to use Unity for their webGL support I must surrender my old ways and adapt. :(

This is running in WebAssembly, which is my overall goal to begin with. Picked up a low-poly asset pack ( was like 50% discount ) which had prefabs already in it so I was able to get right into the API and code without having to dibble to much in the art pipeline just yet.

ChatGPT has been a huge help, when I get stuck - instead of combing the unity forums or watching hours upon hours of meaningless tutorial videos - I turn to chatgpt and ALWAYS get/got a direct answer to my problem. I doubt I would had gotten off the ground with Unity unless for chatgpt. :)

I'm wanting to get into WEBGL distribution mainly for the itchio game jams. I had come to learn that webside games are reviewed and played 80% more than standalone entries when it comes to the jams. Of course if I was ever to release a steam game it would be a desktop install but for the game jams I'm going strictly webGL.

Next is getting myself familiar with the Shader graph then bullets! and joystick response over web assembly! Wish me luck :)>


blinkok

I would love to know how you navigate the scene objects with the camera. What is the logic?

Alienhead

#7
Sure!,  this is a VERY simple tpc I worked on today.

Quoteusing UnityEngine;
public class ThirdPersonController : MonoBehaviour
{
   
public float speed = 6.0f;        // Character movement speed
    public float rotationSpeed = 300.0f; // Character rotation speed

    private void Update()
    {
       
// Get input axes
        float horizontal = Input.GetAxis("Horizontal");
       
float vertical = Input.GetAxis("Vertical");
       
// Calculate movement direction
        Vector3 movement =
new Vector3(horizontal, 0.0f, vertical);
        movement.Normalize();
// Ensure diagonal movement is not faster

        // Calculate and apply movement
        Vector3 moveDirection = Camera.main.transform.TransformDirection(movement);
        moveDirection.y =
0.0f; // Keep the character grounded
        transform.Translate(moveDirection * speed * Time.deltaTime, Space.World);
       
// Rotate the character to face the direction of movement
        if (movement != Vector3.zero)
        {
            Quaternion toRotation = Quaternion.LookRotation(moveDirection, Vector3.up);
            transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, rotationSpeed * Time.deltaTime);
        }
    }
}

The camera is just parented to the player object and is pulled around with the rig.

Alienhead

#8
Getting to know the shader graph is a whole nother' beast in Unity.  And I can see that most everything I want to do revolves around shader work.. 

In the video lessons I watched on Shader graphing in Unity, I was able to create a dissolve shader, for when the player is blocked by some other object.

You may notice some of the house is hidden to unblock the view of my player.
Hey it's a start, my first unity shader hehe.

To be honest, I've been working with game engines since the early DB days and before that actually ( ti994a) and I feel so overwhelmed by Unity, it's just to massive to try and pick up everything. I'm hoping to learn just the parts I need to make some kinda little webgl game then hopefully I can build on that knowledge with another game project etc etc..  If you are new to unity, and I am, looking at the big picture is enough to scare anyone away.  



Alienhead

#9
I'm actually having a lot of fun with the Shader graph feature in Unity, its quite powerful! I don't miss having to debug on shader toy anymore :)

Here's a toon shader implemented as a post-effect and not a per-material pass.  Needs some more "rim" tweaking, but again I'm just learning so like a bottle of wine.... it'll get better with time.



Next up ... to SSAO or AO...  this is the question. Although the question may be answered for me already, I'm not sure webgl supports screen spacing. Soooo most likely I'll try to work some standard ao in there.

Matty

In my opinion the biggest difference between engines like Unreal and Unity versus those with older tech like Blitz3d is that if you want a realistic looking 3d scene you mostly just put the models in, turn on the lights, and make sure the objects have the correct material settings and it looks like a somewhat realistic scene. Whereas in blitz and older tech you pretty much have to do a whole heap of fakery and tricks to make scenes look somewhat real. That's a gross simplification, but it's akin to how with the old 8 bit arcade games the developers had to pull all sorts of hardware tricks sometimes to do things that today we just throw a bunch of sprites at the screen and the hardware is all powerful enough to do everything needed by default.

Alienhead

#11
One thing I've noticed and I don't like at all with unity is each and everything you add to the system requires tons of optimization. 

For example, I wrote a little small script to check for impact with a bullet layer, if found it breaks a plane ( simulated breaking glass ).  I was wondering why my FPS dropped about 60% just by initiating this script in game.  I later found out that collision checking is another world in Unity.  Setting up collision layers for do's and don't s is a major requirement in unity if you want to do anything special and keep your FPS rate normal.  I since optimized it but what a pain in the ***.  You literally have to optimize and stress test any and everything you add to the engine. Perhaps this is because I'm so new to the engine, like anything else  - with time you pick up on the do's and dont's and then you don't really have to to pay such attention to optimizing on every little thing you do.

Excuse the choppiness, my Radeon gpu doesn't record and play at the same time near as good as my nvidia, and the AMD is about 6 years newer than my nvidia! Ha, go figure.  From here out I'm sticking with nvidia. ( Radeon RX 6800 XT vs  Geforce GTX 1080. )



I'm wondering if this would be a good stopping point, I would like to spend the same amount of time in Godot and replicate the exact same scene just to see and compare the differences in dev time, difficulty level and performant variables.. Hmm however, I don't think godot offers shadowing in WebGl builds.. I need to check up on a few things first - I suppose.  

More later !

Matty

I like the video but some tips that you might consider:

Adding some kind of at least a blob shadow beneath the character would make it look like he's walking on the ground more...without it it doesn't always look like he's walking on the ground.

In terms of frame rate - it feels as if the framerate is a little choppy for just a single animated character walking around.

Other than that though it does look quite nice. The cell shading is good too.

Alienhead

#13
Thanks for the comments. 

A couple things, in that video the game was actually running at 300+ FPS,  The rig I'm on has AMD gpu in it and their video recording software is horrid.  I so miss my nvidia. :(

Another thing, this is html5 build, so things arent 100% smooth as they are with a regular desktop build.  I switched the target over to PC and did a test build and i was getting over 600 fps with that scene.

And another thing to consider, I'm 8 days into learning Unity, no question I'll pick up on tons of optimizing techniques in the near future.

I've ditched Unity's shadowing shaders in favor of Shader graphing me some more up to date soft shadows, those unity hard shadows I cannot stand. :)

Anyways, appreciate the comments, always good to hear something from someone else.

Revision - screenshot:



The terrain is nothing more than parallax mapping with a slight touch of tessellation ( although tessellation does not work in webgl, Im going to leave it in for pc builds ), Unity has a gorgeous 'displacement' system at it's core. It's just a matter of getting your heightmaps just right so they look real in realtime.

Qube

Great progress ;D

Unity does soft shadows too, not just hard shadows. Not sure if you are doing this but if you Instantiate objects then your FPS can take a hit whilst it does it, so object pooling is the recommended method.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.