Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Redneck programmer designs advanced AI for Unity.

Discussion in 'Works In Progress - Archive' started by FirstTimeCreator, Aug 29, 2018.

  1. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
  2. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,258
    Sum it up for me. I'm not watching a 15 minute video without good reason.
     
  3. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    It's kind of hard to sum up AI. It's a unique AI framework of my own design that utilizes method execution arrays that contain algorithm containers. It constructs it's own code base on demand and destructs when algorithms reach the end of their life cycle removing all code execution within algorithms.

    The Matrix is currently active algorithms that are separated by category. Core, Agenda, Thought, Choice. Each algorithm type having different functionality which also provides complete code separation between algorithms and the data and the behavior implementation methods.

    Anyway a lot more to it.. ill show a little more once i upload the next video that has my path finding system installed. You can see my path finding system prototype in action in previous videos. I'm converting it to this framework in the form of algorithms instead of a "hard coded" system.

    My AI processes algorithms in a similiar way/flow to how a human "thinks" and forms thought patterns. and the AI will be capable of forming thought patterns utilizing available algorithms in the library as well as Machine Learning algorithms in the future.

    This game I'm working on now won't have deep learning, it WILL have machine learning, after this game ill be using the framework to build a self driving car that drives itself in the game engine using neural network prediction that analyzes a render texture from a camera to detect lines on the road and stop signs, cross walks ect. similiar to how a "real autonomous car drives".

     
    Last edited: Aug 29, 2018
  4. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,321
    I don't mean to sound rude here, but this just looks like a convoluted way around node graphs.
     
  5. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    It will be much faster and more capable than a node graph. Of course it is not designed for visualization like a node graph system is which the nature of a visual node graph creates limitations.

    I will be running hundreds of ships and thousands of objects, my framework will also use ECS.. do you know of a node graph system that also implements ECS?

    No, I'm not using someone else's system, there is a point to designing my own. The proof will be in the pudding once it is using complex algorithm chains and has lightning fast speed with thousands of objects utilizing the framework in the scene.

    and as far as "convoluted" is concerned it's actually extremely simple and designed to remove "convolution" through code separation which is the point of a categorized algorithm-flow system.

    I could build a system onto the framework to create a "visualization" like a node graph of AI activity, for a debugging view of how algorithms are processed between the various types.
     
    Last edited: Aug 29, 2018
  6. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Also how would you go about adding machine and deep learning systems to a "node graph" system.

    Also how "fast" would that be even if you "could".

    123 go.

    For what I'm doing if i used a node-graph system i would have to design it myself because i would need to know every line of code and if I did that I mise well write it myself.

    Don't get me wrong i like node graphs, they make it easy for non - programmers to get things done and in certain circumstances that can be a benefit. But again node graphs are not a perfect system for "all things".
     
  7. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,321
    Node graphs make it easy to build up functionality using basic "building block" components. With something so dynamic as AI which tends to require specific actions, imo it's easier to tailor an AI to your needs with these simple constructs.

    I could be wrong about your system though, it just looked like you had lots of custom algorithms written for specific actions. Big blocks of code designed to do one thing. If you need that thing to do something else, or expand upon it. You're looking at writing more code, plugging it in, making sure it works with other algorithms. From my experience this doesn't scale well. But again, maybe I misunderstood the video.

    And yeah, of course a custom made solution is going to work faster than a graph.

    I don't have experience with Machine or deep learning, so can't comment on that.

    Personally I like graphs for AI stuff. I can clearly see where logic goes and change it easily. If you do plan on making this a usable asset for others, I'd start to think about workflow and scale. If it's just for you, go nuts!
     
  8. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Can you assign code to different update methods or have it fire on intervals within nodes? How about jobs and parallel threading? .

    That's the thing about what I'm doing im designing it to scale in a way that I need it too without sacrificing any performance.

    Now that i think about it i could turn it into a node graph system of sorts with a "mapping system" but that will add overhead and i don't want to do that.

    Later on i might play with it and add a node visualizer and see if i can make it work and profile it to see how it performs. I have not decided yet if i want to make it a solution for the asset store.

    If i did I would agree with you that it would need an "easy mode" interface like a node visualizer. for my own personal needs i don't need the overhead from that.

    And yes algorithms can be small bits of code to large complex systems. That is what the "Matrix" part of my system is how the AI' understand it's states and running algorithms and how to implement choices when faced with multiple outcomes from multiple Thoughts that resulted in choices that need to be implemented into behavior.

    Anyway there is alot i did not cover in the above post it will be better for me to "show it" in a video.. the results.. then i can talk about the mechanics behind it.

    With my system I CAN implement machine learning systems with a node graph it's questionable. You are confined to the logical structure of the node system where as I am not confined to any system with my framework.

    what i mean by that is my system can completely re-construct itself on-the-fly. I can try out different systems and variations if i need too, i can even write algorithms to do this that would take less time than adjusting a node system.

    I just don't see myself being limited by anything and that is what matters to me. Speed and limitations as well as code separation which I've learned is so very important when dealing with large scale systems.

    I would rather deal with a system where code is broken down into small chunks and categorized that a convoluted mess which i have made plenty of in my learning years of making prototypes. One time I wrote something that was like 8,000 lines of code in one file. I think the first thing i ever made in unity lol, what a glorious mess it was but it did work.
     
    Last edited: Aug 30, 2018
  9. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,321
    I think your right in that a node visualizer is the way forward. Clicking objects in inspectors doesn't give a clear picture of the AI.

    A graph with parallelism? Have you seen this: https://blogs.unity3d.com/2018/08/27/animation-c-jobs/
    Sure it's for animation, but I don't see how having a graph makes parallelism any harder? I'd love to see an ECS/Jobs logic graph created. If not by Unity, I think someone will figure it out.

    Creating a graph that can fire code on intervals and different update methods? Sure, I'd create a node that blocks further logic until a time value reaches a threshold. The graph itself could have an enum determining which update method to use. Or maybe there's a concept of "Updater" nodes that dictate how updates are run through its child nodes. I don't see graphs as a limitation. Take Unreal engine for example, you can create an entire game just by using graphs.

    What I'm trying to say is that I believe your system is a graph, but without the visualization. It has the same basic concepts: get input, process data, make a decision, output data. Any AI system is going to work like this at that fundamental level.

    Is there a high level graph system for AI currently in Unity? Not sure, but maybe you could be the first. All logic graphs I've seen are low level. And yes I would agree those are more tailored to non-programmers. Just saying that a graph makes sense in the context of AI. It's up to the developer to determine what's available in that graph and how it's executed. It's just states and connections, you can make it as simple or complex as you want.

    Anyway, I'm not doubting your system, just think it could be better visualized as a graph, or a way to see the "Matrix"
     
  10. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    See I don't have too do that. I can queue algorithms, trigger them at a time, chain them, chain trigger them, change update/fixed/interval/job/threaded method.

    Yah come to think of it i may do a visualization but im not doing editing through the graph, a visualizer would be nice as it grows in complexity and that is something i can do. If i can do a visualizer i can do editing as well but... I would not want to commit to that kind of time testing and developing it unless i wanted to sell it on the asset store since i can get by without it.

    You would have to realize that the "graph" during play would be "morphing", as the code base for the graph is constructed on demand. Meaning, nodes don't actually exist until algorithms create them, in order to generate a graph i would have to "run" all possible outcomes within the algorithms and i could generate a node like spider web of algorithm connections.

    I'm only one person here and im building not only the AI framework but the game framework as well and the game itself.

    I am working full time though, nearly 7 days a week so, i will get it done faster than you think putting the kind of hours I put in.

    I have given myself 2 to 3 years to build all of this and the game GalacticArmada.

    I have got part of the website done at http://www.galacticarmada.com but can't finish it until i have content from the actual game, meaning i have to get the procedural galaxy done before i can finish the website and officially launch it.

    I spent 2000$ on that domain name, I'm pretty committed at this point. ;)
     
  11. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Here is a "rough" development roadmap i made, it only contains a small part of it but enough to get to doing mock battles between AI teams/empires in a procedural galaxy which will put me halfway to a playable game.

    https://www.galacticarmada.com/roadmap
     
  12. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Anyway my system is different than a node system, though i could probably generate a node like structure it would not be the same. The way data flows through my system is different then how it would be processed in a node based tree.

    Think of my system as being able to run 500 node trees at once concurrently (as an example) with algorithms than can detect it's states and modify algorithm and behavior execution orders that are queued, as well as on the fly at any "moment", it can re-organize itself with choice algorithms as well as the core algorithms.

    The system has "structure" but that structure is more like the human mind than a node based logic tree.

    When i turn on the visual debugger "data stream" and you see how the AI is "thinking" it should resemble a "human being" as the AI's in GalacticArmada will have morale and "mental states" as part of the simulation i am building.

    Perhaps you could build something like what i am building in a node but it would be rather complex and in my mind would be resource heavy instead of light weight as you would need a lot of additional logic to achieve the same things i am doing.

    I'll admit i don't have a whole lot of experience with node based editors besides Amplify shader editor, I'm a programmer, I like to keep my programming skills sharp and that means i program things i don't use node editors unless i made it.

    I don't really have time to make an "attempt" to do something with a node editor that may or may not work when i know for a fact it will work through my coding methodology.

    The game i am building requires absolute adherence to pushing as much performance out of the pipe as possible with both scripting and physics CPU time and my designs are built around that goal, using structs to keep everything in the stack, keeping memory compact and organized which is why im very interested in ECS.
     
    Last edited: Aug 30, 2018
  13. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,321
    Ok, well I don't want to derail your thread anymore so I'll just say I hope it works out. I'm interested to see what the final API will look like.
     
  14. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
    Think outside the box and by using a node system you will always be inside a box, never outside of it.

    Innovation comes from thinking outside of the box and pushing the limits of your imagination and computer science.
     
    lautzy65 likes this.
  15. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
  16. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768
  17. FirstTimeCreator

    FirstTimeCreator

    Joined:
    Sep 28, 2016
    Posts:
    768


    Good luck hitting my FPS with a node editor lol.

    I would be absolutely shocked if a node editor could get anywhere close to the performance of my system.

    It might could if you were talking about 10 or 20 objects but would your node system scale to 500 without a big performance drag!? :)

    Now, I'm redesigning my pathfinding system to work with my AI framework, it will be tricky but I'm going to attempt to get it working with all 500 ships and still maintain over 100FPS AVG with a highly accurate, highly responsive collision avoidance system.

    With my new version instead of using sphere casts that stay on all of the time (in the forward direction) im going to change to a math based calculation system to detect when it is near objects to trigger physics casts.

    I'm going to thread the calculations ;)
     
    Last edited: Sep 3, 2018