Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / RTS ai - suggestions plz

Author
Message
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 18th Jan 2004 14:24
Hey Freaky programmers!

I'm build an RTS game ... so far it works super with resourcing and pathfinding and sh*t like that. And now i'm up to the hardest part of RTS game programming... -*drums*- ... The enemy A.I. . I have this basic idea:

There's a start counter of X minutes. In that X minutes the enemy builds his village (with resourcing units and so on...). After that, the enemy focusses himself on building small army's and sending them to your village (small attacks). The army's sizes (and so strength) increases while the game plays further so in the end there's a huge battle.

Sounds pretty good huh? But if you have any suggestions, plz post them - i can use some little help

Juzt a dude who likez progging
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 18th Jan 2004 16:07
That's good, but too rigid, what you want to have is something more... Intelligent...

Try to make the enemy grow different each game, cos you don't want them to have a small weak spot, that is exactly the same each time round.

Give them a factor of randomness and their upgrades/resources more/less important to them than battling, then you'll get sometimes when the AI gets loads and loads of money, and can build units super quick when it needs them, and other times you get the AI making units every chance it gets, so it'll be low on resources, therefore not able to repair etc and thus becoming weaker in that sense.

Also, try and make it depend on outside events, like, record how quick and often the player attacks the enemy, and adjust their unit building/ defence building rate acording to that.

I have absolutely no idea how to program that, lol. But, have at it, and just keep expanding it as you go along, and you'll end up with a nice complex AI system.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
VishalC
21
Years of Service
User Offline
Joined: 14th Jan 2004
Location:
Posted: 18th Jan 2004 18:02
perhaps you can make the ai operate at a variable speed to? dont know how to make that work. good luck

If it wasn't for the last minute, nothing would get done!
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 18th Jan 2004 19:09
Thanks JessTicular & Brickman The more ideas the better it gets! @ Jess: I dont know ho to program it either but i'll find a way

Juzt a dude who likez progging
Major Payn
21
Years of Service
User Offline
Joined: 16th Dec 2003
Location: United States of America
Posted: 18th Jan 2004 20:47
Yeah I am about to start a simaler RTS game and that is one of the things that I need also. The way I would do it is to have several enemy AI patterns then load a different one each time that way the player will think its randomized but its actually a set of AI patterns. Have no Idea how to program that though lol. Man I suck at this.

Alienware area 51/radeon 9800 pro 256mb/sound blaster audigy 2/5.1 surround sound speakers.
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 18th Jan 2004 22:52
I've been thinkin of that too MP . But also randomize it a little so the a.i. is still changing... And don't ask me how im doing it im not started.

Juzt a dude who likez progging
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Jan 2004 12:48
This is why I was in no hurry to finish my rts for the alienware compo. I wanted to do MP, but the rules said they're only using one computer, so no MP. AI is going to take me the longest to do I think. If you have some time, read this article I found a few months ago on RTS AI Theory. It's about the only resource on the topic I've been able to find so far.
http://www.cs.ualberta.ca/~mburo/ps/ORTS-JCIS03.pdf

"eureka" - Archimedes
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 19th Jan 2004 17:06
Thnx Phaelax

Maybe i can use it

Juzt a dude who likez progging
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 20th Jan 2004 05:15
have it randomly choose what type of units it will build, like flying, water, land, a little of all, etc...also, if you have it "X minutes the enemy builds his village (with resourcing units and so on...)" the human player would figure that out eventually, and build up a few units and kill it. so what you should do is, have it check to see if the player has a range of # of units...but make it very broad, so like if human player has 1-25 units then make a few units and if 26-50 then build a little more...but thats kinda cheep, but it might work

Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 20th Jan 2004 05:22
i didnt read every thing but a good way to do difficulty is to change the spped the units are made for the enemy at harder difficulties, i think thats what they did on c+c the older ones
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 21st Jan 2004 18:16
@ darwin -> Good one, else its way and way too easy beat the enemy. Something like spionage I LIKE THAT . And I think I change the first period of time (before the X minutes are over...) -> The enemy builds his village AND trains some defense units, but doesn't attack you. After that, they attack with those units and build new ones when they are fighting, and so on...

@ Travis (Travis Barker??? Blink 182 rocks woops,offtopic))
yeah good idea Together with all the sh*t above it's going to be a good A.I.

Juzt a dude who likez progging
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 22nd Jan 2004 12:36 Edited at: 23rd Jan 2004 04:43
@Darwin, but, that'd be cheating ( if you had a fog of war type-o-thing that is ).

If the enemie hasn't explored up to your base, then it's not going to know what units you have etc, so it can't make an estimation on what to build.

You should think of the AI as another player,
They'll make some basic units, send them out to explore,
They find where you ( the player ) are,
They'll have a breif look at the surrounding area at what units you have,
They'll quickly ( if they've got enough resources ) build up a small army to try and rush you,
They'll either succeed or fail at rushing you, and if they fail,
They'll make more units and continually attack you, and keep trying to see more of your base, trying to find a weak spot,
They'll build up a big army then attack full force.

