What ship? I am getting very confused…
I am making game about fighting with ships, and I need to make bot, that can control ship like this (with some strategy)
If you would like to incorporate strategy and planning into the AI, there are many methods. All of them get more difficult if the AI have to work together.
I just finished CS-6600 (Intelligent systems) in which I made a sword fighting AI here on Roblox. The method, Q-Learning, is applicable for your AIs as well. If you have maps that make some positions more favorable then you may want to augment the Q-Learner with a neural network to help predict state values. The reasons why are explained in a report I put together. Here is a video of the AI training:
Here is the repo with all the source code:
Here is the class report (put together in 30 minutes, don’t tell my professor!) about what issues I ran into and what I learned:
https://drive.google.com/file/d/1MbCnC22bmX5uQZtBNHx1BKECHM_Sygu0/view?usp=sharing
And here is an article I found useful to learn about Q-learning:
Lastly, here is the place file:
AI.rbxl (80.5 KB)
To summarize, Q-Learning learns the best “policy”, for a given state (at a specific location on a map, enemy’s position, reload times, fuel, health, ext) what is the best action to take? It learns the best actions by trial and error over time. This AI was trained with a fairly small number of states so learns really fast. Other AIs may require more training or even a neural network to estimate state values. The long-term planning comes in via the propagation of rewards back along the states preceding it.
ok, but i am making strategy ai
You don’t have to actually dive down deep to make strategic AI’s. You can just chain a bunch of if
statements.
Like, when the player level is above, for example 20, make the npc flee. You should incorporate some randomness in your npcs. For example, some npcs may flee if the player level is above 20, but for some, level 25, etc. You could also make a list of npc actions when a player does something, then pick a random action.
Also, add in some pseudo-AI strategy to your npc. For example, when the npc is low on health, you can make it flee, or release a shield, etc.
I use this method in most of my games. It works only if your game is not to complicated. If it is, you have to use some of the methods that the other posters above suggested. I’m not a expert in AI, but pseudo-AI works as an alternate solution. (Heck, I even made an unbeatable tic-tac-toe AI with this method)
Nice assignment! Wish my profs allowed Roblox submissions… let alone be able to say the word in public without everyone cringing…
Anyway, Q-learning is a rather interesting method of machine learning but a bit shallow and hard to apply to many situations. In your report, you mentioned how you’d like to try the same thing but with standard artificial neural networks; a much more universal and well known form of machine learning.
For this, you can find a use for my neural library. Comes with all the methods you’ll need for feedthrough/recurrent networks along with some UI elements.
Would be very interesting to see how your sword fighting AI will perform with a complex network.
Also, one question: Why are you teaching the bot to fight itself? Wouldn’t this result in the bot learning how to fight only another bot? Its fast but this may result in the bot not working well or at all when versed against a player. Saying ‘may’ because with networks, all bets are off.
This project was unfortunately thrown together real fast with a focus on making a presentable product while I focused on other projects / finals. In the future I think it would be interesting to add deep-Q learning, a fair player controller, and allow the AI train on other players. As is it doesn’t even have a method to save the simple Q-table
Very cool library. It’s unfortunate that we can’t use matrix libraries written in C like Python or Lua machine learning packages do. I think if I do end up doing a lot of AI work on Roblox, I’d probably use a web API. Now that I think about it, the communication from the Roblox server to an AI server would be like a very low latency from the Roblox server to a player.