Jump to content
  • Advertisement

Unity Weekly Updates #25 - 【Intelligence】

jb-dev

942 views

Why hello there! What a nice thing to see you again! This is another entry of your favourite Weekly Update!

This time it's all about (artificial) intelligence. Most new features are linked to AI in one way or another, so let's get right to it!

Step It Up!

First, let's talk about sound!

Previously, the game was almost devoided of sounds. It was pretty miserable, but lately, I've tried to remedy the situation by adding many different sounds.

It gave a whole lot of life and overall made the game much more enjoyable. Now I've also made another big step (sorry for the pun): I've added stepping sounds.

This means that walking around now makes noise. There are also various types of sound for each type of surface.

This applies to both player and AI steps.

Those sounds are also played when the player is either going to jump or is landing from one. It's quite nice to hear and it's a pleasant way to give audio feedback for jumping.

Coming up to our senses

Second, AIs are generally smarter than before with the help of senses. Right now there are only two types of senses: hearing and communicating.

I'm All Ears

First, let's talk about hearing things. 

Previously, AIs were lacking any type of ears, meaning that they would only react to a direct line of sight or just by being in their "bubble". This meant that as long as the player avoided any of these situations no ones would be able to spot said player.

But now this all changes: AIs can "hear" sounds like footsteps and gunshots. This system works in an elegant way...

First of all, everyone sounds in the game are fully 3D. This means that a sound has a given position, and because of this there's also a spatial volume roll-off.

By using the sounds' 3D position and applying the volume roll-off we can calculate a perceived volume for each listener. We then compare that to the listeners' hearing threshold to tell whenever or not the sound is heard. If so, then there's an appropriate reaction from the listener.

Communicative

Next, there's also the communication sense. Although broad, the idea is that an AI can broadcast a message to any other ones close enough to hear it. In that sense, it kinda works like the hearing one, except it's completely silent, is exclusively for AIs and also have a meaning.

Like hearing, each message has a perceived volume (or urgency, as I like to call it) which is defined by the emitters 3D position and a spatial roll-off curve. 

Right now, each AI can choose to respond or not to a broadcasted message depending on their willingness. For example, a healthy AIs would be more akin to respond to any messages, while injured ones might be more hesitant to make a move.

Urgencies also depend on the emitter's current condition: if an enemy attacks an AI and the latter is getting dangerously close to death then the broadcasted message base urgency would be high. It's quite a complex thing to decide which is the appropriate urgency level for each message, and it also figures that it would change based on which type of AI are involved.

There are, as of now, only two types of messages:

Help

This message is sent mainly when the AI needs assistance. Right now this is mainly used when an AI is injured. The more injured the AI gets the bigger the urgency is.

Look

This message is sent when an AI wants other AI to take their attention to in a specific direction.  Right now this message is sent when AIs spots an enemy.

That's about it for messages.

Enemies reactions

Next, there's another AI upgrade. 

Enemies are now properly reacting to attacks and injuries. If the injured AI didn't spot the attacker they would try to investigate the supposed attacks. This means that the player could technically set up an elaborate trap to lure the AI near and give a lethal blow away from its friends.

Pretty insignificant on its own, but paired with the other AI upgrade this makes gameplay a whole lot better in my opinion.

Bosses

