hmmmmm, well, first of all, don't call them A.I.s. not unless you want to get ridiculed by hardcore programmers. an aritficial intelligence is impossible to create because you would need an infinate number of "if" clauses to denote all the possible actions.
but beyond that, the best (and only) way is to make a series of extremely specific "if" statements that define what the CPU player should do in every possible scenario. For instance, you could make it distance based. If the sprite is far away, program it to walk closer. if it is within a certain range, you could make it use a certain attack. the more of these statements you have, the more advanced your CPU will be.
and dont worry if you get stuck. these things are so difficult to make that I usually just don't even bother. usually the result is not worth the work. but dont' let that discourage you from trying.

Offline
AmoebaMan wrote:
hmmmmm, well, first of all, don't call them A.I.s. not unless you want to get ridiculed by hardcore programmers. an aritficial intelligence is impossible to create because you would need an infinate number of "if" clauses to denote all the possible actions..
Not infinite, in a simple game there'd only be around 50 possible scenarios (unless you're going with pixel-perfect AI).
Well, if you want them to be like the player, make them do the same things, but instead of if a key is pressed, make it an if (something), for example if the distance to player is less than 30 attack.
Offline
AmoebaMan wrote:
hmmmmm, well, first of all, don't call them A.I.s. not unless you want to get ridiculed by hardcore programmers. an aritficial intelligence is impossible to create because you would need an infinate number of "if" clauses to denote all the possible actions.
but beyond that, the best (and only) way is to make a series of extremely specific "if" statements that define what the CPU player should do in every possible scenario. For instance, you could make it distance based. If the sprite is far away, program it to walk closer. if it is within a certain range, you could make it use a certain attack. the more of these statements you have, the more advanced your CPU will be.
and dont worry if you get stuck. these things are so difficult to make that I usually just don't even bother. usually the result is not worth the work. but dont' let that discourage you from trying.
All AI means is artificial intelligence. That doesn't mean it has to be very intelligent at all, it just has to react to the situation
(At least to my understanding of it)
Offline
juststickman wrote:
AmoebaMan wrote:
hmmmmm, well, first of all, don't call them A.I.s. not unless you want to get ridiculed by hardcore programmers. an aritficial intelligence is impossible to create because you would need an infinate number of "if" clauses to denote all the possible actions..
Not infinite, in a simple game there'd only be around 50 possible scenarios (unless you're going with pixel-perfect AI).
Well, if you want them to be like the player, make them do the same things, but instead of if a key is pressed, make it an if (something), for example if the distance to player is less than 30 attack.
an AI means an aritficial intelligence. that means a computer that can think like a human. bottom line: impossible
demosthenes wrote:
All AI means is artificial intelligence. That doesn't mean it has to be very intelligent at all, it just has to react to the situation
(At least to my understanding of it)
as above: the concept of artificial intelligence refers to a computer with the capabilities of a human. and also, why call it an intelligence if it isn't intelligent? the proper term is CPU (central processing unit) behavioral replicant.
Last edited by AmoebaMan (2010-04-28 15:23:29)

Offline
AmoebaMan wrote:
juststickman wrote:
AmoebaMan wrote:
hmmmmm, well, first of all, don't call them A.I.s. not unless you want to get ridiculed by hardcore programmers. an aritficial intelligence is impossible to create because you would need an infinate number of "if" clauses to denote all the possible actions..
Not infinite, in a simple game there'd only be around 50 possible scenarios (unless you're going with pixel-perfect AI).
Well, if you want them to be like the player, make them do the same things, but instead of if a key is pressed, make it an if (something), for example if the distance to player is less than 30 attack.an AI means an aritficial intelligence. that means a computer that can think like a human. bottom line: impossible
demosthenes wrote:
All AI means is artificial intelligence. That doesn't mean it has to be very intelligent at all, it just has to react to the situation
(At least to my understanding of it)as above: the concept of artificial intelligence refers to a computer with the capabilities of a human. and also, why call it an intelligence if it isn't intelligent? the proper term is CPU (central processing unit) behavioral replicant.
Ais don't have to duplicate the intelligence of a human. All they have to do is to react to some to some degree to situations. Even if they're really dumb they fall under the umbrella of AI.
And to respond to your comment about human-like AI being "impossible" I disagree. It is certainly possible. How hard can it be to duplicate a human brain, or even exceed it?
Last edited by demosthenes (2010-04-28 15:27:08)
Offline
Thanks you guys, but I was kinda looking for the basis of programming it, I've already made the attack routine and possible decisions, But I haven't figured out how to get the "life" sytem working. Any Help?
Offline
make a variable that changes to random stuff and everytime it get's to a certain number have it do something
Offline
midnightleopard wrote:
make a variable that changes to random stuff and everytime it get's to a certain number have it do something
ummmmmmmmm...
that would never give you even halfway decent results. you'd just have your CPU spazzing out in the middle of the arena while you sit back and watch.

