AI for Top Down Kinda-Minimalist RTS?

Started by
4 comments, last by logicandchaos 4 years, 5 months ago

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.

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.

All good.

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.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

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.

Greg FieldsSyntasoft Gameswww.syntasoft.comPost-Time Horse Racing (Available Now)

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 :)

This topic is closed to new replies.

Advertisement