Search Unity

WIP Small Works Game / Programming Thread

Discussion in 'Works In Progress' started by Tim-C, Aug 6, 2012.

  1. dan_wipf

    dan_wipf

    Joined:
    Jan 30, 2017
    Posts:
    170
    Some progress is made with my bezier fence system.

    That’s new:
    - Adaptive Fence Spawning
    - Correct Spawn Distance aspects on uneven Surface.
    - New UI (well cheanges the whole time)
    - Three Choosable Styles for Spawning Prefabs
    - Performance consumption Reduction

     
  2. Brian-Crandell

    Brian-Crandell

    Joined:
    Apr 3, 2013
    Posts:
    62
    Hello, folks. Just seeing if anyone's interested in a visualization of my first major A* test. The path traces from lower left to upper right, avoiding the red obstacles. Green is the closed set, while light green is the open set.



    Unity's navigation has come a long way, especially now that it allows agents with different radii, but I'm interested in creating my own solution. A major reason is to have access to navmesh polygon data, since it seems Unity still likes to hide things. I've completed a successful test with RVO2 Library (glad to see that's open source now), then I'll adapt A* to navmeshes and try Recast for generating the actual mesh.

    Anyway, this test seems inefficient due to how complex the grid is, including the maze-like bit at the end. It made more sense to me after I displayed g and f scores on each tile. If it really seems inefficient, or if anyone has other feedback, I'd love to know!
     
  3. reallyjonas

    reallyjonas

    Joined:
    Jun 14, 2013
    Posts:
    3
    I've been working on on a 2D action RPG for some time. The plan is to build up a collection of scripts which would make it easy to build different games by switching the assets without needing to change the scripts. The long term plan is to offer it on the Asset store to see if there is any interest. Or make a full game if I find the time.

    I've come quite far and try to make simple assets (as I'm no artist) with subtle lighting effects to make a sample scene.
    My main issue right now is the environment and level design. I'm not using a tilemap, I instead place large sprites with a sliced texture. This is quite limiting but makes it very simple to build a level with just one asset.

    The latest version looks like this:


    I think the next step will be to think about some automatic level generator, and maybe use 3d blocks for the walls to enable shadows.
     
    GarBenjamin likes this.
  4. MuhsinK

    MuhsinK

    Joined:
    Dec 12, 2010
    Posts:
    194
    Grappling Hook or Infinite Rope?

     
    Metron, Slaghton and RavenOfCode like this.
  5. MuhsinK

    MuhsinK

    Joined:
    Dec 12, 2010
    Posts:
    194
    Untangling your Grappling Hook

     
    RavenOfCode and dan_wipf like this.
  6. Roni92pl

    Roni92pl

    Joined:
    Jun 2, 2015
    Posts:
    262
    2D grid for spatial queries. What's great about grid based spatial queries is that it's size, or amount of entities in it doesn't affect queries performance.
    Whole system is runinng asynchronously and takes less than .5ms for updating 1k entities on grid.
    Turns out it can be used for rasterization also as you can see in video lol! :D ;
     
    RavenOfCode likes this.
  7. PhantomProgramming

    PhantomProgramming

    Joined:
    Jan 16, 2019
    Posts:
    54
    I've been working with the unity navmesh system and have been trying to get a smooth amount of 1000 navmesh agents all with targets, models, and animations. Sadly my FPS drops insanely low. When I checked the profiler, it said the main issues were scripts and physics.
    Does anybody know how to optimize physics?
    I'm also currently using this as my AI location script.
    Any ideas on how to optimize it?

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.AI;
    5.  
    6.  
    7.  
    8. public class AILocate : MonoBehaviour
    9. {
    10.  
    11.  
    12.     public LayerMask detectionLayer;
    13.     private Transform myTransfom;
    14.     public NavMeshAgent myagent;
    15.     private Collider[] hitColliders;
    16.     private float checkRate;
    17.     private float nextCheck;
    18.     public float detectionRadius = 180;
    19.     public bool moving = false;
    20.     public float extraRotationSpeed;
    21.     public float AI_Delay = 0.1f;
    22.  
    23.  
    24.  
    25.  
    26.  
    27.     // Start is called before the first frame update
    28.     void Start()
    29.     {
    30.         AI_Delay = Random.Range(0.1f, 0.8f);
    31.         myagent.enabled = true;
    32.         sir();
    33.     }
    34.    
    35.  
    36.  
    37.  
    38.     // Update is called once per frame
    39.     void Update()
    40.     {
    41.            
    42.            
    43.  
    44.     }
    45.     void FixedUpdate()
    46.     {
    47.      
    48.         StartCoroutine("DelayEnemy");
    49.        
    50.         //CheckIfInRange();
    51.         myagent.enabled = true;
    52.      
    53.      
    54.     }
    55.  
    56.  
    57.     void sir()
    58.     {
    59.        myTransfom = transform;
    60.        myagent = GetComponent<NavMeshAgent>();
    61.        checkRate = Random.Range(0.2f, 0.5f);
    62.     }
    63.  
    64.     public IEnumerator DelayEnemy() {
    65.  
    66.         yield return new WaitForSeconds(Random.value * AI_Delay);
    67.         if (Time.time > nextCheck && myagent.enabled && myagent.pathPending == false)
    68.         {
    69.             nextCheck = Time.time + checkRate;
    70.  
    71.  
    72.             hitColliders = Physics.OverlapSphere(myTransfom.position, detectionRadius, detectionLayer);
    73.             hitColliders = Physics.OverlapSphere(myTransfom.position, detectionRadius, detectionLayer);
    74.             hitColliders = Physics.OverlapSphere(myTransfom.position, detectionRadius, detectionLayer);
    75.             hitColliders = Physics.OverlapSphere(myTransfom.position, detectionRadius, detectionLayer);
    76.  
    77.             if (hitColliders.Length > 0 && myagent.pathPending == false)
    78.             {
    79.                 myagent.destination = hitColliders[Random.Range(0, hitColliders.Length - 1)].transform.position;
    80.                 //myagent.SetDestination(hitColliders[Random.Range(0, hitColliders.Length - 1)].transform.position);
    81.                 moving = true;
    82.  
    83.             }
    84.             else { moving = false; }
    85.  
    86.  
    87.  
    88.  
    89.  
    90.  
    91.         }
    92.  
    93.     }
    94.  
    95. }
    96.  
     
  8. RavenOfCode

    RavenOfCode

    Joined:
    Apr 5, 2015
    Posts:
    864
    First off, wrong section of the forum. This should be posted in scripting

    Secondly, you're starting like 100 co-routines every second by putting the startcoroutine in fixed update. Why?

    Thirdly, lines 72, 73, 74 are all useless and an expensive physics calculation. They should be removed.

    Lastly, if you want 1000 units smoothly, I'd hightly recommend ECS for increased performance.
     
    Last edited: Mar 25, 2019
  9. PhantomProgramming

    PhantomProgramming

    Joined:
    Jan 16, 2019
    Posts:
    54
    Sorry about the posting in the wrong section, I removed the coroutine and placed the code into update.
    Removed 72,73, and 74.

    Do you have any good recommendations on ECS tutorials?
     
  10. RavenOfCode

    RavenOfCode

    Joined:
    Apr 5, 2015
    Posts:
    864
    I don't see why you'd put it in update, corourtines are a good performance conscious technique. Why not just call the coroutine in start? I think you should go brush up on a what a coroutine is, as I don't think you realize what your code is actually doing.

    Brackey's has a nice intro video on it. I haven't used it much myself, but I'm sure they're other good tutorials. However, I'd recommend before you try that you'd continue learning the basics. No offense, but your code you've written is very amateur so I'd guess trying to learn multithreading is something that won't go down too well. If this mean reevaluation the scope of your game (1000's of units down to 100's), you might just have to do that.

    EDIT:

    I was looking more into the Nav Mesh system and it appears the without multithreading Unity can handle a lot more than I thought.

    This video shows thousands of Units using the Nav Mesh system without an issue. Just a though
     
    Last edited: Mar 25, 2019
  11. PhantomProgramming

    PhantomProgramming

    Joined:
    Jan 16, 2019
    Posts:
    54
    I misunderstood what you meant about the coroutine. I meant to move it to start, out of the update loop, not the code to update. :p

    I've seen that video on AI but he is just setting one target for all of those, which I know how to do smoothly, my problem is creating a script that locates the closest target and tells the agent where it is. AI draw a lot more power when constantly updating their targets as appose to tracking a static target.
     
    RavenOfCode likes this.
  12. wagon347

    wagon347

    Joined:
    Mar 28, 2019
    Posts:
    3
    WIP Top Down Shooter 2D Zombie. I'll do some levels with the same mechanics,but by now there only one. I'll be adding some explosions, weapons and reload system. Feedback welcome. Art assets made by myself.

    Edit:
    i've deleted this video from youtube for some reason and i added new one version for mobile. watch below.

     
    Last edited: Apr 12, 2019
    GarBenjamin likes this.
  13. Slaghton

    Slaghton

    Joined:
    Sep 9, 2013
    Posts:
    129
    It's hard to see but I coded the eyes to gaze at a targeted point so when other characters come up they may make eye contact etc. Currently its just randomly looking left or right a bit + coded a simple blendshape blink animation.
    I'll probably extend it more so it detects things like light sources so it makes the eyes squint/close partially when gazing at them. Just small things that add more life to the game.


    EDIT 1: I was going to get a new video showcasing login and character creation where customization's like hair color/hair style + male or female can be saved to an online database but I spent all day troubleshooting my code because I forgot about 1 line of code I hadn't touched or commented on from months ago lol.

    People can currently log in with these created characters and run around and see each other if they have the client atm. I'll try to get a video of everything working soonish. Maybe might be best to make a thread since the project is getting fairly big and open to discussion.
     
    Last edited: Apr 1, 2019
  14. MuhsinK

    MuhsinK

    Joined:
    Dec 12, 2010
    Posts:
    194
    Playing around with Custom Editor Window and trying to make an debugger for my AI Behavior Tree

    btv.PNG
     
  15. Slaghton

    Slaghton

    Joined:
    Sep 9, 2013
    Posts:
    129
    New update on my anime inspired online game. Spent 4 days straight coding the bugs out of the character creator.
     
  16. wagon347

    wagon347

    Joined:
    Mar 28, 2019
    Posts:
    3
    I have add some new features to my top-down shooter:
    -reload system
    -collect the key to exit
    -shadows
    -new levels

    Edit:
    i've deleted this video from youtube for some reason and i added new one version for mobile. watch below.

     
    Last edited: Apr 12, 2019
    GarBenjamin likes this.
  17. Ordnas006

    Ordnas006

    Joined:
    Jun 5, 2016
    Posts:
    52
    New prototype inspired by Dark Souls just released!

     
    Gor-Sky, Slaghton and RavenOfCode like this.
  18. Gor-Sky

    Gor-Sky

    Joined:
    Jan 28, 2018
    Posts:
    196
    Your prototypes looks better than many finished games :p
     
  19. jtok4j

    jtok4j

    Joined:
    Dec 6, 2013
    Posts:
    279
    Greetings @Tim-C ,
    What's the purpose of this thread? I've always made my own threads for posts with content that I see here.
    Is this thread to show some creative programming solution for yet-un-released projects? (Just don't wanna post incorrect content here.)
    Thanks and Keep On Creating!
    Justin of JustinTime Studio
     
  20. wagon347

    wagon347

    Joined:
    Mar 28, 2019
    Posts:
    3
    I decided to use a tileset i found the web for my prototype "Zombie Village".
    I had to redo the level-maps,but now it looks better. You can play the html5 version and send your feedback. It's still a WIP.
    zombievillage.png
    https://wagon347.itch.io/zombie-village
     
    Last edited: Apr 26, 2019
    GarBenjamin likes this.
  21. MuhsinK

    MuhsinK

    Joined:
    Dec 12, 2010
    Posts:
    194
    Part 2 of my Soldier AI implementation. In this video I demonstrate how to implement Pathfinding and simple Investigation mechanics.

     
  22. Ordnas006

    Ordnas006

    Joined:
    Jun 5, 2016
    Posts:
    52
    Just released a small prototype, it si lplayable on the browser, tell me what you think about it :)

     
    dyox likes this.
  23. Dag-Tholander

    Dag-Tholander

    Joined:
    Jul 16, 2014
    Posts:
    60
    Working on a semi-constant step raymarching terrain on the GPU. Currently trying to optimize it. It's able to render about 1000m viewdistance without any major performance impact, however performance is extremely poor(20-30 fps).
     

    Attached Files:

  24. LilFire

    LilFire

    Joined:
    Jul 11, 2017
    Posts:
    44
    "Zeus Project" is my school project. Here is some space gameplay.

    And some images of the game.
     
    khos, dyox, RavenOfCode and 1 other person like this.
  25. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    825
    Wow, cool! Would you give any clues on how you achieved this? Very well done.
     
  26. MuhsinK

    MuhsinK

    Joined:
    Dec 12, 2010
    Posts:
    194
    Thank You!.

    I use linerenderer for the rope and add a new position to this linerenderer every time the player passes a corner. Then when the player calls back the grappling hook, I have the hook backtrack through all these positions until it ends at the player.
     
    khos and Antypodish like this.
  27. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,217
    Clever yet simple solution. Just wonder, using raycast, for corners detection?
     
  28. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    825
    Or maybe with collider?
     
  29. MuhsinK

    MuhsinK

    Joined:
    Dec 12, 2010
    Posts:
    194
    Here is an example:
    grappling_hook_explained.png

    I raycast from the last corner(the second last position of the linerenderer), towards the player, and as soon as the raycast can't hit the player anymore, i take the hit.point of the raycast and save it as a new position on the grappling hook linerenderer.

    Likewise I raycast from the second last corner(the third last position of the linerenderer), towards the player, and if this raycast can hit the player I remove the second last position of the linerenderer...if it makes sense?
     
    Antypodish and khos like this.
  30. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,217
    Yep perfectly does. Many thanks.
    Only small different in my thinking was, that I thought, you are raycasting from the player, toward last detected position (obstacle) of linerenderer. Simply saying same red arrow vector, but opposite direction. I suppose, if raycast from linerenderer does not lies exactly on the obstacle mesh, but is a bit outside, then it work fine as well.

    Any reason, why you choose to cast ray from linerenderer toward player, rather than viceversa? Or does it makes no difference really?
     
  31. MuhsinK

    MuhsinK

    Joined:
    Dec 12, 2010
    Posts:
    194
    Yes, I do raycast with a small offset of the last position :)
    I had to test the raycast against a collider.
    The linerenderer position doesn't have a collider, so raycast cannot check if there is an obstacle in between, because the raycasthit doesn't hit the linerenderer., so to make sure that there was nothing between the position and the player I had to raycast towards the collider of the player.

    I suppose you could raycast from the player towards the last position with a set raycast length of the distance, and if no raycast hit, then consider the grappling hook free of the obstacle.

    For me it made more sense to do it from the linerenderers point of view, so I would know precisely where the linerenderer needed to 'bend'.
     
    Last edited: Jun 5, 2019
  32. IldarKasimov

    IldarKasimov

    Joined:
    Mar 7, 2015
    Posts:
    1
    Greetings everyone! I've been working on my ECS framework which is called TinyECS for about 3 months. Now the basic functionality is almost done.

    The core feature is a simplicity. Next goal is a performance and multithreading support. There is helpers that provide flexible way of communication between game logic and views.

    Sample code of a controller:
    Code (CSharp):
    1. using UnityEngine;
    2. using TinyECS.Impls;
    3. using TinyECS.Interfaces;
    4. using TinyECSUnityIntegration.Impls;
    5.  
    6.  
    7. public class Controller: MonoBehaviour
    8. {
    9.     protected IWorldContext  mWorldContext;
    10.  
    11.     protected ISystemManager mSystemManager;
    12.  
    13.     private void Awake()
    14.     {
    15.         mWorldContext = new WorldContextFactory().CreateNewWorldInstance();
    16.  
    17.         mSystemManager = new SystemManager(mWorldContext);
    18.  
    19.         WorldContextsManagerUtils.CreateWorldContextManager(mWorldContext, "WorldContextManager_System");
    20.         SystemManagerObserverUtils.CreateSystemManagerObserver(mSystemManager, "SystemManagerObserver_System");
    21.  
    22.         mSystemManager.Init();
    23.     }
    24.  
    25.     private void Update()
    26.     {
    27.         mSystemManager.Update(Time.deltaTime);
    28.     }
    29. }

    Sample code of a system:
    Code (CSharp):
    1. using TinyECS.Interfaces;
    2. using UnityEngine;
    3.  
    4. public class InputSystem: IUpdateSystem
    5. {
    6.     protected IWorldContext mWorldContext;
    7.  
    8.     protected IEntity       mClickInfoEntity;
    9.  
    10.     protected Camera        mMainCamera;
    11.  
    12.     public InputSystem(IWorldContext worldContext, Camera mainCamera)
    13.     {
    14.         mWorldContext = worldContext;
    15.  
    16.         mClickInfoEntity = mWorldContext.GetEntityById(mWorldContext.CreateEntity("ClickInfoEntity"));
    17.  
    18.         mClickInfoEntity.AddComponent<TClickComponent>(/* You can also set some initial values for the component here*/);
    19.  
    20.         mMainCamera = mainCamera;
    21.     }
    22.  
    23.     public void Update(float deltaTime)
    24.     {
    25.         if (Input.GetKeyDown(KeyCode.Mouse0))
    26.         {
    27.             Debug.Log(mMainCamera.ScreenToWorldPoint(Input.mousePosition));
    28.  
    29.             mClickInfoEntity.AddComponent(new TClickedComponent
    30.             {
    31.                 mWorldPosition = mMainCamera.ScreenToWorldPoint(Input.mousePosition)
    32.             });
    33.         }
    34.     }
    35. }

    Sample code of components:
    Code (CSharp):
    1. public struct TClickComponent: IComponent
    2. {
    3. }
    4.  
    5. public struct TClickedComponent: IComponent
    6. {
    7.     public Vector2 mWorldPosition;
    8. }

    Github page: https://github.com/bnoazx005/TinyECS

    Want to collect your feedback about the project. Any help or advices are appreciated!
     
  33. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    5,217
    Unless you are doing it for fun, not for actual game dev, is the reason, why you spending time on it, instead using Unity performant multithreaded ECS/DOTS? Or just Jobs? Alternatively already fully functional Entitas asset?

    Is like developing own game engine, while having access to existing engines, before actual game dev.
     
  34. lucsout

    lucsout

    Joined:
    Dec 28, 2017
    Posts:
    1
    Hi Guys!
    First time posting here, i just wanted to share my very-partial-first test in unity.
    I'm trying to recreate some portal mechanics (actually, inspired by Shadowhunter TV show) focusing on new VFX and Shader graph and this is what achieve so far.



    Any feedback would be appreciated.
    Great place and great works!!
     
    iamthwee, Metron, khos and 2 others like this.
  35. ForceVFX

    ForceVFX

    Joined:
    Jan 21, 2011
    Posts:
    571
    Just an example of my updated flight AI..


    with my new Flight Physics script.
    "A Lot" of autonomous NPC's, looking for a fight.



    Random Enemy AI P.O.V ie.(what are they doing up there?)



    Getting closer,
    Patrick
     
    Last edited: Jun 12, 2019
    Antypodish likes this.
  36. MuhsinK

    MuhsinK

    Joined:
    Dec 12, 2010
    Posts:
    194
    Part 3 of my Soldier AI implementation. In this video I show how to implement a simple Cover System:


    First time using a microphone, so please tell me if i'm understandable or not :)
     
  37. DavidNLN

    DavidNLN

    Joined:
    Sep 27, 2018
    Posts:
    53
    Hello guys, working on an open world 2d pixel art game.
    Wanted to show off the World loading I've been working on, the world is 64000000 (around 30km2) tiles big and I load it all from a file.

     
  38. BlendCraft

    BlendCraft

    Joined:
    Nov 2, 2014
    Posts:
    274
    Tying out weapon animations imported from Maya. I just gotta add a rigged character and hopefully I can just make the bones follow the motion of the gun.

     
  39. Howard-Day

    Howard-Day

    Joined:
    Oct 25, 2013
    Posts:
    124
  40. Bastian-Blokland

    Bastian-Blokland

    Joined:
    May 14, 2018
    Posts:
    5
    Created a tool for generating c# enums based on json config. We use it because we have allot of configuration in json and sometimes you want to access it through code (or the Unity inspector) without having to hard-code values. Might be useful for someone.

    https://github.com/BastianBlokland/enum-generator-dotnet
     
    RavenOfCode likes this.
  41. Ordnas006

    Ordnas006

    Joined:
    Jun 5, 2016
    Posts:
    52
    iamthwee, khos and RavenOfCode like this.
  42. LilFire

    LilFire

    Joined:
    Jul 11, 2017
    Posts:
    44
    Zeus project progress - 3D Radar & Target Tracker
     
    Slaghton likes this.
  43. tonymedd01

    tonymedd01

    Joined:
    Feb 7, 2018
    Posts:
    14
    I LOVE it :O , nice work