Offline
You can also make it variable based. Let us name it 'Movement' Just program it to do things like if Movement is 1 then go closer. If movement is 2 then meve further. If movement is 3 then attack etc. The movement is the most sensitive in this case. You have no room for Bugs. I have experience in this types of games. One bug can destroy the whole project. The enemy's scripts can be like this: If distance to Player is less than 20, then set movement to 3. If the distance is more than 100 than set movement to 1. The most and greatest advantage in scratch in creating these types of games is that many types of game engine depend on collision boxes which are set far apart from the players but in scratch, if the fist or ankle doesn't touch the other player than there will be no damage. In other game engines, there is no necessary to touch each other. Just touch the collision boxes. The second problem you say it takes your HP not your Opponents. Believe me; i Encountered the same problem. I also have a solution. Let us consider: C=Costume
C 1 is the stance of the player and C2 is the punching costume of the sprite
then program like this
Forever if [(C=2) and pressing 'Key' and touching enemy ]
Then Change Enemy HP by -5
Tell me if you need any more help.
Offline
Oh and remember, I have a ton of different punching and kicking costumes each roughly 2 and 3 KB but a lot can cause a lot. A muted project without any sound can still be over 2MB. Dont cross the uploading limit.
Offline
Ziggy215 wrote:
But I've already set up the life system, but when I attack it just takes away my life not the opponents.
well, then you need a variable to determine who is currently attacking.
if you make two basic variables, you could fix this.
<{ player attacking? }>
<{ cpu attacking? }>
then what you do is insert these commands before and after the attack scripts:
<set{ cpu attacking? }to( true )>
and after,
<set{ cpu attacking? }to( false )>
then for your damage detector, you will get
<if <<touching[ cpu ]>< <and> ><( <{ cpu attacking? }><=>true )>> >
<change{ health }by( -1 )>
<end>

Offline
http://scratch.mit.edu/forums/viewtopic.php?pid=15790#p15790
Offline
AmoebaMan wrote:
hmmmmm, well, first of all, don't call them A.I.s. not unless you want to get ridiculed by hardcore programmers. an aritficial intelligence is impossible to create because you would need an infinate number of "if" clauses to denote all the possible actions.
but beyond that, the best (and only) way is to make a series of extremely specific "if" statements that define what the CPU player should do in every possible scenario. For instance, you could make it distance based. If the sprite is far away, program it to walk closer. if it is within a certain range, you could make it use a certain attack. the more of these statements you have, the more advanced your CPU will be.
and dont worry if you get stuck. these things are so difficult to make that I usually just don't even bother. usually the result is not worth the work. but dont' let that discourage you from trying.
Actually, because atoms can be in superposition states (all possible states at once) a quantum computer can make true AI. But you are right. Do not say AI because it will get you into a conversation with all those hardcore gamers who make games for a living with flash and java etc.
Offline
maxskywalker wrote:
AmoebaMan wrote:
hmmmmm, well, first of all, don't call them A.I.s. not unless you want to get ridiculed by hardcore programmers. an aritficial intelligence is impossible to create because you would need an infinate number of "if" clauses to denote all the possible actions.
but beyond that, the best (and only) way is to make a series of extremely specific "if" statements that define what the CPU player should do in every possible scenario. For instance, you could make it distance based. If the sprite is far away, program it to walk closer. if it is within a certain range, you could make it use a certain attack. the more of these statements you have, the more advanced your CPU will be.
and dont worry if you get stuck. these things are so difficult to make that I usually just don't even bother. usually the result is not worth the work. but dont' let that discourage you from trying.Actually, because atoms can be in superposition states (all possible states at once) a quantum computer can make true AI. But you are right. Do not say AI because it will get you into a conversation with all those hardcore gamers who make games for a living with flash and java etc.
that's not hardcore gaming. that's just a fact. and i'm not sure what a quantum computer is, so I guess I can't pass judgement on it.

