Jump to content
  • Advertisement
Noah Gerard

R&D AI for Top Down Kinda-Minimalist RTS?

Recommended Posts

So. I was recently introduced to the world or RTS games. I think they are the best type of game in existence. Knowing so, I decided to try and make my own. With javascript. Using ZERO graphics libraries. Just plain ol' canvas and fill rect.  😉  My game is called WebRisk. (I had no other names). I've gotten to the point where mostly everything except the units work. The multiplayer works but the units just sit there. Oh and, I forgot to mention what units I have. RIflemen, Snipers, APCs, Tanks, Transport Helis, Attack Helis, and Fighter Jets. Can I get some pointers from you guys? Stuff like how the AI should work and stuff. Nothing too complicated though. I would share my code, but I'm 14 and I was told my code is hard for other to read/build on. 🤷‍♂️ You can email me here: noahgerardv@gmail.com

And one last thing. I've had alot of people tell me that I'm shooting too far. I agree a bit, but I have way to much time on my hands and a stubborn mind. So please, dont try to convince me to not do it. Sorry if I sound demanding. Heres a link to the gfx I've made. http://webriskgfx--helixable.repl.co/ That doesn't include the snipers and the riflemen btw.

Share this post


Link to post
Share on other sites
Advertisement

You should ask specifically what you need help with rather than general tips on AI.

From my experience, it's important to establish what your goals are for the AI - do you need them to be smart and resourceful, dumb and lazy, somewhere in the between? What does "smart", "resourceful", "lazy", "dumb" mean in your game world? What type of tasks do you want the AI to fulfill? This all depends on the type of game you want to make.

My suggestion is to first establish the specific goals for the AI and then ask again specifically what you want to do and do not know how to do. Most things you'll need are already available online. Unless you're going for something extremely novel, Google/YouTube/Reddit is your friend.

Good luck.

Share this post


Link to post
Share on other sites

AI is often the most complicated programming of a game. And RTS AI is most often the hardest type of AI. You have your work cut out for you. Figure 10 or 12 things to learn before you even start writing real RTS AI.

Share this post


Link to post
Share on other sites

I'd say the most common AI/logic you'll have to be familiar with in an RTS game is the ability for your units to be able to move and avoid obstacles on your map. Collision avoidance and movement (pathfinding). You have to be able to tell units to move from point A to point B while avoiding all the "non walkable" regions of your map.

Look into algorithms such as A* pathfinding.

There will be a lot of additional aspects to your AI in your game but if you are able to have your units move around, that's a good start.

Share this post


Link to post
Share on other sites

What you should do is write down all the behaviours you want your troops to have, you may need to write a different list for different units. You can put all these behaviours in a Finite State Machine(FSM) meaning you can only execute one action at a time. Then you need to decide how you want your troops to make a decision. You could use an action list you need to prioritise your actions, then when you implement it you just go down the list starting at the highest priority, you check if you can do it than if not you go on to the next action. So if you have move to goal before attack then troops will go to the goal before they attack enemies switch it around and they will attack enemies in range if they are not at their goal. You can also look into utility theory for making decisions and different kind of Goal Orientated Action Planning(GOAP). I recently read an article about action lists and is seems fairly simple, which is why I mentioned it 1st. Or you could roll your own all if statements and stuff :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!