Jump to content
  • Advertisement

Unit Vision

thecheeselover

2336 views

Subscribe to our subreddit to get all the updates from the team!

First off, here's a video that shows the unit vision in action : 

 

So, what is the unit vision? It's a simple mechanism that notifies a unit when another unit enters its vision field. It also takes into account if the vision is blocked by entities.

This is how it is implemented step by step :

  1. A cone ghost control is attached to the unit's head
  2. All units intersecting with the cone's AABB fire events (AABB because of how Bullet Physics work)
  3. Cast a ray towards the visible unit and then adjust the angle so that it fits in the cone
  4. If the ray cast touches the supposedly visible unit, then it is truly visible

 

Using the debug view of Bullet Physics in the jMonkey Engine 3.1, we're able to see what the vision cone actually looks like.

UnitVisionFromBehind.png.a0384bcbc7c06a11a280a8e0cf92f96c.png

UnitVisionConeFromTheSide.png.ed84913f5d96e4963c4126fccd6719a5.png

UnitVisionConeFromTheSide-2.png.458f46e114950884091d1b4065175194.png

 

And when inside the cone we can't see it because of culling. However, we can see the enemy's arm moving, which is a test I did for when a unit see another unit.

5acce1264179e_DesktopScreenshot2018_04.10-11_49_14.46(2).png.2d71b73e57da99d7494f4a99060c5268.png

 

Behind a box, the enemy does not move its arm because he can't see me.

5acce17928f5e_DesktopScreenshot2018_04.10-11_49_46.79(2).png.12a4edd9236536c0bdc28893e081d44a.png

5acce199c469f_DesktopScreenshot2018_04.10-11_49_50.47(2).png.7b7bcfbdebad80d002392903ff26a8db.png

 

But when I leave my hiding spot, he can see me again.