Offline
Ok, noaw im really confused about how to make a stick fighting game. I tried something on the lines of <if><touching[ ssprite 2
<change{ enemy hp }by( -1
but that kinda didnt work cuz it was too easy so how do you make it that when punched it takes away all teh health??
Last edited by Niewiem33 (2010-05-25 16:05:32)
Offline
Niewiem33 wrote:
Ok, noaw im really confused about how to make a stick fighting game. I tried something on the lines of <if><touching[ ssprite 2
<change{ enemy hp }by( -1
but that kinda didnt work cuz it was too easy so how do you make it that when punched it takes away all teh health??
You Use:
[blocks]<if><touching[ ssprite 2
<set{ enemy hp }to( 0
<end>[/blocks]
And It Should Take Away All The HP.
Last edited by TheGameMaster1231 (2010-05-25 16:19:26)
Offline
I tend to use a seperate variable which reports wheather the player is attacking, or the ennemy is attacking, thus if if you set attacking to true, and he touches the enemy, it lowers the enemys health, and vice versa for the enemy.
Offline
LISTEN!! Advanced programmers use a tool called a "finite state machine". It basically decides what the opponent does at what time. I recommend using the block "broadcast ____ and wait" for this, and have if blocks around those. Like, if enemy is close enough to player and enemy's health is below half, use a strong attack. (of course, you can randomize attacks with a probability variable.)
Offline
demosthenes wrote:
AmoebaMan wrote:
juststickman wrote:
Not infinite, in a simple game there'd only be around 50 possible scenarios (unless you're going with pixel-perfect AI).
Well, if you want them to be like the player, make them do the same things, but instead of if a key is pressed, make it an if (something), for example if the distance to player is less than 30 attack.an AI means an aritficial intelligence. that means a computer that can think like a human. bottom line: impossible
demosthenes wrote:
All AI means is artificial intelligence. That doesn't mean it has to be very intelligent at all, it just has to react to the situation
(At least to my understanding of it)as above: the concept of artificial intelligence refers to a computer with the capabilities of a human. and also, why call it an intelligence if it isn't intelligent? the proper term is CPU (central processing unit) behavioral replicant.
Ais don't have to duplicate the intelligence of a human. All they have to do is to react to some to some degree to situations. Even if they're really dumb they fall under the umbrella of AI.
And to respond to your comment about human-like AI being "impossible" I disagree. It is certainly possible. How hard can it be to duplicate a human brain, or even exceed it?
Not sure if this is necessary or not, but humans learn based on trial and error, and from what they're told. If you were to make a list of, say "BAD" and "GOOD" to where the A.I. would go towards the GOOD and avoid the BAD. Once they come in contact with an object, they would make a judgement, and it may take a longer or shorter time for the judgement to be made based on the effect of it. Say you learn to ride a bike. You have fun, right? But you fall off one day. Oh noes. But you're still gonna do it, right? The fun overrides the pain, therefore a Bike would be on your "GOOD" list.
Therefore, I'd have to say an A.I. is very, very possible. You could even apply this in your game, although giving it further knowledge already. If it's barely damaged by the attack, add to low caution. It would just move further away. A high caution attack would be straight up Jumping for your life. ...Maybe a bit of an over-exaggeration, but you get my point. That's how the human mind works, in my opinion.
Offline
<set{Epic Fail}to(1
That Was An Epic Fail
Offline