Showing posts with label AI. Show all posts
Showing posts with label AI. Show all posts

Saturday, November 12, 2022

SECRET KEEP - Dev Video 19 - "Knight / Guard - Locomotion Base Layer"

A little Dev Video about tackling Character Animation in Unity.

I'm trying to get my head fully around how to use Root Motion versus In Place animations, setting up good motion and blending on animations, etc.

Character Animation really gets into this vortex of where models, animations, AI, behaviours and logic all come together!  It's complex!

Making some progress...  :D


Tuesday, February 26, 2019

Real Time Strategy - Experiments & Prototypes

After my unsuccessful funding application for Broken Signal, I wanted to try a fresh set of challenges and learning.  

I wanted to learn to make better looking Unity scenes, using their Terrain system, but without having to painstakingly craft everything by hand.

I spent quite some time learning as much as I could about the Unity terrain system, grass and details, splat textures, etc.  (This is an ongoing process!)

For this terrain, I was just getting started experimenting with things like:

  • Loading in heightmap data from a "height data texture".
  • Applying splat maps (textures), grasses and trees based on height and slope information.  
(It doesn't look that great here, but I've since taken that a lot further!)

I then worked on having characters be able to move around and respond to player-commands and such.  




I'm trying to get a broader and deeper understanding of more programming concepts, and this little RTS project taught me some new things.

This video just shows the basics of being able to select units, and tell them to move or attack.

Enemy units then attack back in response, targeting the person who attacked them.

I've since experimented further with IK systems for the units to look at their target, and have their feet align to the normals of the terrain.

And I've also made it so the enemies have perception, and if they sense you approaching, they'll target your units and attack on their own.

I want to experiment with this further, along with my terrain generation project, to experiment with more of a living medieval fantasy environment, where units can go about their daily business, and respond dynamically to changes in the environment, such as buildings being built or destroyed, and altering their behaviours based on their needs and the changes in the world.


Monday, August 27, 2018

ROMERO - Dev Video #10 - Post Processing V2, Explosions, Stealth

OK!  I've upgraded the project to Unity 2018.2, and gone through and cleaned up the code base, and upgraded things that were either deprecated or dodgy.



Post Processing V2
I've deleted all the Image Effects of old and moved to Post Processing V2, and it's great!

You can set up a Post Processing Volume, which can be applied to the gameplay camera globally, then have another global volume for "Slow Mo" effect, which can be "weighted in" as needed, using a lerp.  Quite easy once you get your head around how it's all designed to work.

I went a bit crazy with the effects...  just a bit.  Added lots of bloom, grain, vignette, and dirt on the lens.  Shall tone that back in due course.  ;)

