Make computer control a Team/Player
In an RTS, what are common ways of making the computer control a Team or 'Player'. For example: in a 2v2 game, there are two human players and two Computer players. Is it as simple as a boolean in the Player class: Human=true;, and then when a player 'thinks', which function it uses is determined by that bool? I have a LONG list of things to implement in my RTS, and this is one. Anyone have any good suggestions or articles to read? Jeff
No. What you do is either create the AI brain or not depending on if it's a computer player. If an AI brain is present it takes direct control of all the units and structures; usually it calls the same functions that are called when the player clicks on stuff.
-me
-me
search this forum for "RTS AI" and "Strategic AI" and "Skirmish AI"
-me
-me
I've been searching the forums and Google for examples, but exactly what I'm looking for isn't quite coming up.
What I'm trying to find is ways to implement that 'Brain' that you mentioned.
Let me try and break it down:
There are two types of players, Human and Computer. Both Human and Computer Units' will think in the same way...i.e.: Attack opponent when it gets too close, avoid obstacles and other units (collision detection/response), etc.
However, a Computer player needs to think: "I have 10 ground units and 4 Air units. Select these 14 Units and attack X Position" or "I need more Peons -> Select Base -> if I have enough resources -> make a Peon".
How do you determine which way a Computer Player thinks? You mentioned a 'Brain'...Is this just an instance of a class that Computer Players have, and this in turn thinks for them, as a Human would?
Jeff
What I'm trying to find is ways to implement that 'Brain' that you mentioned.
Let me try and break it down:
There are two types of players, Human and Computer. Both Human and Computer Units' will think in the same way...i.e.: Attack opponent when it gets too close, avoid obstacles and other units (collision detection/response), etc.
However, a Computer player needs to think: "I have 10 ground units and 4 Air units. Select these 14 Units and attack X Position" or "I need more Peons -> Select Base -> if I have enough resources -> make a Peon".
How do you determine which way a Computer Player thinks? You mentioned a 'Brain'...Is this just an instance of a class that Computer Players have, and this in turn thinks for them, as a Human would?
Jeff
erm... the first couple links that come up describe exactly that. You can also search for similar things and add my username; I've posted on a lot of these threads since I've worked on RTS AI for around 3 years now.
http://www.gamedev.net/community/forums/topic.asp?topic_id=415522
http://www.gamedev.net/community/forums/topic.asp?topic_id=329005
http://www.gamedev.net/community/forums/topic.asp?key=featart&uid=199&forum_id=35&Topic_Title=Hierarchal+AI
read through those forums and then ask more questions.
But more or less, yes it tries to think for the faction like a human player would. I mean it's not really mimiking the though process of a human but trying to emulate their actions.
Read the foums first and come back. Sounds like you're new to AI also so: you can't make a computer think like a human, you have to fake things and implement algorithms to help it make desicions: state machines, heuristic approaches, create lots of data off-line that it can use at runtime. Game AI is the art of tricking the player into thinking that what you are doing is actually intelligent.
The first time I implemented an RTS AI, it took 2 of us 6 months to make it reasonably challenging. About 1.5 years to make it good.
-me
http://www.gamedev.net/community/forums/topic.asp?topic_id=415522
http://www.gamedev.net/community/forums/topic.asp?topic_id=329005
http://www.gamedev.net/community/forums/topic.asp?key=featart&uid=199&forum_id=35&Topic_Title=Hierarchal+AI
read through those forums and then ask more questions.
But more or less, yes it tries to think for the faction like a human player would. I mean it's not really mimiking the though process of a human but trying to emulate their actions.
Read the foums first and come back. Sounds like you're new to AI also so: you can't make a computer think like a human, you have to fake things and implement algorithms to help it make desicions: state machines, heuristic approaches, create lots of data off-line that it can use at runtime. Game AI is the art of tricking the player into thinking that what you are doing is actually intelligent.
The first time I implemented an RTS AI, it took 2 of us 6 months to make it reasonably challenging. About 1.5 years to make it good.
-me
Is a State Machine something that can do this? Every cycle SM will look at what the Player has/needs, and set the state accordingly. Then, when it 'Thinks', it will go into that given state category.
Example:
Determine(){..determine what Player needs and set state accordingly..needs resources->State=Gather OR Need more Defense->State=BuildDefense}
Think(){..Think according to the State...State==Gather-> find peon to gather resources OR State==Attack->Select Units and attack}
Is this a good way to go about it?
Jeff
Example:
Determine(){..determine what Player needs and set state accordingly..needs resources->State=Gather OR Need more Defense->State=BuildDefense}
Think(){..Think according to the State...State==Gather-> find peon to gather resources OR State==Attack->Select Units and attack}
Is this a good way to go about it?
Jeff
State machines are the core of most game AI so it's a good place to start. Please read through the above links thoroughly. It'll give you a better place to start asking questions.
What you're going to find is that figuring out the states you want is easy. Figuring out how to tell things like: "i need more resources" is really hard and where all the "fun" comes in.
-me
What you're going to find is that figuring out the states you want is easy. Figuring out how to tell things like: "i need more resources" is really hard and where all the "fun" comes in.
-me
Thanks for the above links. One of those I came across in searching before.
Yes I'm beginning to see this now, lol.
From what I've read, I like the idea of the blackboard architecture. I'm gonna read through some more articles and try to sort out the best way for my game/easiest (but challenging) for me to implement.
Thanks for the help so far!
Jeff
Quote:
What you're going to find is that figuring out the states you want is easy. Figuring out how to tell things like: "i need more resources" is really hard and where all the "fun" comes in.
Yes I'm beginning to see this now, lol.
From what I've read, I like the idea of the blackboard architecture. I'm gonna read through some more articles and try to sort out the best way for my game/easiest (but challenging) for me to implement.
Thanks for the help so far!
Jeff
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement