AI Tutorial: Planning

Not a few gamers have a dream of someday becoming a professional game developer. This interest drives many to create and program their own games. For those who are very new to coding homebrews and are not really that familiar yet with the Lua script language, it’s not a surprise for you to hit some snags, particularly in AI. Vaza from our forums, has come up with an AI Tutorial for Sonic Battle Arena. It doesn’t only help the newbies to get started, but also reminds those with experience, the value of great planning.

Making a flowchart is vital for moulding your AI. If you’re a beginner, start off with a simple chart instead of jumping right ahead into a complicated one that might overwhelm you. Here’s an example for a normal enemy in the game. Take note that this is only an example. Your plan should fit your game.

AI Flowchart

In this flowchart, there are four main areas that the Enemy can do: Move left, right, attack and jump. Let’s start on how to make your AI move left and right.

INSTRUCTIONS:

1. Make 2 boxes at the top. Label them Left and Right.
2. Below, put as many outcomes as you want for your AI. Branch it out.
3. Set the conditions for your AI. Example, if you put in x=480 in the right box, this means that if it hits the edge of the screen it goes back to the main 2 which is left.
4. The second box is: if walk right = true then random outcome = Action/Nothing. This means that if walking is true, you can make the AI keep walking or do nothing.
5. Join the all the boxes, to a big box at the bottom, that says action and nothing. Every single box must be connected, telling you that, there will always be a random outcome.

Do a test project first, this way you can fix any errors before doing it for your real game. Remember that a great game starts with a great plan. Credits to Vaza for a great tutorial in his AI series.

Not a few gamers have a dream of someday becoming a professional game developer. This interest drives many to create and program their own games. For those who are very new to coding homebrews and are not really that familiar yet with the Lua script language, it’s not a surprise for you to hit some snags, particularly in AI. Vaza from our forums, has come up with an AI Tutorial for Sonic Battle Arena. It doesn’t only help the newbies to get started, but also reminds those with experience, the value of great planning.

Making a flowchart is vital for moulding your AI. If you’re a beginner, start off with a simple chart instead of jumping right ahead into a complicated one that might overwhelm you. Here’s an example for a normal enemy in the game. Take note that this is only an example. Your plan should fit your game.

AI Flowchart

In this flowchart, there are four main areas that the Enemy can do: Move left, right, attack and jump. Let’s start on how to make your AI move left and right.

INSTRUCTIONS:

1. Make 2 boxes at the top. Label them Left and Right.
2. Below, put as many outcomes as you want for your AI. Branch it out.
3. Set the conditions for your AI. Example, if you put in x=480 in the right box, this means that if it hits the edge of the screen it goes back to the main 2 which is left.
4. The second box is: if walk right = true then random outcome = Action/Nothing. This means that if walking is true, you can make the AI keep walking or do nothing.
5. Join the all the boxes, to a big box at the bottom, that says action and nothing. Every single box must be connected, telling you that, there will always be a random outcome.

Do a test project first, this way you can fix any errors before doing it for your real game. Remember that a great game starts with a great plan. Credits to Vaza for a great tutorial in his AI series.

Add a Comment

Your email address will not be published. Required fields are marked *