Explosions
Reworked my explosions so they are triggers instead of colliders.  (It was super stoopid before).  Now enemies get hurt if they touch an explosion trigger, and take damage based on how far they are from it, and also a killing explosion will add force to the player based on direction and distance.  (Feeling like I'm getting better at working with Vector3 math these days!).

Stealth
Upped the stealth values so they come into play properly again these days.  Player can now hide in the shadows, but once they trigger an enemy's attention, their alertness values go higher, and they will now spot you in shadows, and you'll have to run away and hide for a bit to lower their alertness levels back down again.


THE FUTURE

Cleaning up!
So, I'm feeling pretty good about having cleaned up the project, ready to start on some new features.  There's still some things to clean up, like...

  • Making the enemy pathfind smoothly even if you are currently out of reach - they are a bit jerky at the moment, sorta stuck between two states.
  • Making the drone fly around with drone sounds, and tilting into movement, and rotating smoothly at all times - generally making them look and feel more physically believable.
  • Turning the effects down to a reasonable level!  :D

What's next?
Looking further into the future, my design goal are to...

  • Play around with another 3 or 4 systems / tools / mechanics - get a core set of things into the sandbox that feel fun, and work together nicely, and create something a bit more unique.
  • Then build a single level that really puts all those elements to the test, together, in context.  Give the player an objective, and have it balanced to be a challenge to use all your wits and abilities to reach that goal.


Sunday, August 19, 2018

ROMERO - Dev Video #9 - Putting it all together

A quick video showing some highlights from putting everything together in the level.

I added some collections of glowy screens / window-lights.




So there's the baddy cyborg froods, the slow-mo ability, and the drones flying around, along with keys and doors.

It's all a bit clunky currently, and I need to go through and clean up / smooth out the keys and doors, the way explosions look and feel, and how explosions react with enemies.

Gotta get drones flying around a bit better, with sounds and tilting.

Lots of tweaking and cleaning up to do!




Wednesday, August 15, 2018

ROMERO - Dev Video #7 & #8 - Drone AI

I've started working on a new AI type... a DRONE!

It's inspired a bit by the "manhacks" from HL2, at least in terms of getting it moving.

It may be a meany, or it may be friendly. Maybe some of each.


In the first video, I've just got it doing basic hovering movement.

I'm looking to do AI in a fashion that lets them navigate spaces dynamically, as I'm considering procedurally generated levels.


I'd also like my humanoid enemies to be able to jump, climb, etc, so I don't really want to just be tied to a NavMesh.



The second video steps through some more stages of progress with the Drone.



I got it moving to a position in space, which I'd move around by hand, just to get that working and visible. Then I got it moving to random points around itself.

Then I made it so that if it sights the player it moves to random points around the player, as if tracking/following them. Next up... I want to start adding "vibe" to it, though tilting into movements, and having cool sounds that match it's motions. It needs to be smoothed out and made more fluid, and also to only move to points that are comfortably far from the ground and walls.


Sunday, February 11, 2018

ROMERO - Dev Video #4 - Reach to the Radio Tower!

Here's I've tweaked up the level layout a lot!  

Note It's hard!  This video shows two failed attempts.  :D

OBJECTIVE: "Reach the Radio Tower to win the level!"




Lots of little fixes and improvements:

  • Improved "grounded" check:  I now use four spaced raycasts near your feet, to check if you're grounded, even when near an edge.  It now reliably jumps all the time, allowing for much more control!
  • Prevent the player from pushing through walls:  I use a raycast to check in the direction that you are trying to move, and scale down the movement if something is in the way.
  • Tumbling death: Player falls over / tumbles when killed (detach camera, add force and torque, and have it bounce around).




Thursday, February 8, 2018

Romero - Dev Video #3 - Better bullets!

Here I've improved the bullet behaviours...
  • Added sounds for collisions & tinkling.
  • Muzzleflash & bullet trails.
  • Bullets falls to the ground after colliding with things.




I'm also trying out a few different musical tones, using some existing tracks I've made over the years.  :D

Definitely thinking about making a full game out of this!

Something small, 3 - 5 missions.



Monday, February 5, 2018

Romero - Dev Video #1 and #2 - More AI behaviours & player hitpoints

Get ready to SUCK IT DOWN!  

"Romero Plissken" is back, in this cyborg-exploding grenade-imbibing game of generic Quake-like action.  Hehehe.

I'm building an action game system, basically from the ground up.

I'm starting off just focussing on a Quake-like shooter, to get down the basics of creating NPCs.  

Getting a character moving around using a skinned mesh, Mecanim, NavMesh  and AI code.

Ultimately, I want to build a versatile AI character for Unity that I can apply to all sorts of different circumstances:

  • Guards, in a fantasy game.
  • NPCs, who walk about town.
  • Characters in a scripted cutscene.

An ecology sim of different characters, creatures, agents.




Dev Diary #002

Enemy AI
  • Here I've made the enemy attacks hurt the player, and if the player dies it restarts the level.  
  • The Soldier has Grenade attack, and at some point will also have a MG attack, probably firing short bursts.
  • The Slicer has a Melee slice attack.
  • The Kamikaze runs at you and Explodes.
  • Explosions hurt the player and also nearby enemies.

The AI characters also have different sensory attributes based on their state.  
  • Once they have sighted you, they go into a heightened alertness state (Chasing) and aggressively try to track you down.  
  • When in the Chasing state, they have 360 degree vision (to prevent you from just "running behind them" to elude them), and a greater ability to detect the player at greater distances, and in less light.  
  • If they lose line of sight with you, or drop below a threshold of visibility of you (considering distance and lightness), then after 5 second they drop back to their Neutral state.  This is when you have escaped, and eluded them.

Dev Diary #001

I started this project at Global Game Jam 2018... and here's where it was after that first weekend.




Friday, January 12, 2018

Low poly 3D scan of myself in Unity - Mixamo rigging & animations

I'm excited to have discovered a workflow to get a fairly quick and easy 3D scan (using my HP laptop with a RealSense camera) of a person (myself in this case) to rig and put into Unity via Mixamo.



I feel that this may finally provide me with a workflow to have characters in my games.  I'd like to try making a GUARD character, by scanning someone dressed up in a costume as a guard, then apply animation to that, and work on the AI from there.  :D


Here I've reduced the poly count of the character from about 100,000+ down to 2000 polys.  I think I could keep it higher, and also tweak or stylize the texture more.  A good start, though!



Second iteration:

Tweaked up the pipeline a bit, and got a much nicer looking result.



Did a new scan with more suitable clothing and room lighting.
Then reduced mesh from about 200k polys to about 10k polys, using MeshLab which is super easy and great, and kept the texture intact! And used a 41 bone rig, instead of 21 bone rig in Mixamo (although still using some of my older 21 bone animations here, so not making use of the improved hands, except on the "Sword & Shield" guy.


Here's a more detailed breakdown of the workflow so far...

SCANNING

I use ItSeez3D (free), which is designed to just scan 3D models of people, so it automates that process quite well. You just stand the person somewhere with fairly even lighting, and start scanning. You basically just walk around the person in realtime, and you can see the mesh roughly forming around the person as you go. Takes about 3 minutes to get all the way around, starting at the face, then go around the head, torso, and then arms, legs, feet and finish. 


(We tried a few times to try to get an optimal scan - if you go around too many times it can start to add extra arms or heads out of confusion! So you kinda get the hang of the scanning process and the best pose to stand in (arms out a little bit, legs a bit apart - if you try for a full extreme t-pose, we were finding it kinda barfed - I think it's designed to just scan people standing at ease, which isn't great for getting a nicely separated rig pose.)

Then you can see a quick local preview in the app, or tap Final Model to upload your data to their server, it processes it and sends back the final model. That is a bit slow, and takes about 20 minutes of waiting - mainly because the upload is slow.

Then it spits out a 100k - 200k high resolution model and texture, which you can save as an OBJ.

CLEAN UP

This gives you a pretty-much-ready-to-go model and texture, with feet separated from the floor, etc. It's basically a fairly clean human scan.

The issues that I have with the data at that stage (for my purposes) are:

  • It's too high poly for my needs.
  • Possibly some of the mesh hasn't scanned clearly, such as the legs below the crotch being joined together a bit too much, or not enough separation between thumbs and hands, etc.
  • The UV mapping is OK, but there's generally a few places (under arm pits, between crotch, perhaps top of head) where it didn't quite scan the texture, or a strange seem occurs such as the camera's auto-exposure causing a light part being butted up against a dark part, for example, or just a jaggy seem here or there).

MY WORKFLOW

So, I'm trying to simplify the steps as much as possible, but currently, I solved these issues by:

  • I used Mesh Lab to open the high poly mesh, and save it out at 10k polys. And it automatically does that in a few seconds, and keeps the texture mapped correctly! Easy, free, quick! Takes about 2 mins.
  • I opened the OBJ in Maya to tweak a few places where I didn't like the mesh separation. I had an issue where the legs were joined together a bit too high up. Tweaked it by hand. Took about 3-5 mins, just moving verts with soft selection.
  • To tweak the texture, I loaded it up in 3D Coat, and used Clone paint tool to clone things around to patch up any bits (under the arm pits, etc) that came out white, or something. I just clone nearby bits of the texture over it to cover it up. (Generally these things happen in hard-to-see places, so it worked fine to do this fairly roughly.) Took about 3-5 mins. Exported the texture again from 3D Coat.

Done!


So, my issue with the process so far is mainly just 3D Coat. I can use that at work, but I don't own it myself. So I'd love to replace that part of the process with something free! Then it'd be a very straight forward process, all using free software.

Currently, it would take about 60 minutes to scan someone and have them in Unity with their mesh and texture cleaned up a bit, including waiting about 30 mins for the initial scan to get processed through ItSeez3D.



Wednesday, January 4, 2017

ROMACK: DevLog 002 - A Quake-meets-Thief style AI system

I took these Christmas holidays to work on various fun projects.

I've been working on a Quake-meets-Thief inspired project these past few days.

Some basic AI & gameplay is taking shape!

I'm really happy to be learning new things about in C# and Unity in general. :D



I've been working on some enemies that launch grenades at the player.  They detect you by sight, taking field-of-view, line of sight, and the lightness of the player's position into account.  

I also added basic ragdolls for when they die, and they carry around torches to see with.

Here's several minutes of me just running around playing with the AI's.


Note: I'm using some sounds from Quake, but the grenade and launcher are my own models and textures.