Ai_statemachine_dronesdemo

It is a simple implementation of an 🤖 A.I. behaviour , by using the 'State Pattern' and State Machines in Unity3D 🎮 and C#.
Alternatives To Ai_statemachine_dronesdemo
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Unity3d Finite State Machine1,052
2 years ago6mitC#
An intuitive Unity3d finite state machine (FSM). Designed with an emphasis on usability, without sacrificing utility.
Unityhfsm519
24 days ago10mitC#
A simple yet powerful class based hierarchical finite state machine for Unity3D
Dmotion320
2 months ago1otherC#
DMotion - A high level Animation Framework for Unity DOTS
Fluent State Machine168
4 years ago2January 11, 20181mitC#
Fluent API for creating state machines in C#
Swissarmylib141
4 years agomitC#
Collection of helpful utilities we use in our Unity projects.
Artimech41
2 years ago14C#
Open source visual scripting system for Unity.
Text101 Original37
5 years agomitC#
A basic state-machine based text adventure exercise as part of our Complete Unity C# Developer course (http://gdev.tv/cudgithub)
State Machine32
a year agomitC#
UniRxをベースにしたステートマシン
Susmachine21
2 months ago11mitC#
A Simple Unity State Machine with a nice API and automatic transition support. No reflection, string names, or need to inherit anything.
Rxstatemachine18
5 years agon,ullmitC#
Reacitve StateMachine for Unity 3D
Alternatives To Ai_statemachine_dronesdemo
Select To Compare


Alternative Project Comparisons
Readme

AI_StateMachine_DronesDemo

What is this Project?

It is a simple implementation of an 🤖 A.I. behaviour , by using the 'State Pattern' and State Machines in Unity3D 🎮 and C#. It is fully based on two great Blog Articles written by the excellent Tutor: 👔 Jason Weimann, of unity3d.college.

1- Unity3D AI with State Machine (FSM), Drones, and Lasers!🔫

Link: https://unity3d.college/2019/04/28/unity3d-ai-with-state-machine-drones-and-lasers/

2- Unity3D Design Patterns – State – 🤖 Building a Unity3D State Machine

Link: https://unity3d.college/2017/05/26/unity3d-design-patterns-state-basic-state-machine/

3- And the YouTube video (Tutorial): 🎥 Unity3D AI with State Machine (FSM), Drones, and Lasers!

Link: https://www.youtube.com/watch?v=YdERlPfwUb0

Notes:

💡 There are 2 important Scenes in the code:

🔅 1- DroneBadPractice:

An A.I. example using bad coding practices: An Super-Big Switch - Case with too many cases. Each 'case' would correspond to a State of the A.I. (for instance: Walk, Shoot, Dance, etc.); and we would use an 'Enum' variable for the States Name.

🔅 2- Drone:

The recommended A.I. implementation, using a well designed and simple 'State Pattern' in C#. The Scripts and code for this Scene can be found inside the 'Assets/scripts/GoodStateMachine/' folder.

💡 I was motivated to rewrite this code because in the Tutorial Jason Weimann did not include the code of the State Machine Pattern, only the 'bad way' of writing A.I. (which is based on a BIIIIIG Switch-Case, with as many States as Enum Values). I think it might be available only to his Patreon Sponsors, which is understandable.

💡 This code is not 💯 Optimized. It is intended to be a Template for Prototyping and making Game 'Proof-of-Concept' Demos. For making it a final product; it would be necessary to make some changes, for example: replacing the Raycasting implementation in the WanderState.cs class (one of the A.I. States) by one that does less Raycasts (and those Raycasts need to be limited in their extension and size), and we would need to remove the constant execution of GetComponent<>() from the collider. One possible solution would be to cache all game Characters that are to collide (in a Static Dictionary) inside a Component (maybe a Static Class), and compare in each Frame (update() execution) the Collider 'ID' with the one we would have cached (i.e.: a simple Search in the Dictionary, by 'ID'). Using well limited Raycasts is ok, but the command Debug.Raycast is just for 'debugging', so it would need to be commented out too.

💡 About the Lighting: I decided to test an Assets called 'VertexDynamicLightmap' (Vertex Lit Shader: Baked Shadows Realtime Light, made by: Nurface): to allow having Realtime Point Lights 🔦 (one per Drone) with Baked Lighting (i.e.: a Directional source of light, which would be: ☀️ the Sun), basically Vertex Lit (Rendering Path). It works like a charm and looks fine. You can download it in: https://assetstore.unity.com/packages/vfx/shaders/vertex-lit-shader-baked-shadows-realtime-light-75977

🎮 It was made in Unity 2018.4.0f1.

I hope it to be useful for anybody studying A.I.

AlMartson


MIT License

Copyright (c) 2020 AlMartson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. © 2020 GitHub, Inc.

Popular Unity3d Projects
Popular State Machine Projects
Popular Games Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
C Sharp
Video Game
Artificial Intelligence
Unity
Unity3d
Drone
Design Pattern
Laser
State Machine
Fsm