If you think about it, that's basically how most people play RTS's. It's a game of search and destroy, and you can't destroy something if you don't know where it is, and you have to assume that the AI doesn't know where the player is, otherwise it becomes unfair.

Also, a good aspect to have in the game ( if you can figure it out ) is to have the AI learn from playing against you, so if you're prone to rushing the AI, it realises this after the third or forth time, and builds defence before attack units. etc etc.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 22nd Jan 2004 20:07
Yeah jess yer right

You helped me again... first pathfinding and now this Thnx dude

Juzt a dude who likez progging
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 23rd Jan 2004 04:44
Again, Glad to have helped...

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 23rd Jan 2004 07:28
thats a good idea jess...and i dont think it will be extreamly difficult if you just keep breaking the ideas down into smaller and smaller pieces, then eventually you will end up with code...i think im going to do that when i finaly get to the AI

Travis
21
Years of Service
User Offline
Joined: 9th Nov 2003
Location: West Aust.
Posted: 23rd Jan 2004 08:15
btw no im not travis barker... tho i do play the drums
but it doesnt mean u cant worship me
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 23rd Jan 2004 09:41
Lol Travis

Juzt a dude who likez progging
Xander
22
Years of Service
User Offline
Joined: 3rd Mar 2003
Location: In college...yeah!
Posted: 24th Jan 2004 07:04 Edited at: 24th Jan 2004 07:07
My RTS, Firewall, is a little different from most (see below in my signature for my website), but I still may be able to offer some advice. When I build AI for games, I first think of what I would do when I play it. I build my AI off of my intelligence, which is human (obviously). That way, the computer thinks the same way that my friends do, so it is more like playing against human opponents than dumb computers.

In my RTS you have to fight off viruses that are invading your computer. There are three different robot types that do different functions, and ten different robot designs that have different abilities (flying, shooting, fast, slow, strong etc...) The computer has access to the same robots, bases, and drones as you do. You each start out with one Poster (building robot) that builds up your memory (territory). Everyones territory is analyzed every 5 seconds to see where there is oppurtunity to build, and if it is close to enemy terriroty. This data is used by the computer AI to build new Posters (builders) where the territory can be expanded, and build Hackers (robots that destroy other's territory) where the territory comes close to the enemie's territory.

Now that is just fine, but you must control how fast the computer AI expands and builds. In Firewall, you get points. The more memory you control, the faster your points go up and the more points you can hold. You don't have to go find resources, just wait for them. The more territory you have, the shorter you have to wait .It may seem simple and boring, but ask Jess, it is fun (that is, if he tells me the truth ). Now, depending on the difficulty level, the computer's points may actually go up faster than yours under the same circumstances (yeah, I know it's cheap, but it works and no one seems to notice ). The computer AI, like a human would, saves some points and doesn't spend all of its points on useless stuff. It waits until it has a decent number of points, then builds a large army to attack you. And it only builds the army if it will do any good, it checks the data to see if there is enemy territory nearby, and builds the army there.

There are also Wreckers in my RTS, robots that destroy other robots. These are used to defend your territory and protect your Hackers and Posters to invade the viruses' territory. The computer AI doesn't build Wreckers for not reason unless it has tons of points. Then it will build a strong group with lots of drones (little things that pump up your robots) that will defend its territory. It usually only builds Wreckers to protect it's Hackers when it builds them, or when it is being attacked. Whenever a post is destroyed in my game, variables are stored in arrays that tell the player whos post it was where the post was destroyed. The computer uses this information to build Wreckers there. Information is also stored as to what type of robots destroyed the post, so the computer AI builds the correct types of robots (ones that can reach flyers, more powerful ones, etc...) Also, if there are a lot of guards detected nearby, the computer AI will build Implode Drones instead (little things that blow up, actually suck in, energy and destroy robots) because it knows that if it puts out Wreckers, they may just get destroyed.

To make it simple: the computer analyzes everything that it can to make the best desicions, but each computer only does something every 6 seconds or so, so the computer AI doesn't slow down the game at all. These methods actually work, try my game and test it out.

Darn, now that I told everyone how my AI thinks, they will be able to beat it

I hope I helped, just ask if you want to know something specific.

Xander Moser of Bolt Software
Firewall: Your Computer's First Defense - Real Time Strategy game
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 24th Jan 2004 10:31
Thnx bolt!

Im going 2 try yer game as soon as possible. I was already planning to let the ai make decisions, but its better to do that every 5 seconds, not every loop. Thanx m8

Juzt a dude who likez progging - Me loves RTS games
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Jan 2004 08:52
Interesting stuff there Bolt, glad you shared that with us

Quote: "ask Jess, it is fun (that is, if he tells me the truth ). "


Lol, yeah, I was telling the truth, it's an ausome game, and I liked the AI in it too, it seems really realistic.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-06-07 02:08:42
Your offset time is: 2025-06-07 02:08:42