5acce1c9ade40_DesktopScreenshot2018_04_10-11_50_10.57(2).png.f991cdd3375c2729e6c6b807d225cd88.png



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
  • Blog Entries

  • Similar Content

    • By Data7 Games
      Project Name: SkyHarbour
      Role Required:
      - Dedicated Unreal Programmers
      My Role: Project Lead
      Previous Projects: N/A
      Team Size: 7
      Project Length: n/a
      Compensation: Rev-share until we get funding.
      Responsibilities: 
      - Must know Unreal
      - Must Know How Version Control Works
      - Advanced Programming.
      - Friendly and chilled
      Project Description: An Steampunk RPG Based in a broken land.
      Contact: please email me at data7games@gmail.com
    • By Jman2
      Hello,
      Im currently hashing states like the code sample below, is there a more elegant way of doing this? or should i just cache the hash in the struct and default 0 as being "null" and hope i dont get a collision where one eventrually resolves to 0.
      struct RASTERIZER_DESC { FILL_MODE m_FillMode = FILL_SOLID; CULL_MODE m_CullMode = CULL_BACK; VERTEX_WIND_ORDER m_VertexWind = WIND_FRONT_CLOCKWISE; int m_DepthBias = 0; float m_DepthBiasClamp = 0.0f; float m_SlopeScaledDepthBias = 0.0f; bool m_DepthClipEnable = true; bool m_MultisampleEnable = false; bool m_AntialiasedLineEnable = false; Uint32 GetHash()const { Uint32 hash = 23; hash = hash * 31 + (Uint32)m_FillMode; hash = hash * 31 + (Uint32)m_CullMode; hash = hash * 31 + (Uint32)m_VertexWind; hash = hash * 31 + (Uint32)m_DepthBias; hash = hash * 31 + (Uint32)m_DepthBiasClamp; hash = hash * 31 + (Uint32)m_SlopeScaledDepthBias; hash = hash * 31 + (Uint32)m_DepthClipEnable; hash = hash * 31 + (Uint32)m_MultisampleEnable; hash = hash * 31 + (Uint32)m_AntialiasedLineEnable; return hash; } };  
    • By malhotraprateek
      Hi,
      I have created a basic debug viewer for Bullet while working on my game engine.
      It uses three.js to render debug lines, and communicates to the application (i.e. server) via web socket.
      Link: bullet-visualization
      Included in the repo is some reference code for creating the server (C++) using the net11 library (details on github).
      For now, it can only draw debug lines (no contact points or text).
      It might be useful for de-coupling in game rendering and debug draw.
      The project is MIT licensed and contributions are very welcome ☺️.

    • By Shadowsane
      My project started in 2014 but recently ended due to no funds.  AltarisNine was a Minecraft project based on RPG. The concept was nine islands that you explore at a time to follow an in depth lore based on our own production team. This is where the 'Nine' comes in. With skepticism of future success we hope to make this tale into chapters. Such as the first one introducing Nine islands at time.
      It wasn't always the same though, my world did evolve over time and now I have a better idea of what it is better than ever. In the first island, Main Isle, is themed around jungles and wilderness. There's lore that stretches throughout the chapter which will engage the player. There would also be kinds of characters you can be such as any other RPG which could be talked about (because i'm still  about what I have lol)
      My former team was designing a world players would get into interact with in various ways. Boss battles would be minigames and the RPG lore would be engaged in and something indie platforms would enjoy and talk about beyond platforms.
      In the minecraft varient I was a builder, the leader, and the story director which everyone respected. I led my own team of builders and story writers. While I chose certain individuals to be the head department of development and art design.
      The reason I am here is to find a new team to help take this away from minecraft and hope we can be successful about it. I'll happily commute each and every person that volunteers and will be accommodated down the line with promotions, wages, and definitely praised for helping start my dream up.

      Here are some questions that were frequently asked and that I can thoroughly answer:
      What is the goal of the game? If you've ever heard of Wizard101. I got inspired by that game a little. I like the concept of making yourself in this world of mystery and impressing people with new mechanics and events that they enjoy. I'd like for the game to be successful and be mostly on PC but if this keeps up we could reach out to other consoles. But for now, PC, one platform at a time lol. My goal personally is to give people the entertainment and enjoyment I think they'll deserve. Something thats not cheesy, not cliche, something new to keep evolving the gaming community Is this in first-person or third-person? This will be a third person game. We can play around with the camera angles but I kind of want it from a aerial pov I saw RPG in the post so can I assume that the game will have generic RPG elements, e.g. quests, npcs, story-line, items? Yes this will have generic RPG elements. But with a few surprises that make the game different. Such as making boss fights some type of minigame. I don't know how the audience will like or even if it'll flow with game play. But I'd still like to take the idea on for now. Will there be combats, e.g. vs. monsters, vs. players(?) ? There will be tons of concepts. As i've said before the 'Nine' comes in the Nine isles of this world we haven't named yet lol. Each nine islands we come up with will not only give players plenty of content to play, but something we break up into story chapters. Each island will have its on set monsters tied to the story or even monsters that are just natural in their environment. There will also be a PvP aspect which can't be brought up too much because its difficult to try to come up with a player style culture that isn't too predictable or generic or even cliche. I was wondering if it should be an initiated fight or a head on duel like world of warcraft. Is this a single player game or a multiplayer one? Definitely multiplayer. Will the game look like Minecraft? like a voxel/blocks game? I imagined it not looking like minecraft but maybe that can be a concept of its own down the line (like an island concept). I was thinking along the lines of a 3D style and not like minecraft. What are the core mechanics to be included, e.g. player movement, enemy movement, enemy AI? This question is more technical but there will be interactive things in the world, things to collect, natural occurring crafting supplies to make new loot and weapons with. There will be NPC's and thats a broad topic enough lol. I'd even a imagine a pet, housing, and gardening system. But thats for accessories in coding and to give more content in the game for later polishing. Is there a storyline already made? There is an indirect storyline. We've made a script for voice actors (and just what to make the NPC's say in general) in A9 v1. Are there goals already planned out? There are many goals to set out. One each at a time for separate upcoming departments The first 8 pictures were of our hub, the other 9 was our factions world. The factions world doesn't retain to this project I wanted you to see how dedicated I was to making this project. I built everything in the hub myself except for the giant pagodas. The last two photos were all the ones I could find of the RPG world
       




















    • By Octane_Test
      I want to render an ocean where players can change waves’ amplitude in real-time. Initially, I would render rolling waves (see picture). As the amplitude increases, I need to transition the rolling waves into breaking waves (see picture). For now, I am not going to show the shoreline onscreen so I don’t need to render breaking waves interacting with the shoreline; I only need breaking waves on the open ocean.

      I’ve tried three different approaches so far and I’ve only had success with rolling waves using approach 1. Breaking waves have been impossible so far with all three approaches.

      Approach 1: Mesh deformation

      a.     I can create smooth rolling waves using the Sine and Gerstner equations.

      b.     Since I can’t use these equations for breaking waves, I tried to implement them by using this free plugin whose output is similar to this paid mesh deformation plugin. But there are 2 problems with this plugin approach:

      ·      There is no smooth transition between rolling waves generated by approach 1a and the breaking waves generated by the Deform plugin

      ·      The output of the plugin does not look similar to real breaking ocean waves in three different ways:

                                                     i.     No smooth blending with the ocean surface

                                                    ii.     A large depression is created below the crest

                                                  iii.     The entire wave is the same height (rather than with more realistic variations)

      c.      I considered using vertex shaders but this approach seems similar to mesh deformation.

      Approach 2: Fluid dynamics + metaballs

      1.     To render an ocean I will need thousands of particles which will be too expensive in terms of performance (especially for mobile devices).

      Approach 3: Using mesh files

      1.     I can create breaking waves using some 3D software like in this post but then I can’t modify the ocean in real-time. It will be more like a pre-rendered simulation.

      To summarize, I am looking for an approach where I can vary ocean waves’ amplitude for a smooth transition between rolling waves and breaking waves. Please let me know if you have more questions.

  • Advertisement
×

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!