Need orientation on AI

Hello dear game-makers !
I begun using unity 2 weeks ago and I need help about AI.
I created a little game were 2 players fight and I would like to replace one of the player with an AI.
Here is a video of it :

The 2 players are controlled with a same keyboard (WASD space and arrow + Enter keypad).
For the input I use Input.GetKeyDown.
How could I easily make an (not so bad AI) ?
I red some post about AI but it was really focused on a type of game, is there somekind of universal AI ?
Thanks for any help you can provide, such as advice, articles, orientations, ideas …

P.S : Sorry for my bad english :smile:

No, there is no universal AI.

Some AI techniques can be reused in multiple types of games, but it’s always game-specific to some extent.

For this game, I would suggest starting with a state machine. You will find many articles on making state machines, but I recommend keeping it simple. Just have an Enum for your states, a variable that represents the current state, and then methods you call when entering, exiting, or updating (i.e. processing one frame) while in a state. Within each method, have a big switch statement that branches to the appropriate code for each state.

Thanks you I’ll try that :slight_smile:

1 Like