Yes, you read that right. Bosses are now technically in! (although there's a lot of bugs with their AI and whatnot)

Bosses are usually encountered at the end of a level. They guard the exit and in order for the player to advance they need to take them out.

Type of Bosses

In the finished game there would be two different types of bosses:

Sedentary Bosses

As the name suggests, this type of boss doesn't move at all. 

Instead of depending on movements to attack and escape players they would use environmental way to distance themselves from the player.

These would generally have a lot more HP than the other type of boss to try to balance things out.

Nomadic Bosses

This type of boss will, unlike the sedentary ones, be mobile and move around the room.

They're also using that mobility of theirs to control the distance between their enemies and themselves.

Boss Behaviours

All bosses will use behaviour trees to decide their behaviour and attack patterns. In general bosses attacks are split in two: their announcement and the actual attack.

Before attacking the boss need to "announce" (or telegraph) it first. The player can then easily predict attacks and plan accordingly.

There are also two types of attacks: melee or range. If the target is close enough, a melee attack is used. Otherwise, we use a range one.

Some bosses are restricted to melee attacks while others can do both. 

In the final game, there might be multiple cyclic types of attacks per bosses.

Boss death

Once the player kills the boss a reward is given and the passage to the next level is opened.

The reward got from the encounter is currently randomly chosen, but will most of the time either be pieces of equipment or relics.

The player can either dismiss or collect them. That's where the strategy part comes in!

First AESTHETIC boss

Right now there's only one particular boss that is fully modelled, textured and even animated (thanks Mixamo).

It's supposed to represent a Greek statue. (Verry AESTHETIC if you ask me.)

Here you can see it telegraphing a melee attack:

bbyh9m0o0r421.thumb.png.3b58e97e3d45120b5c17436708ce6608.png

There will be more that one boss but this is a start.

Next Week

Now that bosses are in there's still a whole lot of work ahead to really polish and fix their behaviour tree, as I'm not much familiar enough to behaviour tree and have still a lot to learn.

I also need to finish attacks so that they do damage.

So next week will be boss-themed I guess.

Other than that the work ahead of me is mostly modelling. I need to really polish each level so they feel different enough from each other to keep the interest and curiosity level up throughout the game.




0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • What is your GameDev Story?

    In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

    (You must login to your GameDev.net account.)

  • Blog Entries

  • Similar Content

    • By Tomtheseadog
      Hey guys,
      I'm having a little trouble with my point light. My light is working but the light source moves when I move my camera. I've been trying all week to fix it but at my wits end. Maybe I haven't converted it to the proper space.
      **VERTEX SHADER**
      in vec3 positions;
      in vec2 texCoords;
      in vec3 normals;
      out vec2 pass_texCoords;
      out vec3 mvVertexNormal;
      out vec3 mvVertexPosition;
      uniform mat4 projectionMatrix;
      uniform mat4 modelViewMatrix;
      uniform mat4 normalMatrix;
      void main()
      {
      pass_texCoords = texCoords;
      vec4 mvPos = modelViewMatrix * vec4(positions, 1.0);
      mvVertexNormal = mat3(normalMatrix) * normals;
      mvVertexPosition = vec3(modelViewMatrix * vec4(positions, 1.0));
      gl_Position = projectionMatrix * mvPos;
      }
      **FRAGMENT SHADER**
      in vec2 pass_texCoords;
      in vec3 mvVertexPosition;
      in vec3 mvVertexNormal;
      out vec4 out_colour;
      struct Material
      {
          int hasNormalMap;
          int hasTexture;
          vec3 diffuse;
          vec3 ambient;
          vec3 specular;
          float reflectivity;
      };
      struct PointLight
      {
          vec3 position;
          vec3 colour;
          float intensity;
      };    
      uniform sampler2D our_texture;
      uniform Material material;
      uniform vec3 ambientLight;
      uniform float specularPower;
      uniform PointLight pointLight;
      uniform vec3 viewer_position;
      vec4 calculateLight(PointLight light, Material material, vec3 position, vec3 normal)
      {
      // AMBIENT
      vec3 ambient = ambientLight * light.colour;
      // DIFFUSE
      vec3 norm = normalize(normal);
      vec3 lightDir = normalize(light.position - position);
      float diff = max(dot(norm, lightDir), 0.0);
      vec3 diffuse = diff * light.colour;  
      // SPECULAR
      vec3 viewDir = normalize(viewer_position - position);
      vec3 reflectDir = reflect(-lightDir, norm);
      float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32);
      vec3 specular = specularPower * spec * light.colour;
      vec3 result = (ambient + diffuse + specular);
      return vec4(result, 1.0);
      }
      void main()
      {
      vec4 lightResult = calculateLight(pointLight, material, mvVertexPosition, mvVertexNormal);
      out_colour = texture(our_texture, pass_texCoords) * lightResult;
      }
       
      The light source is coming from the cube in the red circle. Even the first picture the light isnt directly under the cube. If I don't move my camera and have the cube light source move around automatically the the light will stay with it. It's only if I move the camera that I get problems. The second picture i've moved my camera to the left and the light is moving with me and moving away from the cube light source.


    • By jb-dev
      This is a short .gif showing off visuals effects for the parrying mechanic
    • By Dyonisian
      Note: This article was originally published on LinkedIn.  If you enjoy my article, please click through and consider connecting with me.
       
      Can programmers art? How far can creativity and programming take you?
      I have summarized what I learned in several months into 7 key techniques to improve the visual quality of your game.
       
      "Programmer art" is something of a running joke. For those unfamiliar with the term, it refers to the "placeholder" or "throw-together" art that programmers tend to use while developing games.
      Some of us don't have the necessary artistic skills, however, sometimes we just can't be bothered to put in the effort. We're concerned about the technical side of things working - art can come later.
      Here's what this usually means -

       
      I worked on a game jam with some new people a few months ago. I just wanted to make sure that my gameplay and AI code was doing what it was supposed to do. This would have to interface with code from other teammates as well, so it was important to test and check for bugs. This was the result.
      That's not what I'm going to talk about today though.
       
      I'm going to take a different angle on "programmer art" - not the joke art that programmers often use, but the fact that there's a LOT that a programmer can do to improve the visual appeal of a game. I believe some of this falls under "technical art" as well.
       
      My current job kind of forced me to think in this capacity.
      I was tasked with visualizing some scientific data. Though this data was the result of years of hard work on the part of scientists, the result was unimpressive to the untrained eye - a heap of excel files with some words and numbers.
      There are very few people in the world who can get excited by seeing a few excel files.
      My job? To make this data exciting to everyone else.
      My task was to visualize connectome data for a famous worm known as C. Elegans, made available by the wonderful people working on the OpenWorm project.
      Part of the data parsing to read and display the data as a worm's body with neurons on it was done by my teammate. My main task was to improve the visuals and the overall graphical quality.

       
      The first thing that comes to mind is using HD textures, PBR materials and high-poly models. Add in a 3D terrain using a height map, some post-processing and HDR lighting, and BOOM! Gorgeous 3D scene. I'm sure you've all seen loads of those by now.
      Except, almost none of that would really help me.
      The idea was very abstract - neurons and connections visible in a zoomed-in, x-ray-like view of a worm. I don't think rolling hills would have helped me much.
      I had no 3D modelling skills or access to an artist - even if I did, I'm not sure what kind of 3D models would have helped.
       
      As a result, what I've made isn't a gorgeous 3D environment with foliage and god-rays and lens flares. So it's not applicable in every case or the perfect example of how a programmer can make a gorgeous game.
      But, it does provide a distinct viewpoint and result. The special sets of constraints in the problem I had to solve led to this.
      So here's what I actually did:
       
      The 7 things I did to improve the visuals of my Unity game
      1. Conceptualizing the look
      This could be considered a pre-production step for art or any visual project. Ideally, what should it look like? What's the goal? What are your references?
      In this case, the viewer had a hologram-like feel to it (also there were plans to port it to a HoloLens eventually). I liked the idea of a futuristic hologram. And the metaphor of "AI bringing us towards a better future".
      So what were my references? Sci-fi of course!
      My first pick was one of my favourite franchises - Star Wars. I love how the holo-comms look in the movies.

       
      Holograms became a key component of my design.
      This is a HUD design from Prometheus that I found on Google -

       
      In this case, the colours appealed to me more than the design itself. I ended up basing the UI design on this concept.
       
      Key takeaway - Your imagination is the very first tool that helps you create impressive art. Use references! It's not cheating - it's inspiration. Your references will guide you as you create the look that you want.
       
      2. Shaders can help you achieve that look 
      I had some shader programming experience from University - D3D11 and HLSL. But that work had been about building a basic graphics engine with features like lighting, shadows, and some light post-processing. I had done some light Shader programming in Unity before as well.
      What I really needed now was impressive visual effects, not basic lighting and shadows.
      I was really lucky that this was about the time Unity made Shader Graph available, which made everything much easier. I can write Shader code, but being able to see in real time what each node (Which can be considered a line of code) does makes it so much easier to produce the effects you want.
      I familiarized myself with all the samples Unity had included with this new tool. That wouldn't have been enough though. Thankfully due to my previous experience with Shaders, I was able to make some adjustments and improvements to make them suit my needs.
      Some tweaking with speed, scaling, colours, and textures led to a nice hologram effect for the UI panels.

       
      I wanted the viewer to feel good to interact with as well, and some work implementing a glow effect (alongside the dissolve effects) led to this -
       
      Key takeaway - Shaders are an extremely powerful tool in a Game Programmer's repertoire. Tools like Unity's Shader Graph, the old Shader Forge asset, and Unreal's material editor make Shaders more accessible and easier to tune to get the exact look you want.
      PS - Step 5 below is also really important for getting a nice glow effect.
       
      3. Visual Effects and Animations using Shaders
      I was able to extend the dissolve and hologram shaders to fake some animation-like visual effects.
      And a combination of some timed Sine curves let me create an animation using the dissolve effect -
       
      The work here was to move the animation smoothly across individual neuron objects. The animation makes it look like they're a single connected object, but they're actually individual Sphere meshes with the Shader applied to them. This is made possible by applying the dissolve texture in World Space instead of Object Space.
      A single shader graph for the neurons had functionality for colour blending, glow, and dissolve animation.
      All of this made the graphs really large and difficult to work with though. Unity was constantly updating the Shader Graph tools, and the new updates include sub-graphs which make it much easier to manage.
      Key takeaway - There is more to shaders than meets the eye. As you gain familiarity with them, there are very few limits to the effects you can create. You can create animations and visual effects using Shaders too.
       
      4. Particle systems - more than just trails and sparks
      I have no idea why I put off working with the particle systems for so long!
      The "neurons" in the viewer were just spheres, which was pretty boring.
      Once I started to understand the basics of the particle system, I could see how powerful it was. I worked on some samples from great YouTube tutorials - I'm sharing a great one by Gabriel Aguiar in the comments below.
      After that, I opened up Photoshop and experimented with different brushes to create Particle textures.
      Once again, I referred to my sources of what neurons should look like. I wanted a similar look of "hair-like" connections coming out of the neurons, and the core being bright and dense.
      This is what it looked like finished, and the particle system even let me create a nice pulsating effect.
       
      Part of my work was also parsing a ton of "playback data" of neurons firing. I wanted this to look like bright beams of light, travelling from neuron to neuron. This involved some pathfinding and multi-threading work as well.
       
      Lastly, I decided to add a sort of feedback effect of neurons firing. This way, you can see where a signal is originating and where it's ending.
       
      Key takeaway - Particle systems can be used in many ways, not just for sparks and trails. Here, I used them to represent a rather abstract object, a neuron. They can be applied wherever a visual effect or a form of visual "feedback" seems relevant.
       
      5. Post-processing to tie the graphics and art together
      Post-processing makes a HUGE difference in the look of a game scene. It's not just about colours and tone, there's much more to it than that. You can easily adjust colours, brightness, contrast, and add effects such as bloom, motion blur, vignette, and screen-space reflections.
      First of all, Linear colour space with HDR enabled makes a huge difference - make sure you try this out.
      Next, Unity's new post-processing stack makes a lot of options available without impacting performance much.
      The glow around the edges of the sphere only appears with an HDR colour selected for the shader, HDR enabled, and Linear colour space. Post-processing helps bump this up too - bloom is one of the most important settings for this.
      Colour grading can be used to provide a warm or cool look to your entire scene. It's like applying a filter on top of the scene, as you would to an image in Photoshop. You can completely override the colours, desaturate to black and white, bump up the contrast, or apply a single colour to the whole scene.

       
      There is a great tutorial from Unity for getting that HD look in your scenes - if you want a visible glow you normally associate with beautiful games, you need to check this out.
       
      Key takeaway - Post processing ties everything together, and helps certain effects like glows stand out.
       
      6. Timing and animation curves for better "feel" 
      This is a core concept of animation. I have some training in graphic design and animation, which is where I picked this up. I'm not sure about the proper term for it - timing, animation curves, tween, etc.
      Basically, if you're animating something, it's rarely best to do it with linear timing. Instead, you want curves like this -

       
      Or more crazy ones for more "bouncy" or cartoon-ish effects.
      I applied this to the glow effects on the neurons, as I showed earlier.
      And you can use this sparingly when working with particle systems as well - for speed, size, and similar effects. I used this for the effect of neurons firing, which is like a green "explosion" outwards. The particles move outwards fast and then slow down.
      Unity has Animation Curve components you can attach to objects. You can set the curve using a GUI and then query it in your C# scripts. Definitely worth learning about.
      Key takeaway - Curves or tweens are an animation concept that is easy to pick up and apply. It can be a key differentiator for whether your animations and overall game look polished or not.
       
      7. Colour Palettes and Colour Theory - Often overlooked
      Colour is something that I tend to experiment with and work with based on my instincts. I like being creative, however, I really underestimated the benefits of applying colour theory and using palettes.
      Here's the before -
       
      Here are some of the afters -
       
      I implemented multiple themes because they all looked so good.
      I used a tool from Adobe for palettes, called Adobe Colour - link in the comments.
      I basically messed around with different types of "Colour harmony" - Monochrome, triad, complementary, and more. I also borrowed some colours from my references and built around that.
      Key takeaway - Don't underestimate the importance of colour and colour theory. Keep your initial concept and references in mind when choosing colours. This adds to that final, polished look you want.
       
      Bonus - consider procedural art
      Procedural Generation is just an amazing technique. I didn't apply it on this project, but I learned the basics of it such as generating Value and Perlin noise, generating and using Height maps for terrains, and generating mazes.

       
      Procedural art is definitely something I want to explore more.
      A couple of interesting things (Links in the "extra resources" section below) -
      Google deepdream has been used to generate art. There's an open-source AI project that can colour lineart. Kate Compton has a lot of interesting projects and resources about PCG and generative art. I hope this leads to tools that can be directly applied to Game Development. To support the creation of art for games. I hope I get the opportunity to create something like that myself too.
      Conclusion
      These 7 techniques were at the core of what I did to improve the visual quality of my project.
      This was mostly the result of the unique set of constraints that I had. But I'm pretty sure some famous person said: "true creativity is born of constraints". Or something along those lines. It basically means that constraints and problems help channel your creativity.
      I'm sure there is more that I could have done, but I was happy with the stark difference between the "before" and "after" states of my project.
      I've also realized that this project has made me more of an artist. If you work on visual quality even as a programmer, you practice and sharpen your artistic abilities, and end up becoming something of an artist yourself. 
       
      Thanks for reading! Please like, share, and comment if you enjoyed this article.
      Did I miss something obvious? Let me know in the comments!
       
       
       
       
       
      Extra Resources
      OpenWorm project
      Great tutorial by Gabriel Aguiar
      Unity breaks down how to improve the look of a game using Post processing
      Another resource on post-processing by Dilmer Valecillos
      Brackey's tutorial on post-processing
      Adobe Colour wheel, great for colour theory and palettes
      An open-source AI project that can colour lineart
      A demo of generative art by Kate Compton
       
      Note: This article was originally published on LinkedIn. If you like it, please click through, get in contact, and consider connecting.
    • By INTwindwolf
      THE PROJECT

      INT is a 3D Sci-fi RPG with a strong emphasis on story, role playing, and innovative RPG features such as randomized companions. The focus is on the journey through a war-torn world with fast-paced combat against hordes of enemies. The player must accomplish quests like a traditional RPG, complete objectives, and meet lively crew members who will aid in the player's survival. Throughout the game you can side and complete missions through criminal cartels, and the two major combatants, the UCE and ACP, of the Interstellar Civil War.
      Please note that all of our current positions are remote work. You will not be required to travel.
      For more information about us, follow the links listed below.
      INT Official website
      IndieDB page
      Also follow social media platforms for the latest news regarding our projects.
      Facebook
      Twitter
       
      TALENTS NEEDED
      3D Animator
      3D Character Modeler
      3D Environment Modeler
      Unity Engine Programmer
       
      REVENUE-SHARE
      The project is marching increasingly closer to be ready for our crowd-funding campaign. Being an Indie team we do not have the creative restrictions often imposed by publishers or other third parties. We are extremely conscientious of our work and continuously uphold a high level of quality throughout our project.
      We are unable to offer wages or per-item payments at this time. However revenue-sharing from crowd-funding is offered to team members who contribute 15-20 hours per week to company projects, as well as maintain constant communication and adhere to deadlines. Your understanding is dearly appreciated.
       
      TO APPLY
      Please send your Cover Letter, CV, Portfolio (if applicable), and other relevant documents/information to this email: JohnHR@int-game.net
      Thank you for your time! Please feel free to contact me via the email provided should you have any questions or are interested to apply for this position. We look forward to hearing from you!
      John Shen
      HR Lead
      Starboard Games LLC
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!